convert GenBank formatted sequence file to FASTA format
1
2
Entering edit mode
2.7 years ago
lauren ▴ 20

how to Write a python program that asks the user for a sequence in GenBank format and convert the GenBank formatted sequence into FASTA format then Write the FASTA formatted sequence to a file.

fasta python genback • 1.6k views
ADD COMMENT
0
Entering edit mode

sounds like a homework. What did you write so far ?

ADD REPLY
2
Entering edit mode
2.7 years ago
cfos4698 ★ 1.1k

Biopython is great for working with sequence data in python. Taken almost verbatim from their documentation (https://biopython.org/wiki/SeqIO):

from Bio import SeqIO
import sys

count = SeqIO.convert(sys.argv[1], "genbank", sys.argv[2], "fasta")
print("Converted %i records" % count)

Save as anything, e.g. script.py, then:

python3 script.py example.gb example.fasta

ADD COMMENT

Login before adding your answer.

Traffic: 2555 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6