def write_trunc_fasta(trunc_fasta_seqs, fasta_out_fp, seq_order):
 fasta_out = open(fasta_out_fp, 'w')
 for label in seq_order:
  trunc_label = label.split()[0].strip()
  fasta_out.write(('>%s\n%s\n' % (label, trunc_fasta_seqs[trunc_label])))

def write_trunc_fasta ( trunc_fasta_seqs , fasta_out_fp , seq_order ) : fasta_out = open ( fasta_out_fp , 'w' ) for label in seq_order : trunc_label = label . split ( ) [ 0 ] . strip ( ) fasta_out . write ( ( '>%s\n%s\n' % ( label , trunc_fasta_seqs [ trunc_label ] ) ) )
writes truncated fasta seqs in order specified with seq_order trunc_fasta_seqs: dict of fasta label: truncated sequence string fasta_out_fp: output filepath to write to seq_order: list of fasta labels in the order of the original input fasta .