Volatile:Pathway/Metabolic

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
This is {{{other}}} parameters.
+
<!---{{#def:pathwaySource|{{{source|}}}}}
{{#lua:
+
{{#def:pathwayPosition|{{#if:{{{position|}}}|{{{position}}}|}}}}
   if ({{{1}}} == 2) then print("red"); else print({{{1}}});
+
{| class="collapsible" width="80%" border="1" cellpadding="2" cellspacing="1" style=" margin: 1em 1em 1em 1em"
 +
|-
 +
| align="center" | {{#repeat:Enzyme/ListMapping|1|{{#cdr:{{{list}}}|&&}}|&&}}
 +
|}---->
 +
{|
 +
|-
 +
|style="text-align:center"|{{Metabolite/GetSysName|{{{source|}}}}}<br/>[[Image:{{{source|}}}.png|thumb|{{#var:PIC_SCALE}}px]]
 +
|
 +
{{#repeatnum:Pathway/MetabolicTable|4|<!----
 +
4行の出力内訳
 +
1 ... mapping pagetitle
 +
2 ... mapping direction
 +
3 ... mapped position
 +
4 ... target molecular ID
 +
--->{{#lua:
 +
   local list = {};
 +
  local origPos = {};
 +
  local count = 0;
 +
  for line in stdin:gmatch("([^\n]+)") do
 +
    count = count+1;
 +
    if (count % 3 ~= 2) then
 +
      --- do nothing for AtomMaps and metabolite IDs ---
 +
      print(line);
 +
    else
 +
      if (count==2) then
 +
      --- First mapping line ---
 +
        local str = "";
 +
        for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 +
          list[k] = v;
 +
          origPos[v] = k;
 +
          if (k == {{{1}}}) then
 +
            str = str .. '<span style=color:red>' ..k.. '->' ..v ..'</span><br/>';
 +
          else
 +
            str = str .. '<br/>' ..k.. '->' ..v;
 +
          end
 +
        end
 +
        print(str);
 +
      else
 +
      --- Second and later lines ---
 +
        local map = {};
 +
        if (string.sub(line,1,1) == 'R') then
 +
          line = string.sub(line,2);
 +
          --- Create reverse mapping
 +
          for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 +
            map[v] = k;
 +
          end
 +
        else
 +
          --- Create standard mapping
 +
          for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 +
            map[k] = v;
 +
          end
 +
        end
 +
        --- Leave only positions that can be mapped
 +
        local list2 = {};
 +
        local origPos2 = {};
 +
        local str = "";
 +
        for k, v in pairs(list) do
 +
          if (map[k] ~= nil)
 +
          then
 +
            list2[map[k]] = map[k];
 +
            origPos2[v] = origPos[k];
 +
            if (origPos[k] == {{{1}}}) then
 +
              str = str .. '<span style=color:red>' ..k.. '->' ..map[k]..'</span>';
 +
            else
 +
              str = str .. '<br/>' .. k .. '->' .. map[k];
 +
            end
 +
          end
 +
        end
 +
        print(str);  -- output 3rd line
 +
        list = list2;
 +
        origPos = origPos2;
 +
      end
 +
      local str = "";
 +
      for k, v in pairs(list) do
 +
        str = str .. '[[Pathway:{{PAGENAME}}|' ..k.. ']]<br/>';
 +
      end
 +
      print(str); -- output 4th line
 +
    end
 
   end
 
   end
|}}
+
|{{#repeat:Pathway/Mapping|1|{{#cdr:{{{list}}}|&&}}|&&}} }}
 
+
}}
[[Volatile:Sandbox|2|button2]]
+
|}
[[Volatile:Sandbox|3|button3]]
+
[[Volatile:Sandbox|4|button4]]
+

Revision as of 23:25, 17 March 2009

#ifeq:
Mapping
Arrow00d35.png
{{{2}}}
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox