2

簡単な質問 - 初めて biopython を使用し、チュートリアルに基づいて本当に簡単に何かを陪審員にしようとしています。

特定の記事のメッシュ用語を返すことができないようですEntrez.efetch()。唯一の方法は、私が行っていることのようです。

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

ここで、pmids は公開 IDのリストです

これは次を返します: http://pastie.org/5459700

http://www.ncbi.nlm.nih.gov/books/NBK25499/に従って rettype および retmode パラメータを微調整しようとしましたが、うまくいきませんでした。私が見逃している明らかなものはありますか?

4

2 に答える 2

6

これは私のために働く:

from Bio import Entrez # install with 'pip install biopython'
from Bio.Entrez import efetch, read
Entrez.email = "your@email.com" # register your email

def get_mesh(pmid):
    # call PubMed API
    handle = efetch(db='pubmed', id=str(pmid), retmode='xml')
    xml_data = read(handle)[0]
    # skip articles without MeSH terms
    if u'MeshHeadingList' in xml_data['MedlineCitation']:
        for mesh in xml_data['MedlineCitation'][u'MeshHeadingList']:
            # grab the qualifier major/minor flag, if any
            major = 'N'
            qualifiers = mesh[u'QualifierName']
            if len(qualifiers) > 0:
                major = str(qualifiers[0].attributes.items()[0][1])
            # grab descriptor name
            descr = mesh[u'DescriptorName']
            name = descr.title()

            yield(name, major)

# example output
for name, major in get_mesh(128):
    print '{}, {}'.format(name, major)
于 2014-02-27T09:28:14.773 に答える
2

この質問は、Biopython メーリング リストまたはhttp://www.biostars.org/で行うのが最適です。そこでは、Entrez の経験を持つ人を見つける可能性がはるかに高くなります。

問題は、PMID 23165874のレコードにMeSH タームがないことです。そのレコードの生の XML を、MeSH 用語を含むものと比較します。後者には次のセクションがあります。

<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>
  ..

つまり、ないものを手に入れるのは難しい。

于 2012-11-30T21:50:00.047 に答える