def format_unifrac_sample_mapping(sample_ids, otu_ids, otu_table_array):
 out = []
 for (i, row) in enumerate(otu_table_array):
  for (j, val) in enumerate(row):
   if (val > 0):
    line = [otu_ids[i], sample_ids[j], str(val)]
    out.append(' DCTB '.join(line))
 return out

def format_unifrac_sample_mapping ( sample_ids , otu_ids , otu_table_array ) : out = [ ] for ( i , row ) in enumerate ( otu_table_array ) : for ( j , val ) in enumerate ( row ) : if ( val > 0 ) : line = [ otu_ids [ i ] , sample_ids [ j ] , str ( val ) ] out . append ( ' DCTB ' . join ( line ) ) return out
returns a unifrac sample mapping file from output of parse_otu_table .