def summarize_taxa(biom):
tamtcounts = defaultdict(int)<EOL>tot_seqs = <NUM_LIT:0.0><EOL>for row, col, amt in biom['<STR_LIT:data>']:<EOL><INDENT>tot_seqs += amt<EOL>rtax = biom['<STR_LIT>'][row]['<STR_LIT>']['<STR_LIT>']<EOL>for i, t in enumerate(rtax):<EOL><INDENT>t = t.strip()<EOL>if i == len(rtax)-<NUM_LIT:1> and len(t) > <NUM_LIT:3> and len(rtax[-<NUM_LIT:1>]) > <NUM_LIT:3>:<EOL><INDENT>t = '<STR_LIT>'+rtax[i-<NUM_LIT:1>].strip().split('<STR_LIT:_>')[-<NUM_LIT:1>]+'<STR_LIT:_>'+t.split('<STR_LIT:_>')[-<NUM_LIT:1>]<EOL><DEDENT>tamtcounts[t] += amt<EOL><DEDENT><DEDENT>lvlData = {lvl: levelData(tamtcounts, tot_seqs, lvl) for lvl in ['<STR_LIT:k>', '<STR_LIT:p>', '<STR_LIT:c>', '<STR_LIT:o>', '<STR_LIT:f>', '<STR_LIT:g>', '<STR_LIT:s>']}<EOL>return tot_seqs, lvlData<EOL>
Given an abundance table, group the counts by every
taxonomic level.