Entering edit mode
10.7 years ago
QVINTVS_FABIVS_MAXIMVS
★
2.6k
I'm learning biopython and I'm having trouble with reassigning the seq_record.id variable for my sequence.
from Bio import SeqIO
for seq_record in SeqIO.parse(file, "fasta"):
seq_record.id = name[0] #name[0] is the new ID
printseq_record.id)
SeqIO.write(seq_record, "/Users/bucephalus/Desktop/nc_pimps/raw/"+name[0]+".fas", "fasta")
When the program prints it prints what I want
12345-123
12346-123
...
But when I open my files the headers are like
>12345-123 gi|1906382|gb|K03455.1|HIVHXB2CG
HELP PLOX
Tusen takk
If you change just the description, then the fasta file contains the old id and then the new description. If both the old id and then the new description are changed identically, then you get the effect that you desire.