Condense fasta header

Biopython hack to condense fasta header. When there is a lengthy header in fasta file like the following:
>geneid1213 len = 234 covStat = val otherparam = sval,
Shorten it to make it
from Bio import SeqIO
new_header = []
with open("test.fasta", "rU") as infile:
  for record in SeqIO.parse(infile, "fasta"):
    record.description = =
SeqIO.write(new_header, "short_header.fasta", "fasta")
print("program complete")


Popular posts from this blog

Map multiple annotations using pandas

Fasta Header Replacer