Having issues trying to edit genbank file and save as fasta with BioPython
Hello.
I'm doing some modifications on a genbank file and I'm trying to save the new file.
I put the modifications in pseudocode, because I just want to focus on the issue of it not saving correctly.
from Bio import SeqIO
with open("file.gb", "r") as f:
file = SeqIO.read("file.gb", format = "genbank")
for [something] in file.[something] :
if [something] = [something] :
a = b
c = modification_a
with open("newfile.fasta", "w") as f:
SeqIO.write(file, f, format = "fasta")
It seems to be saving the values of "a" only, rather than the whole file with the new modifications.
• 86 views
•
link
0 answers
No answers yet.
Log in to answer this question.
In your pseudocode, does
=symbolize both comparison and assignment? If the pseudocode is python-ish, are the indentations done properly? Theifblock looks iffy.Yes. I look into the file for a certain type, then I modify the text for one of the qualifiers.
So would you say that the problem is in the "for" and that the rest looks fine?
Also, is it even necessary to put with open(...) in the beginning? Can I directly just do: file = SeqIO.read("file.gb", format="genbank")?