Template:JAS/MutationStat: Difference between revisions

mNo edit summary
No edit summary
Line 1: Line 1:
{{#def:list|{{#SearchLine:{{{1}}}/_%|JASReference}}}}
{{#def:list|{{#SearchLine:{{{1}}}/_%|JASReference}}}}


{| class="wikitable" style="text-align:center"
{| class="wikitable" style="text-align:center;width=100%"
|+ The number of mutations <small>(E = exon; I = intron)</small>
|+ The number of mutations <small>(E = exon; I = intron)</small>
|
|
Line 38: Line 38:
|}
|}


{| class="wikitable" style="text-align:center"
{| class="wikitable" style="text-align:center;width=100%"
|+ The type of mutations <small>(M = single-nucleotide mutation; D = deletion; I = insertion)</small>
|+ The type of mutations
|
|
{{#lua:
{{#lua:
Line 53: Line 53:
     end
     end
   end
   end
   print("M<br/>" .. M .. "\n{{#bar:}}D<br/>" .. D .. "\n{{#bar:}}I<br/>" .. I .. "\n{{#bar:}}DI<br/>" .. DI .. "\n{{#bar:}}O<br/>" .. O)
   print("Single-nucleotide<br/>mutation<br/>" .. M .. "\n{{#bar:}}Deletion<br/>" .. D .. "\n{{#bar:}}Insertion<br/>" .. I .. "\n{{#bar:}}Del&Ins<br/>" .. DI .. "\n{{#bar:}}Others<br/>" .. O)
   print("\n{{#bar:}}Total<br/>" .. total)
   print("\n{{#bar:}}Total<br/>" .. total)
|{{#var:list}} }}
|{{#var:list}} }}
|}
|}
{{#var:list}}

Revision as of 17:23, 19 July 2012


The number of mutations (E = exon; I = intron)

{{#lua:

 function SortAndPrint(prefix, T)
   local idx = {}
   for k,v in pairs(T) do
     table.insert(idx, k)
   end
   table.sort(idx)
   for i=1, #idx do
     print(prefix .. idx[i] .. "
" .. T[idx[i]] .."\n|") end end
 local exn = {}
 local inn = {}
 local etc = {}
 local total =0
 for gene in stdin:gmatch("&&(%w+)\n") do
   total = total+1
   local n = tonumber(string.match(gene,"(%d+)"))
   if (string.match(gene,"exon")) then
     if (exn[n] == nil) then exn[n] = 1 else exn[n] = exn[n]+1 end
   elseif (string.match(gene,"intron")) then
     if (inn[n] == nil) then inn[n] = 1 else inn[n] = inn[n]+1 end
   else
     if (etc[gene] == nil) then etc[gene] = 1 else etc[gene] = etc[gene]+1 end
   end
 end
 SortAndPrint("E", exn)
 SortAndPrint("I", inn)
 SortAndPrint("", etc)
 print("Total
" .. total)
}}
The type of mutations

{{#lua:

 local M=0 D=0 I=0 DI=0 O=0
 local total =0
 for type in stdin:gmatch("&&{{{1}}}/(%w+)/") do
   total = total+1
   if (string.match(type,"Mut")) then M = M+1
   elseif (string.match(type,"Ins")) then I = I+1
   elseif (string.match(type,"Del")) then D = D+1
   elseif (string.match(type,"InsDel")) then DI = DI+1
   else O = O+1
   end
 end
 print("Single-nucleotide
mutation
" .. M .. "\n|Deletion
" .. D .. "\n|Insertion
" .. I .. "\n|Del&Ins
" .. DI .. "\n|Others
" .. O) print("\n|Total
" .. total)
}}