In [26]:
from glob import iglob
from Bio import SeqIO
from gzip import open as gopen
for filename in iglob("Baculo/*.gb"):
print filename
gb = SeqIO.read(open(filename, "rb"), "genbank")
gb.id = gb.name
gb.description = ""
with gopen(filename.split(".")[0]+".fa.gz", "wb") as fasta:
fasta.write(gb.format("fasta"))
In [ ]: