Hi everyone, I'm trying to extract a CDS based on the product value. Basically want to extract a certain gene from multiple genbank files. This is the code I have so far:
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqFeature import SeqFeature
from Bio.SeqRecord import SeqRecord
gb_file = open("fimA_seqs.gb", "r")
for gb_record in SeqIO.parse(gb_file, "genbank"):
# now do something with the record
for feat in gb_record.features:
if feat.type == "CDS":
product = feat.qualifiers['product'][0]
if product == 'Porphyromonas gingivalis major fimbrial subunit protein (FimA)' :
So I want to take the nucleotide sequence from any CDS (feature) with that product (qualifier) label and put them all in the same fasta file. Hopefully that makes sense! Any help would be greatly appreciated!!
python
gene
sequence