Template:MassBank/Matrix

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
m
m
Line 3: Line 3:
 
   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";
 
   FORMULA_CHAR = "CHNOPSl0-9";
   ATOMS = {"C", "H", "Cl", "N", "O", "P", "S"};
+
   ATOM = {"C", "H", "Cl", "N", "O", "P", "S"};
 
   MASS = {12, 1, 35, 14, 16, 31, 32};
 
   MASS = {12, 1, 35, 14, 16, 31, 32};
  
Line 10: Line 10:
 
       if (v == "")
 
       if (v == "")
 
       then t[i] = 0
 
       then t[i] = 0
       else if (v == ATOMS[i])
+
       else if (v == ATOM[i])
 
         then t[i] = 1
 
         then t[i] = 1
         else t[i]=tonumber(string.sub(v,1+string.len(ATOMS[i])))
+
         else t[i]=tonumber(string.sub(v,1+string.len(ATOM[i])))
 
         end
 
         end
 
       end
 
       end
Line 37: Line 37:
 
     local ret = "";
 
     local ret = "";
 
     for i,v in pairs(t1) do
 
     for i,v in pairs(t1) do
       if (v >= 1) then ret = ret .. ATOMS[i] end
+
       if (v >= 1) then ret = ret .. ATOM[i] end
 
       if (v > 1) then ret = ret .. v end
 
       if (v > 1) then ret = ret .. v end
 
     end
 
     end

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