[BioPython] Problem using efetch

Julius Lucks lucks at fas.harvard.edu
Fri Feb 23 04:47:39 UTC 2007


Hey Alex,

I am not sure why there was an internal error, but if you want to  
return 2 sequences, then the following adjustment of your query will  
do the trick

from Bio.EUtils import HistoryClient
client = HistoryClient.HistoryClient()
print client.search('NP_542420 OR ATRTC',db='protein').efetch 
(retmode='text', rettype='fasta').read()


which gives

 >gi|18093102|ref|NP_542420.1| dynamin 1 [Rattus norvegicus]
MGNRGMEDLIPLVNRLQDAFSAIGQNADLDLPQIAVVGGQSAGKSSVLENFVGRDFLPRGSGIVTRRPLV
LQLVNSTTEYAEFLHCKGKKFTDFEEVRLEIEAETDRVTGTNKGISPVPINLRVYSPHVLNLTLVDLPGM
TKVPVGDQPPDIEFQIRDMLMQFVTKENCLILAVSPANSDLANSDALKIAKEVDPQGQRTIGVITKLDLM
DEGTDARDVLENKLLPLRRGYIGVVNRSQKDIDGKKDITAALAAERKFFLSHPSYRHLADRMGTPYLQKV
LNQQLTNHIRDTLPGLRNKLQSQLLSIEKEVDEYKNFRPDDPARKTKALLQMVQQFAVDFEKRIEGSGDQ
IDTYELSGGARINRIFHERFPFELVKMEFDEKELRREISYAIKNIHGIRTGLFTPDLAFEATVKKQVQKL
KEPSIKCVDMVVSELTSTIRKCSEKLQQYPRLREEMERIVTTHIREREGRTKEQVMLLIDIELAYMNTNH
EDFIGFANAQQRSNQMNKKKTSGNQDEILVIRKGWLTINNIGIMKGGSKEYWFVLTAENLSWYKDDEEKE
KKYMLSVDNLKLRDVEKGFMSSKHIFALFNTEQRNVYKDYRQLELACETQEEVDSWKASFLRAGVYPERV
GDKEKASETEENGSDSFMHSMDPQLERQVETIRNLVDSYMAIVNKTVRDLMPKTIMHLMINNTKEFIFSE
LLANLYSCGDQNTLMEESAEQAQRRDEMLRMYHALKEALSIIGDINTTTVSTPMPPPVDDSWLQVQSVPA
GRRSPTSSPTPQRRAPAVPPARPGSRGPAPGPPPAGSALGGAPPVPSRPGASPDPFGPPPQVPSRPNRAP
PGVPRITISDP

 >gi|71620|pir||ATRTC actin beta - rat
MDDDIAALVVDNGSAMCKAGFAGDDAPRAVFPSIVGRPRHQGVMVGMGQKDSYVGDEAQSKRGILTLKYP
IEHGIVTNWDDMEKIWHHTFYNELRVAPEEHPVLLTEAPLNPKANREKMTQIMFETFNTPAMYVAIQAVL
SLYASGRTTGIVMDSGDGVTHTVPIYEGYALPHAILRLDLAGRDLTDYLMKILTERGYSFTTTAEREIVR
DIKEKLCYVALDFEQEMATAASSSSLEKSYELPDGQVITIGNERFRCPEALFQPSFLGMESCGIHETTFN
SIMKCDVDIRKDLYANTVLSGGTTMYPGIADRMQKEITALAPSTMKIKIIAPPERKYSVWIGGSILASLS
TFQQMWISKQEYDESGPSIVHRKCF


The 'OR' should give 2 results in the search, which efetch should  
handle in return.  I am not sure why the code gave the InternalError  
though, maybe someone else can pinpoint that.

In general, the NCBI interface for efetch will make use of whatever  
results were returned by a previous search when using the NCBI  
history server (which the HistoryClient does for you).  So getting  
the right list of results might come down to constructing the  
appropriate NCBI query.

Cheers,

Julius

-----------------------------------------------------
http://openwetware.org/wiki/User:Lucks
-----------------------------------------------------



On Feb 22, 2007, at 6:41 PM, Julius Lucks wrote:

> Hi Alex,
>
> I am not sure if anyone has addressed your issue.  Which module are
> you using (i.e. where did you import 'client' from)?
>
> Julius
>
> -----------------------------------------------------
> http://openwetware.org/wiki/User:Lucks
> -----------------------------------------------------
>
>
>
> On Feb 21, 2007, at 1:31 PM, Alex Coventry wrote:
>
>>
>> Hi.  The following query results in an error message from NCBI:
>>
>>>>> print client.search('''
>> NP_542420
>> ATRTC
>> ''', db='protein').efetch(retmode='text', rettype='fasta').read()
>> ... ... ... ...
>> Error: Internal Error
>>
>> I expected this query to return two sequences in fasta format.  The
>> same
>> query seems to work without problems at
>> <http://www.ncbi.nlm.nih.gov/entrez/batchentrez.cgi>.
>>
>> Searching for either query separately also seems to work.  E.g.:
>>
>>>>> print client.search('''
>> ATRTC
>> ''', db='protein').efetch(retmode='text',
>> rettype='fasta').read()
>> ... ... ... >gi|71620|pir||ATRTC actin beta - rat
>> MDDDIAALVVDNGSAMCKAGFAGDDAPRAVFPSIVGRPRHQGVMVGMGQKDSYVGDEAQSKRGILTLKY 
>> P
>> IEHGIVTNWDDMEKIWHHTFYNELRVAPEEHPVLLTEAPLNPKANREKMTQIMFETFNTPAMYVAIQAV 
>> L
>> SLYASGRTTGIVMDSGDGVTHTVPIYEGYALPHAILRLDLAGRDLTDYLMKILTERGYSFTTTAEREIV 
>> R
>> DIKEKLCYVALDFEQEMATAASSSSLEKSYELPDGQVITIGNERFRCPEALFQPSFLGMESCGIHETTF 
>> N
>> SIMKCDVDIRKDLYANTVLSGGTTMYPGIADRMQKEITALAPSTMKIKIIAPPERKYSVWIGGSILASL 
>> S
>> TFQQMWISKQEYDESGPSIVHRKCF
>>
>> Am I doing something wrong, here?
>>
>> Alex
>> _______________________________________________
>> BioPython mailing list  -  BioPython at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biopython
>
> _______________________________________________
> BioPython mailing list  -  BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython




More information about the Biopython mailing list