Template:MassBank/Matrix

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
m
m
Line 5: Line 5:
 
   ATOMS = {"C", "H", "Cl", "N", "O", "P", "S"};
 
   ATOMS = {"C", "H", "Cl", "N", "O", "P", "S"};
 
   MASS = {12, 1, 35, 14, 16, 31, 32};
 
   MASS = {12, 1, 35, 14, 16, 31, 32};
 +
  MASS2={C=12,H=1,Cl=35,N=14,O=16,P=31,S=32};
  
 
   function map(f, list)
 
   function map(f, list)
Line 46: Line 47:
 
   function atomicNum(atom, str)
 
   function atomicNum(atom, str)
 
     if (str == "") then return 0 end
 
     if (str == "") then return 0 end
     if (MASS[str] ~= nil) then return 1 end
+
     if (MASS2[str] ~= nil) then return 1 end
 
     if (str == atom) then return 1 end
 
     if (str == atom) then return 1 end
     if (string.len(str) > 2 and MASS[string.sub(str,1,2)] ~= nil)
+
     if (string.len(str) > 2 and MASS2[string.sub(str,1,2)] ~= nil)
 
       then return tonumber(string.sub(str,3));
 
       then return tonumber(string.sub(str,3));
 
     else return tonumber(string.sub(str,2));
 
     else return tonumber(string.sub(str,2));

Revision as of 23:25, 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