Template:MassBank/Matrix
From Metabolomics.JP
(Difference between revisions)
m (→Top 10 Similar Molecules) |
|||
Line 1: | Line 1: | ||
{{MassBank/Header}} | {{MassBank/Header}} | ||
+ | |||
+ | |||
+ | =Top 10 Similar Molecules= | ||
+ | {{Twocolumn| | ||
+ | Similarity score is defined as the sum of Shannon entropy of shared ionic formulas. | ||
+ | | | ||
+ | 類似度スコアはスペクトル間で共有するイオン式のシャノン情報量の総和です。 | ||
+ | }} | ||
+ | {{#lua: | ||
+ | function intersection(x, y) | ||
+ | local z = {} | ||
+ | local i = 1 | ||
+ | local j = 1 | ||
+ | repeat | ||
+ | if (x[i] == y[j]) | ||
+ | then table.insert(z, x[i]) i = i + 1 j = j + 1 end | ||
+ | if (i > table.getn(x) or j > table.getn(y)) | ||
+ | then break end | ||
+ | if (x[i] > y[j]) then j = j + 1 end | ||
+ | if (j > table.getn(y)) then break end | ||
+ | if (x[i] < y[j]) then i = i + 1 end | ||
+ | if (i > table.getn(x)) then break end | ||
+ | until false | ||
+ | return z | ||
+ | end | ||
+ | |||
+ | Name = {} | ||
+ | Ions = {} | ||
+ | Freq = {} | ||
+ | total = 0 | ||
+ | ---Register Ions--- | ||
+ | for id, frag in stdin:gmatch("&&([%a%d]+)&&([%S]+)") do | ||
+ | table.insert(Name, id) | ||
+ | T = {} | ||
+ | for f in string.gmatch(frag,"([%a%d]+)&&") do | ||
+ | table.insert(T, f) | ||
+ | if (Freq[f]) then Freq[f] = Freq[f] + 1 else Freq[f] = 1 total = total + 1 end | ||
+ | end | ||
+ | table.sort(T) | ||
+ | table.insert(Ions, T) | ||
+ | end | ||
+ | ---Compute Similarity--- | ||
+ | Rank = {} | ||
+ | Score = {} | ||
+ | for i=2, table.getn(Ions) do | ||
+ | R = intersection(Ions[i], Ions[1]) | ||
+ | if (table.getn(R) > 0) then | ||
+ | inf = 0 | ||
+ | for _,v in pairs(R) do | ||
+ | inf = inf - math.log(Freq[v]/total) | ||
+ | end | ||
+ | inf = math.floor(inf*100) + i * 0.0001 | ||
+ | table.insert(Score, inf) | ||
+ | Rank[inf] = i | ||
+ | end | ||
+ | end | ||
+ | table.sort(Score) | ||
+ | ---Output Similarity--- | ||
+ | for i=table.getn(Score), math.max(table.getn(Score)-9,1), -1 do | ||
+ | print("# [[MassBank:" .. Name[ Rank[Score[i]] ] .. "]] Score:" ..math.floor(Score[i])/100) | ||
+ | end | ||
+ | | | ||
+ | &&{{PAGENAME}}{{#car:{{{data}}}}} | ||
+ | {{#SearchLine:^&&_%&&|MassBank}} | ||
+ | }} | ||
+ | |||
+ | =Links= | ||
+ | {{#repeat:MassBank/SearchFgmt|1| | ||
+ | {{#lua: | ||
+ | ---find and print Ruler--- | ||
+ | for line in stdin:gmatch("[%S ,]+") do | ||
+ | if (string.find(line, "^&&[&%a%d]+&&$") ~= nil) then | ||
+ | print(line) return | ||
+ | end | ||
+ | end | ||
+ | |{{{data|CHClFINOPS}}} | ||
+ | }}|&&}} | ||
+ | |||
+ | =Annotations= | ||
+ | {{#replace: | ||
+ | {{#lua: | ||
+ | ---print comments--- | ||
+ | FORMULA_CHAR = "CHFINOPSl0-9"; | ||
+ | ret = "" | ||
+ | comment = ""; | ||
+ | head = ""; | ||
+ | tail = ""; | ||
+ | for line in stdin:gmatch("[%S ,]+") do | ||
+ | repeat | ||
+ | if (string.find(line, "^&&[&%a%d]+&&$") ~= nil) then break end | ||
+ | local h, t = string.match(line, "^&&(["..FORMULA_CHAR.."]+) *: *(["..FORMULA_CHAR.." ]+)$"); | ||
+ | if (h ~= nil and t ~= nil) then | ||
+ | if (comment ~= "") then | ||
+ | ret = ret .."~-\n~~"..head.." ~~ "..tail.."\n~~ "..comment.."\n" | ||
+ | comment = "" | ||
+ | end | ||
+ | head = h; tail = t | ||
+ | break | ||
+ | end | ||
+ | ---comment lines--- | ||
+ | comment = comment .. line.."\n" | ||
+ | until true | ||
+ | end | ||
+ | if (comment ~= "") then | ||
+ | ret = ret .. "~-\n~~"..head.." ~~ "..tail.."\n~~ "..comment.."\n" | ||
+ | end | ||
+ | if (ret ~= "") then | ||
+ | ret = '{~ class="wikitable sortable"\n!Precursor~~Product~~Comments\n'.. ret ..'~}' | ||
+ | print(ret) | ||
+ | end | ||
+ | |{{{data|CHClFINOPS}}} | ||
+ | }} | ||
+ | |~|{{#bar:}}}} | ||
=Precursor-Product Relationship= | =Precursor-Product Relationship= | ||
Line 135: | Line 248: | ||
}} | }} | ||
|#|{{#bar:}}}} | |#|{{#bar:}}}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 10:59, 8 June 2009
General Index | Ion Frequency | Prec.-Product | Neutral Loss | Help |
Contents |
Top 10 Similar Molecules
Similarity score is defined as the sum of Shannon entropy of shared ionic formulas.
- MassBank:KOX00662p Score:19.04
- MassBank:KOX00276p Score:19.04
- MassBank:KOX00039p Score:10.76
- MassBank:KOX00795p Score:8.27
- MassBank:KOX00740p Score:8.27
- MassBank:KOX00739p Score:8.27
- MassBank:KOX00547p Score:8.27
- MassBank:KOX00292p Score:8.27
- MassBank:KOX00102p Score:8.27
- MassBank:KOX00700p Score:5.38
Links
Annotations
Precursor | Product | Comments |
---|---|---|
CHClFINOPS |
Precursor-Product Relationship
The matrix is viewed columnwise. The topmost precursor ion in bold face produces the product ions beneath it. Each formula in matrix cells corresponds to the neutral loss. Blackout cells indicate products that cannot be derived, and orange cells indicate a structurally plausible link produced by cleaving a single chemical bond (in cases of ring-opening, two bonds).
No "ION INFO" line in the form &&(formula)&&(formula)&&...&&
ID: MassBank/Matrix | 210 CHClFIONSP |
210 CHClFIONSP |
|