def make_summary(otu_table, level, upper_percentage, lower_percentage, md_as_string=False, md_identifier='taxonomy'):
 header = ['Taxon']
 header.extend(otu_table.ids())
 (counts_by_consensus, sample_map) = sum_counts_by_consensus(otu_table, level, 'Other', md_as_string, md_identifier)
 total_counts = float(sum([sum(i) for i in counts_by_consensus.values()]))
 taxonomy_summary = []
 for (consensus, otu_counts) in sorted(counts_by_consensus.items()):
  if ((lower_percentage is not None) and (otu_counts.sum() > (lower_percentage * total_counts))):
   continue
  elif ((upper_percentage is not None) and (otu_counts.sum() < (upper_percentage * total_counts))):
   continue
  new_row = [consensus]
  new_row.extend(otu_counts)
  taxonomy_summary.append(new_row)
 collapse_f = (lambda id_, md: md[md_identifier][(level - 1)])
 collapsed = otu_table.collapse(collapse_f, norm=False, min_group_size=0, axis='observation')
 return (taxonomy_summary, header)

def make_summary ( otu_table , level , upper_percentage , lower_percentage , md_as_string = False , md_identifier = 'taxonomy' ) : header = [ 'Taxon' ] header . extend ( otu_table . ids ( ) ) ( counts_by_consensus , sample_map ) = sum_counts_by_consensus ( otu_table , level , 'Other' , md_as_string , md_identifier ) total_counts = float ( sum ( [ sum ( i ) for i in counts_by_consensus . values ( ) ] ) ) taxonomy_summary = [ ] for ( consensus , otu_counts ) in sorted ( counts_by_consensus . items ( ) ) : if ( ( lower_percentage is not None ) and ( otu_counts . sum ( ) > ( lower_percentage * total_counts ) ) ) : continue elif ( ( upper_percentage is not None ) and ( otu_counts . sum ( ) < ( upper_percentage * total_counts ) ) ) : continue new_row = [ consensus ] new_row . extend ( otu_counts ) taxonomy_summary . append ( new_row ) collapse_f = ( lambda id_ , md : md [ md_identifier ] [ ( level - 1 ) ] ) collapsed = otu_table . collapse ( collapse_f , norm = False , min_group_size = 0 , axis = 'observation' ) return ( taxonomy_summary , header )
returns taxonomy summary data header is a list of: [ .