Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A library for finding the nearest gene to a genomic location

Project description

Gene Locator

This library allows the user to annotate a list of genetic variants given chromosome/position as coordinates.

Usage

This library can be used via command line script, or called from within Python. Currently only Python versions >=3.5 are supported.

$ pip3 install genelocator
$ gene-locator GRCh37 chr19 234523 --coding-only --version gencode32
# => 19	281040	291403	ENSG00000141934.10_5	PLPP2
from genelocator import get_genelocator
# By default, it will only perform the lookup if cached data is available.
#  A new lookup can be automatically generated for a different build/ gene list, by specifying auto_fetch=True
gl = get_genelocator('GRCh38', gencode_version=31, coding_only=True, auto_fetch=True)
gene = gl.at('chr19', 101000)
# => [{'chrom': '19', 'start': 107104, 'end': 117102, 'ensg': 'ENSG00000176695.8', 'symbol': 'OR4F17'}]

The python package comes bundled with data from GENCODE version 32, for builds GRCh37 and GRCh38.

Rules

It works as follows:

  1. If a SNP falls within at least one gene, return a list of gene information for each gene 1a. If a SNP falls within multiple genes, return a list of information about all overlapping genes.
  2. If a SNP does not fall within any genes, return information for the gene whose start or end is closest to the specified coordinates.
  3. If the requested chromosome has no data, throw an error.

Development

To install dependencies and run in development mode:

pip install -e .

Linting rules: flake8

Unit tests: pytest tests/

Project details


Download files

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

Files for GeneLocator, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size GeneLocator-1.1.2-py2.py3-none-any.whl (5.9 MB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size GeneLocator-1.1.2.tar.gz (5.9 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page