Template:Pathway/Metabolic

From Metabolomics.JP
< Template:Pathway(Difference between revisions)
Jump to: navigation, search
Line 18: Line 18:
 
       else
 
       else
 
       --- Second and later lines ---
 
       --- Second and later lines ---
 +
        local map = {};
 
         if (string.sub(line,1,1) == 'R') then
 
         if (string.sub(line,1,1) == 'R') then
 
           line = string.sub(line,2);
 
           line = string.sub(line,2);
 
           --- Create reverse mapping
 
           --- Create reverse mapping
          local map = {};
 
 
           for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 
           for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 
             map[v] = k;
 
             map[v] = k;
 
             --print(v .. "-" .. k .. " ");
 
             --print(v .. "-" .. k .. " ");
          end
 
          --- Leave only positions that can be mapped
 
          local list2 = {};
 
          for k, v in pairs(list) do
 
            if (map[k] ~= nil) then list2[map[k]] = map[k]; end
 
 
           end
 
           end
          list = list2;
 
 
         else
 
         else
 
           --- Create standard mapping
 
           --- Create standard mapping
          local map = {};
 
 
           for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 
           for k, v in string.gmatch(line, "(%d%d?) (%d%d?) %d?%d? ?;") do
 
             map[k] = v;
 
             map[k] = v;
 
             --print(k .. "-" .. v .. " ");
 
             --print(k .. "-" .. v .. " ");
 
           end
 
           end
          --- Leave only positions that can be mapped
 
          local list2 = {};
 
          for k, v in pairs(list) do
 
            if (map[k] ~= nil) then list2[map[k]] = map[k]; end
 
          end
 
          list = list2;
 
 
         end
 
         end
 +
        --- Leave only positions that can be mapped
 +
        local list2 = {};
 +
        for k, v in pairs(list) do
 +
          if (map[k] ~= nil) then list2[map[k]] = map[k]; end
 +
        end
 +
        list = list2;
 
       end
 
       end
 
       local str = "";
 
       local str = "";

Revision as of 12:30, 16 March 2009



Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox