Template:Pathway/Metabolic

From Metabolomics.JP
< Template:Pathway(Difference between revisions)
Jump to: navigation, search
 
(47 intermediate revisions by one user not shown)
Line 1: Line 1:
{{#def:pathwaySource|{{{source|}}}}}
+
{{Volatile:Pathway/Metabolic|{{{source|}}}|{{#replace:{{#trimex:{{{list|}}}}}|&&|__}}|0|{{PAGENAME}}}}
{{#def:pathwayPosition|{{#if:{{{position|}}}|{{{position}}}|}}}}
+
 
+
{{#lua:
+
  local list = {};
+
  local count = 0;
+
  for line in stdin:gmatch("([^\n]+)") do
+
    if (count==0) then
+
      --- First line
+
      for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
+
        table.insert(list,v);
+
      end
+
    else
+
      --- Second and later lines
+
    print("\n" .. line .. "\n");
+
    if (string.sub(line,1,1) == 'R') then
+
      line = string.sub(line,2);
+
      --- Create reverse mapping
+
      local map = {};
+
      for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
+
        map[v] = k;
+
        print(v .. "-" .. k .. " ");
+
      end
+
      --- Leave only positions that can be mapped
+
      for k, v in pairs(list) do
+
        if (map[v] == nil) then
+
          table.remove(list,k);
+
        else
+
          list[k] = map[v];
+
        end
+
      end
+
    else
+
      --- Create standard mapping
+
      local map = {};
+
      for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
+
        map[k] = v;
+
        print(k .. "-" .. v .. " ");
+
      end
+
      --- Leave only positions that can be mapped
+
      for k, v in pairs(list) do
+
        if (map[v] == nil) then
+
          table.remove(list,k);
+
        else
+
          list[k] = map[v];
+
        end
+
      end
+
    end
+
    end
+
  end
+
  table.sort(list);
+
  for i,v in ipairs(list)
+
    do print(v) end
+
| 1 2 3 4 5 6 7 8
+
{{#repeat:Pathway/Mapping|1|{{#cdr:{{{list}}}|&&}}|&&}}
+
}}
+

Latest revision as of 10:57, 25 March 2009


Total 0 steps.

#ifeq:
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox