Thank you very much for your help Istvan! First option worked fine for me.
I would like to print and write (in fasta) the strain /isolate/voucher number of multiple DNA sequences parsed in biopython (and also organism name and sequence). However, although this information (strain/isolate/voucher) is within feature-qualifiers (genbank format), this information is not extracted with atributes annotation and features of a seqrecord object.
Does anyone know how can I do this?
I'm a newbie with python, so any tip would be very helpful.
Thanks
below there is part of a gb file as an example.
[...]
FEATURES Location/Qualifiers
source 1..841
/organism="Amauroderma calcitum"
/mol_type="genomic DNA"
/**isolate**="FLOR50931"
/db_xref="taxon:1774182"
/country="Brazil"
/collection_date="07-Jan-2013"
/collected_by="D.H. Costa-Rezende"
rRNA <1..>841
/product="large subunit ribosomal RNA"
[...]
1 answer
The isolate is a qualifier of the source feature that you can access like so:
from Bio import SeqIO
from pprint import pprint
# Read genbank file
for rec in SeqIO.parse("genome.gb", "genbank"):
source = rec.features[0]
pprint(source.qualifiers)
will print:
OrderedDict([('organism', ['Amauroderma calcitum']),
('mol_type', ['genomic DNA']),
('isolate', ['FLOR 50931']),
('db_xref', ['taxon:1774182']),
('country', ['Brazil']),
('collection_date', ['07-Jan-2013']),
('collected_by', ['D.H. Costa-Rezende'])])
alternatively, IMHO, the simplest way to get this info is with bio
bio fetch KU315207 | bio json > data.json
now you have a json file that can be immediately materialized in your program, no GenBank parsing needed anymore
Log in to answer this question.
Please provide your current code used for parsing.
Hi Sej Thanks for your reply. The code is below: