https://github.com/jeremymcrae/liftover
liftover for python, made fast with cython
https://github.com/jeremymcrae/liftover
cython liftover python
Last synced: 3 months ago
JSON representation
liftover for python, made fast with cython
- Host: GitHub
- URL: https://github.com/jeremymcrae/liftover
- Owner: jeremymcrae
- License: mit
- Created: 2019-02-15T18:41:18.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2026-04-18T01:37:20.000Z (3 months ago)
- Last Synced: 2026-04-18T03:04:48.101Z (3 months ago)
- Topics: cython, liftover, python
- Language: Python
- Homepage:
- Size: 1.37 MB
- Stars: 98
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

### python liftover utility
Converts point coordinates between genome assemblies.
Inspired by [pyliftover](https://github.com/konstantint/pyliftover), this
offers a few advantages:
- ~5X faster, and lower memory requirements, as loading the chain file and
converting coordinates is implemented in c++.
- dictionary style conversion, as in access converted coordinates via
`converter[chrom][pos]`
### Installation
Install via pip: `pip install liftover`
### Usage
```python
from liftover import get_lifter
converter = get_lifter('hg19', 'hg38', one_based=True)
chrom = '1'
pos = 103786442
converter[chrom][pos]
# other synonyms for the lift call
converter.convert_coordinate(chrom, pos)
converter.query(chrom, pos)
# alternatively create a converter directly from a chainfile
from liftover import ChainFile
converter = ChainFile('/home/user/hg18ToHg38.over.chain.gz', one_based=True)
converter[chrom][pos]
# you can also specify an alternative website to load chain files from
converter = get_lifter('hg19', 'hg38', chain_server='https://www.example.com')
# this also matches the core pyliftover interface
from liftover import LiftOver # synonym for `get_lifter`
lifter = LiftOver('hg19', 'hg38') # or LiftOver(PATH_TO_CHAIN), but not LiftOver(filehandle)
lifter.convert_coordinate(chrom, pos)
```