|
|
Line 1: |
Line 1: |
− | {{#def:stat|
| |
| {{#lua: | | {{#lua: |
− | local T = {}
| + | for line in stdin:gmatch("[%S%*: ]+") do |
− | total = 0
| + | print(line.."<br/>") |
− | 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
| + | |
| end | | end |
− | print(total)
| + | | {{#SearchLine:&&|Ojima|_%}} |
− | for k,v in pairs(T) do
| + | |
− | print(k.." "..v)
| + | |
− | end
| + | |
− | |{{#SearchLine:FL63|Reference}} }} | + | |
− | }}
| + | |
− | | + | |
− | {|
| + | |
− | |-
| + | |
− | |
| + | |
− | {{#graph:pie|size=400x200;margin=0,0,0,0;title=Top 5 Families;legend=0.65x0.45;label=;
| + | |
− | {{#lua:
| + | |
− | T = {}
| + | |
− | total = 0
| + | |
− | tfam = 0
| + | |
− | for family, num in stdin:gmatch("([%a]+) ([%d]+)") do
| + | |
− | total = total + num
| + | |
− | if (T[family] == null) then T[family] = tonumber(num) tfam = tfam + 1 else T[family] = T[family] + num end
| + | |
− | end
| + | |
− | S = {}
| + | |
− | I = {}
| + | |
− | for k,v in pairs(T) do
| + | |
− | if (S[v] == null) then S[v] = { k } table.insert(I,v) else table.insert(S[v], k) end
| + | |
− | end
| + | |
− | table.sort(I)
| + | |
− | for i=table.getn(I), math.max(table.getn(I)-4,1),-1 do
| + | |
− | T = S[I[i]]
| + | |
− | print(table.concat(T," ").."="..I[i]..";")
| + | |
− | total=total-I[i]
| + | |
− | end
| + | |
− | print("others="..total)
| + | |
− | | {{#repeat:Stats/Family/GetFamilyName|1|{{#var:stat}} }}
| + | |
− | }}
| + | |
− | }}
| + | |
− | | For detailed metabolite-species statistics, visit [[Volatile:MetaboliteDistribution|FL63|this page]].
| + | |
− | |}
| + | |
− | | + | |
− | ==Family Distribution==
| + | |
− | {{#lua:
| + | |
− | T = {}
| + | |
− | total = 0
| + | |
− | tfam = 0
| + | |
− | for family, num in stdin:gmatch("([%a]+) ([%d]+)") do
| + | |
− | total = total + num
| + | |
− | if (T[family] == null) then T[family] = tonumber(num) tfam = tfam + 1 else T[family] = T[family] + num end
| + | |
− | end
| + | |
− | S = {}
| + | |
− | I = {}
| + | |
− | for k,v in pairs(T) do
| + | |
− | if (S[v] == null) then S[v] = { k } table.insert(I,v) else table.insert(S[v], k) end
| + | |
− | end
| + | |
− | table.sort(I)
| + | |
− | print('{{{#bar:}} class="wikitable"')
| + | |
− | print('{{#bar:}}-')
| + | |
− | print('! #metabolite {{#bar:}}{{#bar:}} Total '..total..' metabolites in '..tfam..' families')
| + | |
− | for i=table.getn(I), 1, -1 do
| + | |
− | print('{{#bar:}}-')
| + | |
− | T = S[I[i]]
| + | |
− | print("{{#bar:}}"..I[i].." ("..string.format("%.2f",100*I[i]/total).."%){{#bar:}}{{#bar:}}")
| + | |
− | for j,w in pairs(T) do
| + | |
− | print("[[:Category:"..w.."{{#bar:}}"..w.."]]; ")
| + | |
− | end
| + | |
− | end
| + | |
− | print("{{#bar:}}}")
| + | |
− | | {{#repeat:Stats/Family/GetFamilyName|1|{{#var:stat}} }}
| + | |
− | }}
| + | |
− | | + | |
− | ==Order Distribution==
| + | |
− | {{#lua:
| + | |
− | T = {}
| + | |
− | total = 0
| + | |
− | tord = 0
| + | |
− | for order, num in stdin:gmatch("([%a]+) ([%d]+)") do
| + | |
− | total = total + num
| + | |
− | if (T[order] == null) then T[order] = tonumber(num) tord = tord + 1 else T[order] = T[order] + num end
| + | |
− | end
| + | |
− | S = {}
| + | |
− | I = {}
| + | |
− | for k,v in pairs(T) do
| + | |
− | if (S[v] == null) then S[v] = { k } table.insert(I,v) else table.insert(S[v], k) end
| + | |
− | end
| + | |
− | table.sort(I)
| + | |
− | print('{{{#bar:}} class="wikitable"')
| + | |
− | print('{{#bar:}}-')
| + | |
− | print('! #metabolite {{#bar:}}{{#bar:}} Total '..total..' metabolites in '..tord..' orders')
| + | |
− | for i=table.getn(I), 1, -1 do
| + | |
− | print('{{#bar:}}-')
| + | |
− | T = S[I[i]]
| + | |
− | print("{{#bar:}}"..I[i].." ("..string.format("%.2f",100*I[i]/total).."%){{#bar:}}{{#bar:}}")
| + | |
− | print(table.concat(T, "; "))
| + | |
− | end
| + | |
− | print("{{#bar:}}}")
| + | |
− | | {{#repeat:Stats/Family/GetOrderName|1|{{#var:stat}} }}
| + | |
− | }}
| + | |
− | | + | |
− | ==Details==
| + | |
− | {{#repeat:Stats/Family/GetFamilyName2|1|
| + | |
− | {{#lua:
| + | |
− | local T = {}
| + | |
− | total = 0
| + | |
− | for genus, id in stdin:gmatch("&&([%a]+) [-%a%. ]+&&([%a%d]+)") do
| + | |
− | total = total + 1
| + | |
− | if (T[genus] == null) then T[genus] = {"[["..id.."]]"} else table.insert(T[genus], "[["..id.."]]") end
| + | |
− | end
| + | |
− | for k,v in pairs(T) do
| + | |
− | print(k.." "..table.concat(T[k], "; "))
| + | |
− | end
| + | |
− | |{{#SearchLine:FL63|Reference}} }} | + | |
| }} | | }} |