Entering edit mode
7.5 years ago
Jacob
▴
10
I'm able to get the genbank file from the website and print the features from the file, but I want to only print the features where type='exon'. Further, I want print just the Exactposition fields for those features where type='exon' heres what I am doing so far
>>> handle = Entrez.efetch(db="nucleotide", rettype="gb", retmode="text", id="NM_001135")
>>> seq_record = SeqIO.read(handle, "gb")
>>> seq_record.features
[SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(8543), strand=1), type='source'), SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(8543), strand=1), type='gene'), SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(367), strand=1), type='exon'), SeqFeature(FeatureLocation(ExactPosition(367), ExactPosition(444), strand=1), type='exon'),
...
...
And I would like the output to be
SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(367), strand=1), type='exon'), SeqFeature(FeatureLocation(ExactPosition(367), ExactPosition(444), strand=1), type='exon'),
Or more specifically, as a final result
0-367
367-444