def make_sample_node_table(bt, mf_dict):
 sids = bt.ids()
 header = ('#NodeID DCTB NodeType DCTB Abundance DCTB ' + ' DCTB '.join(mf_dict[sids[0]].keys()))
 lines = ([header] + [(('%s DCTB sample DCTB %s DCTB ' % (sid, bt.data(sid, axis='sample').sum())) + ' DCTB '.join(mf_dict[sid].values())) for sid in sids])
 return lines

def make_sample_node_table ( bt , mf_dict ) : sids = bt . ids ( ) header = ( '#NodeID DCTB NodeType DCTB Abundance DCTB ' + ' DCTB ' . join ( mf_dict [ sids [ 0 ] ] . keys ( ) ) ) lines = ( [ header ] + [ ( ( '%s DCTB sample DCTB %s DCTB ' % ( sid , bt . data ( sid , axis = 'sample' ) . sum ( ) ) ) + ' DCTB ' . join ( mf_dict [ sid ] . values ( ) ) ) for sid in sids ] ) return lines
make sample node table where samples and their metadata are recorded .