Sandbox4

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
 
{{#lua:
 
{{#lua:
 
   local T = {}
 
   local T = {}
 +
  total = 0
 
   for genus in stdin:gmatch("&&([%a]+) [-%a%. ]+&&[%a%d]+") do
 
   for genus in stdin:gmatch("&&([%a]+) [-%a%. ]+&&[%a%d]+") do
 +
    total = total + 1
 
     if (T[genus] == null) then T[genus] = 1 else T[genus] = T[genus] + 1 end
 
     if (T[genus] == null) then T[genus] = 1 else T[genus] = T[genus] + 1 end
 
   end
 
   end
   total = 0
+
   print(total)
 
   for k,v in pairs(T) do
 
   for k,v in pairs(T) do
    total = total + v
 
 
     print(k.." "..v)
 
     print(k.." "..v)
 
   end
 
   end
  print(total)
 
 
|{{#SearchLine:FL63|Reference}} }}
 
|{{#SearchLine:FL63|Reference}} }}
 
}}
 
}}
  
 
{{#lua:
 
{{#lua:
   local T = {}
+
   T = {}
 +
  total = 0
 
   for family, num in stdin:gmatch("([%a]+) ([%d]+)") do
 
   for family, num in stdin:gmatch("([%a]+) ([%d]+)") do
 +
    total = total + num
 
     if (T[family] == null) then T[family] = num else T[family] = T[family] + num end
 
     if (T[family] == null) then T[family] = num else T[family] = T[family] + num end
 
   end
 
   end
   total = 0
+
   print("Total "..total.." families.<br/>")
 +
 
 +
  S = {} I = {}
 
   for k,v in pairs(T) do
 
   for k,v in pairs(T) do
     total = total + v
+
     if (S[v] == null) then S[v] = { k } table.insert(I,v) else table.insert(S[v], k) end
    print(k.." "..v)
+
 
   end
 
   end
   print(total)
+
   labels = ""
 +
  data = ""
 +
  table.sort(I)
 +
  for k,v in pairs(I) do
 +
    T = S[v]
 +
    labels = labels .. T[1]
 +
    if (#T > 1) then labels = labels .. " and others, " else labels = labels .. ", " end
 +
    data = data .. v .. ", "
 +
  end
 +
 
 
| {{#repeat:Stats/Family/GetFamilyName|1|{{#var:stat}} }}
 
| {{#repeat:Stats/Family/GetFamilyName|1|{{#var:stat}} }}
 
}}
 
}}

Revision as of 21:57, 10 December 2009


Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox