[Biopython] search Entrez with boolean operators

Peter biopython at maubp.freeserve.co.uk
Tue Oct 20 10:53:59 UTC 2009


On Tue, Oct 20, 2009 at 11:44 AM, Thomas Evangelidis <tevang3 at gmail.com> wrote:
> Dear all,
>
> is it possible to set the term parameter in Bio.Entrez.esearch() accordingly
> so that it will search Entrez using boolean operators? I tried myself
> several combinations with no luck.

You can use AND in upper case, e.g.

abc[title] AND efflux[title] AND transporter[title]
abc[all] AND efflux[all] AND transporter[all]
abc AND efflux AND transporter

> For instance lets say I want to query All
> Fields of PubMed using this whole phrase (not intividual words): "ABC efflux
> transporter", how should I write it?

For phrases, you need quote characters - you can try this on the NCBI
Entrez webpage, e.g.

"ABC efflux transporter"
"ABC efflux transporter"[all]

Note that these give no hits!

Remember in Python there are at least two ways to build a string with
quotes in it,
for example single-quote double-quote text double-quote single-quote:

>>> search = '"ABC efflux transporter"'
>>> print search
"ABC efflux transporter"

Or, sticking with all double quotes you must escape some:

>>> search = "\"ABC efflux transporter\""
>>> print search
"ABC efflux transporter"

Peter



More information about the Biopython mailing list