Skip to content

koesterlab/pubgator

Repository files navigation

pubgator

PyPI - Version PyPI - Downloads GitHub Actions Workflow Status GitHub License

A lightweight python wrapper for the PubTator3 API. PubGator allows to easily interact with the PubTator API. It provides a simple interface to search for publications, retrieve full annotations, and find entities and relations. It also automatically handles pagination and rate limiting.

Usage

from pubgator import PubGator, ExportFormat, BioConcept

# Initialize the PubGator client
pg = PubGator()

# Search for publications containing the chemical remdesivir
publications = pg.search("@CHEMICAL_remdesivir", max_ret=100)
pmids = [publication.pmid for publication in publications]


# Retrieve full annotations for the set of publications and print their abstracts
annotations = pg.export_publications(pmids=pmids, format=ExportFormat.BIOC)
for annotation in annotations.documents:
    for passage in annotation.passages:
            if passage.infons.get("type") == "abstract":
                print(passage.text)

# Find entities
entities = pg.autocomplete("cancer", concept=BioConcept.DISEASE)

License

MIT License

Authors

About

Lightweight python wrapper for PubTator3 API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages