def fix_abundance_labels(output_consensus_fp, filtered_consensus_fp):
 consensus_f = open(output_consensus_fp, 'U')
 filtered_f = open(filtered_consensus_fp, 'w')
 for (label, seq) in parse_fasta(consensus_f):
  fasta_label = label.split()[0]
  size = ('size=' + label.split('size=')[1].replace(';', ''))
  final_label = ('%s;%s' % (fasta_label, size))
  filtered_f.write(('>%s\n%s\n' % (final_label, seq)))
 consensus_f.close()
 filtered_f.close()

def fix_abundance_labels ( output_consensus_fp , filtered_consensus_fp ) : consensus_f = open ( output_consensus_fp , 'U' ) filtered_f = open ( filtered_consensus_fp , 'w' ) for ( label , seq ) in parse_fasta ( consensus_f ) : fasta_label = label . split ( ) [ 0 ] size = ( 'size=' + label . split ( 'size=' ) [ 1 ] . replace ( ';' , '' ) ) final_label = ( '%s;%s' % ( fasta_label , size ) ) filtered_f . write ( ( '>%s\n%s\n' % ( final_label , seq ) ) ) consensus_f . close ( ) filtered_f . close ( )
puts size= part of label as second component after white space output_consensus_fp: consensus filepath with abundance data filtered_consensus_fp: output filepath name .