Search code examples
pythonbiopythonpubmed

can't get entrez to return mesh terms using biopython


quick question -- first time using biopython and I'm just trying to jury-rig something real quick based on tutorials.

I can't seem to get Entrez.efetch() to return mesh terms for a given article, and the only method appears to be what I'm doing, namely:

handle = Entrez.efetch(db="pubmed", id=pmids, rettype="medline", retmode="xml")
records = Entrez.read(handle)

where pmids is a list of pubmed IDs

this returns the following: http://pastie.org/5459700

I've tried tweaking the rettype and retmode parameters per http://www.ncbi.nlm.nih.gov/books/NBK25499/ with no luck. anything obvious I'm missing?


Solution

  • This question is best asked on the Biopython mailing list or perhaps the http://www.biostars.org/ . It's much more likely there to find people with Entrez experience.

    The problem is that the record with PMID 23165874 doesn't have any MeSH terms. Compare the raw XML of that record to one which has MeSH terms. The latter has a section starting:

    <MeshHeadingList>
      <MeshHeading>
        <DescriptorName MajorTopicYN="N">ADP Ribose Transferases</DescriptorName>
        <QualifierName MajorTopicYN="Y">genetics</QualifierName>
      </MeshHeading>
      <MeshHeading>
        <DescriptorName MajorTopicYN="N">Acinetobacter</DescriptorName>
        <QualifierName MajorTopicYN="Y">drug effects</QualifierName>
        <QualifierName MajorTopicYN="Y">genetics</QualifierName>
      </MeshHeading>
      ..
    

    In other words, it's hard to get something which doesn't exist.