Template:MassBank/Matrix
From Metabolomics.JP
(Difference between revisions)
m |
|||
Line 1: | Line 1: | ||
− | |||
{{#replace: | {{#replace: | ||
{{#lua: | {{#lua: | ||
Line 69: | Line 68: | ||
local fragments = {}; | local fragments = {}; | ||
local x, y; | local x, y; | ||
+ | ---Read Data--- | ||
for line in stdin:gmatch("[%S ,]+") do | for line in stdin:gmatch("[%S ,]+") do | ||
if (string.find(line, ":") == nil) | if (string.find(line, ":") == nil) | ||
Line 82: | Line 82: | ||
end | end | ||
---Check Ruler--- | ---Check Ruler--- | ||
+ | x = nil; | ||
+ | for formula in string.gmatch(ruler, "([%S]+)") do | ||
+ | if (x ~= nil and mass(formula) > mass(x)) then | ||
+ | print("<big>Illegal ion order: "..x.." < "..formula</big><br/>"); | ||
+ | x = formula; | ||
+ | end | ||
+ | ---Write Matrix--- | ||
print("<small>"); | print("<small>"); | ||
print('{# class ="wikitable"'); | print('{# class ="wikitable"'); | ||
Line 90: | Line 97: | ||
i = i + 1; | i = i + 1; | ||
end | end | ||
+ | ---Header--- | ||
print("#-\n"); | print("#-\n"); | ||
print("## {{PAGENAME}} \n"); | print("## {{PAGENAME}} \n"); | ||
Line 95: | Line 103: | ||
print("#style='text-align:right'# " .. mass(axis[i]) .. "<br/>" .. axis[i]); | print("#style='text-align:right'# " .. mass(axis[i]) .. "<br/>" .. axis[i]); | ||
end | end | ||
+ | ---Rows--- | ||
for i=1, table.getn(axis) do | for i=1, table.getn(axis) do | ||
print("#-\n"); | print("#-\n"); | ||
Line 115: | Line 124: | ||
print("#}"); | print("#}"); | ||
print("</small>"); | print("</small>"); | ||
+ | ---End of Matrix--- | ||
| | | | ||
{{{data|CHClNOPS}}} | {{{data|CHClNOPS}}} |
Revision as of 15:47, 13 May 2009
./lua: /tmp/mw_ex_lua_jd20dh:85: unexpected symbol near '/'