Template:Pathway/Metabolic

From Metabolomics.JP
< Template:Pathway(Difference between revisions)
Jump to: navigation, search
Line 10: Line 10:
 
       --- do nothing for metabolite IDs ---
 
       --- do nothing for metabolite IDs ---
 
       print(line);
 
       print(line);
     else if (count==2) then
+
     else  
 +
      if (count==2) then
 
       --- First mapping line ---
 
       --- First mapping line ---
      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
        list[k] = v;
+
          list[k] = v;
      end
+
        end
    else
+
      else
 
       --- Second and later lines ---
 
       --- Second and later lines ---
    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 = {};
+
          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
 +
          list = list2;
 +
        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
 +
          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
 
       end
       --- Leave only positions that can be mapped
+
       print("Now ");
      local list2 = {};
+
 
       for k, v in pairs(list) do
 
       for k, v in pairs(list) do
         if (map[k] ~= nil) then list2[map[k]] = map[k]; end
+
         print(k .. "-" .. v .. " ");
 
       end
 
       end
       list = list2;
+
       print("\n");
    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
+
      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
+
    end
+
    print("Now ");
+
    for k, v in pairs(list) do
+
      print(k .. "-" .. v .. " ");
+
 
     end
 
     end
    print("\n");
 
 
   end
 
   end
 
   --table.sort(list);
 
   --table.sort(list);

Revision as of 12:24, 16 March 2009



Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox