4
$\begingroup$

I am using the biopython Entrez.efetch command to retrieve all features (CDS, mRNA, ...) of some genomes.

In this case (NC_014649, Acanthamoeba polyphaga mimivirus), it works as expected:

from Bio import Entrez, SeqIO
handle = Entrez.efetch(id='NC_014649', db='nuccore', rettype='gb')
records = SeqIO.read(handle, 'gb')
records.features

[SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(1181549), strand=1), type='source'),
 SeqFeature(FeatureLocation(ExactPosition(191), ExactPosition(2609), strand=1), type='gene'),
 SeqFeature(FeatureLocation(ExactPosition(191), ExactPosition(2609), strand=1), type='mRNA'),
 SeqFeature(FeatureLocation(ExactPosition(191), ExactPosition(2579), strand=1), type='CDS'),
...

However in this case (NC_010830, Candidatus Amoebophilus asiaticus), it only returns one record for the whole genome.

handle = Entrez.efetch(id='NC_010830', db='nuccore', rettype='gb')
records = SeqIO.read(handle, 'gb')
records.features
[SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(1884364), strand=1), type='source')]

However, if I check the corresponding file in the browser, it does have features: https://www.ncbi.nlm.nih.gov/nuccore/NC_010830.1

What could be the reason for this inconsistency ? Did I miss something ?

$\endgroup$
1
  • $\begingroup$ This happens and when I've encountered this I resolved it by digging the features out by a different method, @arijeman 'solution' if correct needs an explanation about why because it's funndamental. $\endgroup$
    – M__
    May 11, 2019 at 9:33

2 Answers 2

5
$\begingroup$

This has been answered before. See: https://stackoverflow.com/a/55402322/6262370

In short, you need to either use rettype='gbwithparts' or rettype='gb', style='withparts' to download the entire genbank flat file.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks, I also had to set retmode='full', otherwise SeqIO.read would result in "ValueError: No records found in handle" $\endgroup$
    – cmdoret
    May 15, 2019 at 13:37
0
$\begingroup$

I use the efetch bash command from edirect.

With efetch -db nuccore -id CP001102.1 -format gb, I get the Candidatus Amoebophilus asiaticus 5a2, complete genome in GenBank format.

You might try your command with CP001102.1 instead of NC_010830

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.