Skip to main content

Grounding for biomedical entities with contextual disambiguation

Project description

Gilda: Grounding Integrating Learned Disambiguation

License Build Documentation PyPI version DOI

Gilda is a Python package and REST service that grounds (i.e., finds appropriate identifiers in namespaces for) named entities in biomedical text.

Gyori BM, Hoyt CT, Steppi A (2022). Gilda: biomedical entity text normalization with machine-learned disambiguation as a service. Bioinformatics Advances, 2022; vbac034 https://doi.org/10.1093/bioadv/vbac034.

Installation

Gilda is deployed as a web service at http://grounding.indra.bio/ (see Usage instructions below), however, it can also be used locally as a Python package.

The recommended method to install Gilda is through PyPI as

pip install gilda

Note that Gilda uses a single large resource file for grounding, which is automatically downloaded into the ~/.data/gilda/<version> folder during runtime (see pystow for options to configure the location of this folder).

Given some additional dependencies, the grounding resource file can also be regenerated locally by running python -m gilda.generate_terms.

Documentation and notebooks

Documentation for Gilda is available here. We also provide several interactive Jupyter notebooks to help use and customize Gilda:

  • This notebook provides an interactive tutorial for using Gilda.
  • This notebook shows several examples of how Gilda can be instantiated with custom grounding resources.
  • This notebook provides interactive sample code for training new disambiguation models.

Usage

Gilda can either be used as a REST web service or used programmatically via its Python API. An introduction Jupyter notebook for using Gilda is available at https://github.com/indralab/gilda/blob/master/notebooks/gilda_introduction.ipynb

Use as a Python package

For using Gilda as a Python package, the documentation at http://gilda.readthedocs.org provides detailed descriptions of each module of Gilda and their usage. A basic usage example is as follows

import gilda
scored_matches = gilda.ground('ER', context='Calcium is released from the ER.')

Use as a web service

The REST service accepts POST requests with a JSON header on the /ground endpoint. There is a public REST service running at http://grounding.indra.bio but the service can also be run locally as

python -m gilda.app

which, by default, launches the server at localhost:8001 (for local usage replace the URL in the examples below with this address).

Below is an example request using curl:

curl -X POST -H "Content-Type: application/json" -d '{"text": "kras"}' http://grounding.indra.bio/ground

The same request using Python's request package would be as follows:

import requests
requests.post('http://grounding.indra.bio/ground', json={'text': 'kras'})

Resource usage

Gilda loads grounding terms into memory when first used. If memory usage is an issue, the following options are recommended.

  1. Run a single instance of Gilda as a local web service that one or more other processes send requests to.

  2. Create a custom Grounder instance that only loads a subset of terms approrpiate for a narrow use case.

  3. Gilda also offers an optional sqlite back-end which significantly decreases memory usage and results in minor drop in the number of strings grounder per unit time. The sqlite back-end database can be built as follows with an optional [db_path] argument, which if used, should use the .db extension. If not specified, the .db file is generated in Gilda's default resource folder.

python -m gilda.resources.sqlite_adapter [db_path]

A Grounder instance can then be instantiated as follows:

from gilda.grounder import Grounder
gr = Grounder(db_path)
matches = gr.ground('kras')

Run web service with Docker

After cloning the repository locally, you can build and run a Docker image of Gilda using the following commands:

$ docker build -t gilda:latest .
$ docker run -d -p 8001:8001 gilda:latest

Alternatively, you can use docker-compose to do both the initial build and run the container based on the docker-compose.yml configuration:

$ docker-compose up

Citation

@article{gyori2022gilda,
    author = {Gyori, Benjamin M and Hoyt, Charles Tapley and Steppi, Albert},
    title = "{{Gilda: biomedical entity text normalization with machine-learned disambiguation as a service}}",
    journal = {Bioinformatics Advances},
    year = {2022},
    month = {05},
    issn = {2635-0041},
    doi = {10.1093/bioadv/vbac034},
    url = {https://doi.org/10.1093/bioadv/vbac034},
    note = {vbac034}
}

Funding

The development of Gilda was funded under the DARPA Communicating with Computers program (ARO grant W911NF-15-1-0544) and the DARPA Young Faculty Award (ARO grant W911NF-20-1-0255).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gilda-0.10.1.tar.gz (166.9 kB view details)

Uploaded Source

Built Distribution

gilda-0.10.1-py3-none-any.whl (166.5 kB view details)

Uploaded Python 3

File details

Details for the file gilda-0.10.1.tar.gz.

File metadata

  • Download URL: gilda-0.10.1.tar.gz
  • Upload date:
  • Size: 166.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.9

File hashes

Hashes for gilda-0.10.1.tar.gz
Algorithm Hash digest
SHA256 b35e76e0f1fb574dd988e95b142beb7159902a58c9a906ba58aa0ff496752051
MD5 6134144243f95b12ee3d060c737feece
BLAKE2b-256 9165acb00c2d36c6a9ed03b5b3bcd9729e260b4c86d89f3d2179df91ed7fd6db

See more details on using hashes here.

File details

Details for the file gilda-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: gilda-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 166.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.9

File hashes

Hashes for gilda-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c56aa859b90cb8e088325c74f8d95ffe250303e4ff3377d3b5eaca0b3f1f2f4
MD5 fd8dbad38f3b524c5104b3a266b2bdc4
BLAKE2b-256 a0ef292f5f2aa0aaadc0ab6609a006df3861d9d77f0865845916cde1cdea205f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page