[Biopython] [PubMed] How to view PMID-list on the website?

MX m464983 at gmail.com
Tue Dec 8 04:01:36 UTC 2015


I had the similar need a few years ago and here is what I did:

1. test query usign NCBI PubMED site and my query looks like
query = Entrez.esearch(db="pubmed", term='(publisher[sb] AND ("%s"[Date -
Publication]:"%s"[Date - Publication])' % (last_update, current),
usehistory="y")

2. Process query results to get following parameters for retrieving xml
records
    records=Entrez.read(query)
    query.close()
    count = int(records["Count"])
    webenv = records["WebEnv"]
    querykey = records["QueryKey"]

3. Retrieve the abstracts in xml format
    #To control the size of file using 10000 as limit
    batch_size = 10000

    if batch_size>=count:
        ofp=gzip.open("aName.xml.gz" % , 'w')
        fetch_handle = Entrez.efetch(db="pubmed",  rettype="MEDLINE",
retmode="xml",  retstart=0, retmax=batch_size, webenv=webenv,
query_key=querykey)
        data = fetch_handle.read()
        fetch_handle.close()
        ofp.write(data)
        ofp.close()
    else:
        num=count/batch_size+1
        for i in range(num):
            ofp=gzip.open("PubMed_%s.xml.gz" % i, 'w')
            start = i*batch_size
            end = min(count, start+batch_size)
            print "Going to download record %i to %i" % (start+1, end)
            fetch_handle = Entrez.efetch(db="pubmed",  rettype="MEDLINE",
retmode="xml", retstart=start, retmax=batch_size, webenv=webenv,
query_key=querykey)
            data = fetch_handle.read()
            fetch_handle.close()
            ofp.write(data)
            ofp.close()

Hope it has some useful information.
Ming

On Thu, Dec 3, 2015 at 6:38 AM, <c.buhtz at posteo.jp> wrote:

> A little bit off-topic.
>
> I did some search/fetch/analyse with Entrez and and the end I have a
> list of PubMed-IDs (e.g. in a text-file, on id per line) - nearly 1000.
>
> How can I view/display that list on the Pubmed-Website? I mean I want
> to search for all PMIDs on the Website and show the result.
> --
> GnuPGP-Key ID 0751A8EC
> _______________________________________________
> Biopython mailing list  -  Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20151207/75440b52/attachment.html>


More information about the Biopython mailing list