Skip to main content

Pure-python implementation of UCSC liftOver genome coordinate conversion

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

Metadata

Release files for pyliftover 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyliftover 0.4.1
File Size Uploaded Provenance
pyliftover-0.4.1.tar.gz 11.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyliftover 0.4.1
File Interpreter ABI Platform
pyliftover-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.3 kB

Release files / pyliftover-0.4.1.tar.gz

Download URL pyliftover-0.4.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
33ad187e35d1b6662ba446432f4dd1a808ac2914ce1645eef37598fa5a3860cd
BLAKE2b-256 checksum
How to use checksums
00e8f09804e990d66d235f4c90cb343bdc540ec17b67c925e72c67432a4d6130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release files / pyliftover-0.4.1-py3-none-any.whl

Download URL pyliftover-0.4.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49ef8938010d2e934abb483d3ef8073897ed6b88bcd978c486c8f7631c24dbc1
BLAKE2b-256 checksum
How to use checksums
b161e3afcf369fe45223cfebfbb8cde46d521e2786889c1b3eed01ee08adb626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Security for pyliftover 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page