def make_biplot_scores_output(taxa):
 output = []
 ndims = len(taxa['coord'][1])
 header = ('#Taxon DCTB ' + ' DCTB '.join([('pc%d' % i) for i in xrange(ndims)]))
 output.append(header)
 for (i, taxon) in enumerate(taxa['lineages']):
  line = (taxon + ' DCTB ')
  line += ' DCTB '.join(map(str, taxa['coord'][i]))
  output.append(line)
 return output

def make_biplot_scores_output ( taxa ) : output = [ ] ndims = len ( taxa [ 'coord' ] [ 1 ] ) header = ( '#Taxon DCTB ' + ' DCTB ' . join ( [ ( 'pc%d' % i ) for i in xrange ( ndims ) ] ) ) output . append ( header ) for ( i , taxon ) in enumerate ( taxa [ 'lineages' ] ) : line = ( taxon + ' DCTB ' ) line += ' DCTB ' . join ( map ( str , taxa [ 'coord' ] [ i ] ) ) output . append ( line ) return output
create convenient output format of taxon biplot coordinates taxa is a dict containing lineages and a coord matrix coord output is a list of lines .