Skip to content

Commit

Permalink
Merge pull request #10 from krassowski/doi
Browse files Browse the repository at this point in the history
Add example for converting DOI to PMID
  • Loading branch information
krassowski authored Dec 15, 2022
2 parents 89e2759 + cf7fe7d commit 2bfdcbd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,31 @@ The base position should use the latest genome assembly (GRCh38 at the time of w
you can use the position in previous assembly coordinates by replacing `POSITION` with `POSITION_GRCH37`.
For more information of the arguments accepted by the SNP database see the [entrez help page](https://www.ncbi.nlm.nih.gov/snp/docs/entrez_help/) on NCBI website.

### Example: find PubMed ID from DOI

When searching GWAS catalog PMID is needed over DOI. You can covert one to the other using:

```python
def doi_term(doi: str) -> str:
"""Prepare DOI for PubMed search"""
doi = (
doi
.replace('http://', 'https://')
.replace('https://doi.org/', '')
)
return f'"{doi}"[Publisher ID]'


result = entrez_api.search(
doi_term('https://doi.org/10.3389/fcell.2021.626821'),
database='pubmed',
max_results=1
)
result.data['esearchresult']['idlist']
```

> `['33834021']`
### Installation

Requires Python 3.6+. Install with:
Expand Down

0 comments on commit 2bfdcbd

Please sign in to comment.