This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biopython Entrez Esearch FILTER

Hi,

I want to make a seach using Biopython's Entrez API, i have the following code:

handle = Entrez.esearch(db='pubmed', 
                                sort='relevance', 
                                retmax='20',
                                retmode='xml',
                                term=name+" AND "+nombre)

That works fine, but if I try to add a filter, such as "has abstract"[FILT] like this:

term=name+" AND "+nombre+" AND has abstract"[FILT])

I get an error.

The syntax seems "fine" both pubmed's and python's. But maybe I'm awfully wrong, can you help? Thanks!!

Just in case (running python):

Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio import Entrez
>>> Entrez.email = 'myemail@bla.com'
>>> handle = Entrez.einfo(db="pubmed")
>>> record = Entrez.read(handle)
>>> record["DbInfo"].keys()
[u'Count', u'LastUpdate', u'MenuName', u'Description', u'LinkList', u'DbBuild', u'FieldList', u'DbName']
>>> for field in record["DbInfo"]["FieldList"]:
...     print("%(Name)s, %(FullName)s, %(Description)s" % field)
... 
ALL, All Fields, All terms from all searchable fields
UID, UID, Unique number assigned to publication
FILT, Filter, Limits the records
.
.
.

so FILT looks like the appropriate Key, right?

biopython esearch

1 answer

I get an error.

You should always show the errors you get. I guess you get an syntax error, because the quotation marks here are to early:

" AND has abstract"[FILT]

Try " AND has abstract[FILT]" instead.

fin swimmer

Log in to answer this question.