Doc:MassBank/PPR

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
m
m
Line 64: Line 64:
 
     table.insert(list, formula)
 
     table.insert(list, formula)
 
   end
 
   end
   print("<nowiki>{{MassBank/Matrix|data=")
+
   print("{{MassBank/Matrix|data=")
 
   print(table.concat(list,"&&"))
 
   print(table.concat(list,"&&"))
  

Revision as of 21:03, 3 June 2009

Contents

How to Create Precursor-Product Page

Step1

まず以下のスロットにイオンのリストを半角スペース区切りで質量の降順に入力してください。 その後、Createボタンを押してください。

Step2

生成された文字列がページソースの基本です。

{{#lua:

 FORMULA_PAT = "(C?[1-9]?[0-9]?)(H?[1-9]?[0-9]?)(C?l?[2-9]?)(F?[2-9]?)(I?[2-9]?)(N?[1-9]?[0-9]?)(O?[1-9]?[0-9]?)(P?[2-9]?)(S?[2-9]?)";
 FORMULA_CHAR = "CHFINOPSl0-9";
 ATOM = {"C", "H", "Cl", "F", "I", "N", "O", "P", "S"};
 MASS = {12, 1, 35, 19, 127, 14, 16, 31, 32};
 function toFormula(t)
   for i,v in pairs(t) do
     if (v == "")
     then t[i] = 0
     else if (v == ATOM[i])
       then t[i] = 1
       else t[i]=tonumber(string.sub(v,1+string.len(ATOM[i])))
       end
     end
   end
   return t
 end
 function mass(str)
   local t = toFormula({string.match(str,FORMULA_PAT)})
   ret = 0;
   for i,v in pairs(t) do
     ret = ret + t[i] * MASS[i]
   end
   return ret;
 end
 function diff(str1, str2)
   ---computes str1 - str2. If negative, returns nil.---
   local t1 = toFormula({string.match(str1,FORMULA_PAT)})
   local t2 = toFormula({string.match(str2,FORMULA_PAT)})
   for i,_ in pairs(t1) do
     if (t1[i] < t2[i]) then return nil else t1[i] = t1[i]-t2[i] end
   end
   local ret = "";
   for i,v in pairs(t1) do
     if (v >= 1) then ret = ret .. ATOM[i] end
     if (v > 1) then ret = ret .. v end
   end
   return ret
 end
 local list = {}
 local x = nil
 for formula in stdin:gmatch("([%S]+)") do
   if (x ~= nil and mass(formula) > mass(x)) then
     print('Illegal ion order (check mass!): '..x..' < '..formula..'
') end x = formula table.insert(list, formula) end print("
General Index

All Molecules
KOX PR PBX COX

Ion Frequency Prec.-Product Neutral Loss Help





150px

Top 10 Similar Molecules of


Links

Annotations

Precursor Product Comments
(0) (0) ")
 print(table.concat(list,"&&"))
 for i=1,table.getn(list)-1 do
   label = false
   str = "&&"..list[i]..":"
   for j=i+1,table.getn(list) do
     if (diff(list[i],list[j])) then
       str = str .. " " ..list[j]
       label = true
     end
   end
   if (label) then print(str) end
 end

Precursor-Product Relationship

No "ION INFO" line in the form &&(formula)&&(formula)&&...&&

MassBank/PPR 210
CHClFIONSP
210 CHClFIONSP



(pos/neg)<<First Page   (pos/neg)<Previous Page

Next Page>(pos/neg)   Last Page>>(pos/neg)


を、
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox