Question: How to retrieve article ids list from pubmed
0
gravatar for aqsaawan.459
9 months ago by
aqsaawan.4590 wrote:

Hey, I'm doing a project which includes data mining but for that I want to build a crawler which extract pubmed articles ids using a single term like cancer or tumor? (semantics based ) I'm currently working in python. If someone is familiar with this issue kindly help me

pubmed python R pubmedlookup • 508 views
ADD COMMENTlink modified 9 months ago by Maria_Levchenko70 • written 9 months ago by aqsaawan.4590
1

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized.

New questions should be posted to a new thread.

ADD REPLYlink written 9 months ago by genomax59k

okay got it! thanks

ADD REPLYlink written 9 months ago by aqsaawan.4590

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted. Upvote|Bookmark|Accept

ADD REPLYlink written 9 months ago by WouterDeCoster35k

now I want to upload these ids to mysql database, But I do't know hoe to connect python to mysql?

ADD REPLYlink written 9 months ago by aqsaawan.4590
1

This tutorial will help, https://www.tutorialspoint.com/python/python_database_access.htm . Please mark the answer as accepted.

ADD REPLYlink written 9 months ago by arup720
1
gravatar for arup
9 months ago by
arup720
India
arup720 wrote:

Use Biopython.

An example, cancer as a search term.

from Bio import Entrez
Entrez.email = "yourmail@gmail.com"
handle = Entrez.esearch(db="pubmed", term="cancer", retmax="10", sort="relevance", retmode="xml")
records = Entrez.read(handle)
print(records["IdList"])
ADD COMMENTlink modified 9 months ago • written 9 months ago by arup720
1

I would like to suggest that you write Python3 in your examples (using print as a function) to make this code snippet valid on all python versions. Python2 will only be around for limited time, so better bite the bullet now and get used to Python3 syntax.

ADD REPLYlink written 9 months ago by WouterDeCoster35k

thanks for the suggestion.

ADD REPLYlink written 9 months ago by arup720

What if I want urls of a specific word instead of ids?

ADD REPLYlink written 9 months ago by aqsaawan.4590
1

Sorry, what do you mean by "urls of specific word"? If you are talking about article URLs, use https://www.ncbi.nlm.nih.gov/pubmed/ as base URL and add the fetched PMIDs after it.

ADD REPLYlink written 9 months ago by arup720
1
gravatar for Maria_Levchenko
9 months ago by
EMBL-EBI
Maria_Levchenko70 wrote:

You can also try out Annotations API from Europe PMC. It allows you to retrieve a list of PMIDs for artciles that contain text-mined terms. Diseases (including cancer or tumor) is one of the annotation types. So for retrieving article iDs for cancer you could use the following response URL: https://www.ebi.ac.uk/europepmc/annotations_api/annotationsByEntity?entity=cancer&filter=1&format=ID_LIST&pageSize=4

ADD COMMENTlink written 9 months ago by Maria_Levchenko70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 523 users visited in the last hour