Template:MassBank/Matrix

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
m
m
Line 2: Line 2:
 
{{#lua:
 
{{#lua:
 
   FORMULA_PAT = "(C?[1-9]?[0-9]?)(H?[1-9]?[0-9]?)(C?l?[2-9]?)(N?[1-9]?[0-9]?)(O?[1-9]?[0-9]?)(P?[2-9]?)(S?[2-9]?)";
 
   FORMULA_PAT = "(C?[1-9]?[0-9]?)(H?[1-9]?[0-9]?)(C?l?[2-9]?)(N?[1-9]?[0-9]?)(O?[1-9]?[0-9]?)(P?[2-9]?)(S?[2-9]?)";
 +
  FORMULA_CHAR = "CHNOPSl0-9";
 
   function atomicNum(atom, str)
 
   function atomicNum(atom, str)
 
     if (str == "") then return 0; end
 
     if (str == "") then return 0; end
Line 75: Line 76:
 
     else  
 
     else  
 
       ---register fragments---
 
       ---register fragments---
       head, tail = string.match(line, "([CHNOPSl0-9]+) *: *([CHNOPSl0-9 ]+)");
+
       head, tail = string.match(line, "^(["..FORMULA_CHAR.."]+) *: *(["..FORMULA_CHAR.." ]+)$");
 
       if (head ~= nil and tail ~= nil) then
 
       if (head ~= nil and tail ~= nil) then
 
         y = {};
 
         y = {};

Revision as of 17:01, 13 May 2009

No ion information in the form &&(formula)&&(formula)&&...&&

MassBank/Matrix 64
CHClONSP
64
CHClONSP



Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox