Search for Related Items in NCBI with Bio.Entrez.elink()

Q

How to Search for Related Items in NCBI with Bio.Entrez.elink() function?

✍: FYIcenter.com

A

Bio.Entrez.elink() function allows you to find related items in a NCBI database for a given record. It uses the Entrez Web services provided by www.ncbi.nlm.nih.gov.

Here is an example on how to find related items with the Bio.Entrez.efetch() function.

fyicenter$ python 
>>> from Bio import Entrez
>>> Entrez.email = "A.N.Other@example.com"

>>> handle = Entrez.elink(db="pubmed", id="19304878")
>>> record = Entrez.read(handle)

>>> len(record)
1

>>> record[0]["DbFrom"]
'pubmed'

>>> record[0]["IdList"]
['19304878']
 
>>> len(record[0]["LinkSetDb"])
8

>>> len(record[0]["LinkSetDb"])
8

>>> for linksetdb in record[0]["LinkSetDb"]:
...   print(linksetdb["DbTo"], linksetdb["LinkName"], len(linksetdb["Link"]))

pubmed pubmed_pubmed 195
pubmed pubmed_pubmed_alsoviewed 36
pubmed pubmed_pubmed_citedin 1640
pubmed pubmed_pubmed_combined 6
pubmed pubmed_pubmed_five 6
pubmed pubmed_pubmed_refs 17
pubmed pubmed_pubmed_reviews 17
pubmed pubmed_pubmed_reviews_five 9

Get a list of those 17 PubMed IDs referenced by the given article found in pubmed_pubmed_refs database.

>>> ids = record[0]["LinkSetDb"][5]["Link"]
>>> ids 
[{'Id': '21585727'}, {'Id': '18689808'}, {'Id': '17562476'}, {'Id': '17202161'}, 
 {'Id': '17148479'}, {'Id': '17142230'}, {'Id': '16381881'}, {'Id': '16377612'}, 
 {'Id': '15117750'}, {'Id': '14871861'}, {'Id': '14681378'}, {'Id': '14630660'}, 
 {'Id': '12368254'}, {'Id': '11975335'}, {'Id': '10827456'}, {'Id': '7984417'}, 
 {'Id': '3162770'}]

 

Global Query on All NCBI Databases with Bio.Entrez.egquery()

Fetch Sequences from NCBI with Bio.Entrez.efetch()

Biopython - Tools for Biological Computation

⇑⇑ OBF (Open Bioinformatics Foundation) Tools

2023-08-25, 293🔥, 0💬