Skip to main content

Pure-python implementation of UCSC ``liftOver`` genome coordinate conversion.

Project description

https://travis-ci.org/konstantint/pyliftover.png?branch=master:target:https://travis-ci.org/konstantint/pyliftover

PyLiftover is a library for quick and easy conversion of genomic (point) coordinates between different assemblies.

It uses the same logic and coordinate conversion mappings as the UCSC liftOver tool.

As of current version (0.2), PyLiftover only does conversion of point coordinates, that is, unlike liftOver, it does not convert ranges, nor does it provide any special facilities to work with BED files. For single-point coordinates it produces exactly the same output as liftOver (verified with at least the hg17ToHg18.over.chain.gz file for now).

Installation

The simplest way to install the package is via easy_install or pip:

$ easy_install pyliftover

Usage

The primary usage example, supported by the library is the following:

from pyliftover import LiftOver
lo = LiftOver('hg17', 'hg18')
lo.convert_coordinate('chr1', 1000000)

The first line will automatically download the hg17-to-hg18 coordinate conversion chain file from UCSC, unless it is already cached or available in the current directory. Alternatively, you may provide your own chain file:

lo = LiftOver('hg17ToHg18.over.chain.gz')
lo.convert_coordinate('chr1', 1000000, '-')

The result of lo.convert_coordinate call is either None (if the source chromosome name is unrecognized) or a list of target positions in the new assembly. The list may be empty (locus is deleted in the new assembly), have a single element (locus matched uniquely), or, in principle, have multiple elements (although this is probably a rare occasion for most default intra-species genomic conversions). Note that coordinates in the tool are 0-based. That is, a position that you would refer to in the genome browser by chr1:10 corresponds to coordinate 9 in PyLiftover’s terms.

Although you may try to apply the tool with arbitrary chain files, like the original liftOver tool, it makes most sense for conversion of coordinates between different assemblies of the same species.

See also

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

pyliftover-0.4.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

pyliftover-0.4.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file pyliftover-0.4.1.tar.gz.

File metadata

  • Download URL: pyliftover-0.4.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for pyliftover-0.4.1.tar.gz
Algorithm Hash digest
SHA256 33ad187e35d1b6662ba446432f4dd1a808ac2914ce1645eef37598fa5a3860cd
MD5 fa5336560439e158b237150cafce8a61
BLAKE2b-256 00e8f09804e990d66d235f4c90cb343bdc540ec17b67c925e72c67432a4d6130

See more details on using hashes here.

File details

Details for the file pyliftover-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: pyliftover-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for pyliftover-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49ef8938010d2e934abb483d3ef8073897ed6b88bcd978c486c8f7631c24dbc1
MD5 50b4e8a80b7d33c9280ee806941bde8c
BLAKE2b-256 b161e3afcf369fe45223cfebfbb8cde46d521e2786889c1b3eed01ee08adb626

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