[BioPython] BioEutils

Brad Chapman chapmanb at uga.edu
Tue Aug 3 18:26:28 EDT 2004


Hi Peter;

[Using EUtils]
> I dont seem to be getting any of the EUtils to work.
[...]
> NCBI changing things around so the EUtils packages breaks?

Yes, that looks to be the case. Thanks for providing the examples of
things that weren't working. I went through and updated EUtils with
some testing code, and think I have all your problems fixed. If you
could update EUtils from CVS and test that would be very helpful.
The major changes are in Bio/EUtils/ThinClient.py and
Bio/EUtils/parse.py.

> I would like to look up records for image clones like:
> 
> clone = client.search("IMAGE:624360",db="nucleotide")
> 
> This would be the way I look for a clone in the nucleotide set using the 
> search field on the root of the ncbi homepage.  I know that this clone is 
> in nucleotide, but this query does not work here, I get a result of length 
> = 0.

The problem here is that you can't use colons within queries,
because Entrez treats them as a range operation. There might be a
way to escape them, but I don't know of it. The easiest way, which
seems to work fine, is to leave out the colon in your search:

>>> from Bio.EUtils import HistoryClient
>>> client = HistoryClient.HistoryClient()
>>> clone = client.search("IMAGE 624360",db="nucleotide")
>>> len(clone)
2

> clone = client.search("AA759046",db="nucleotide")
> 
> however I get the following error
> 
> Traceback (most recent call last):
>     raise IndexError, "no item matches"
> IndexError: no item matches.

This search is fine, but this was an internal error which is now
fixed in the changes in CVS.

> >>> result = client.search("dalke", retmax = 100)
> 
> Traceback (most recent call last):
>     raise TypeError("Unknown OP code: %r" % (s,))
> TypeError: Unknown OP code: u'GROUP'

This was a change in what NCBI was returning. It should now handle
this just fine.

I also fixed a few other bugs I came across in the process. Sorry
about the problems. I appreciate you testing this, and hope the new
code works better for you.

Brad


More information about the BioPython mailing list