Entering edit mode
2.8 years ago
schlogl
▴
160
Hi there, There are any easy way (or hard) to split a multi Gbff file (7815) in single gbk files? I appreciate any help! Paulo
Hi there, There are any easy way (or hard) to split a multi Gbff file (7815) in single gbk files? I appreciate any help! Paulo
You could use BioPython like so:
from Bio import SeqIO
# Parse GenBank with multiple records
stream = SeqIO.parse("genomes.gb", format="genbank")
# Write each record as a separate file
for rec in stream:
SeqIO.write(rec, f"{rec.id}.gb", "genbank")
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
@Istvan Albert To be real honest I tried but I maybe messed up because in my code it was reading like a unique file 8(. I will check it out. Thank you for your time. Paulo
The code is really simple. The parsing step reads the original multi-genbank file, then the loop writes into a filename that uses the record id in the name. Change it to
to see each record id in your file, perhaps it is reusing the ids