Skip to main content

Converts genotype data stored in plink's PED+MAP format from one genome build to another, using liftOver

Project description

PLINKLiftOver

Build status Python Version Dependencies Status

Code style: black Security: bandit Semantic Versions License Alt

PLINKLiftOver is a utility enabling liftOver to work on genomics files from PLINK, allowing one to update the coordinates from one genome reference version to another.

Installation

PLINKLiftOver requires

  • Python 3.10
  • The command line version of liftOver, installed and on the system path
  • An appropriate chain file
  • The MAP file from a PLINK dataset

Install from pypi

pip install -U plinkliftover

or install the development version with

pip install -U git+https://github.com/milescsmith/plinkliftover.git

Usage

plinkliftover has three subcommands:

  • liftover: Fully convert the genomic coordinates from one version to another in a PLINK file
  • map2bed: Convert a PLINK MAP file to a BED file
  • bed2map: Convert a BED file to a MAP file

The latter two subcommands are most useful in situations where it is not possible to run the liftOver executable locally (i.e. you are on Windows) but can use UCSC's online version or you otherwise need/want a BED file.

liftover:

Usage: plinkliftover liftover [OPTIONS] MAPFILE CHAINFILE

  Converts genotype data stored in the PLINK PED+MAP format from one genome
  build to another, using liftOver.

Arguments:
  MAPFILE    The plink MAP file to `liftOver`.  [required]
  CHAINFILE  The location of the chain files to provide to `liftOver`.
             [required]

Options:
  --pedfile TEXT             Optionally remove "unlifted SNPs" from the plink
                             PED file after running `liftOver`.
  --datfile TEXT             Optionally remove 'unlifted SNPs' from a data
                             file containing a list of SNPs (e.g. for
                             --exclude or --include in `plink`)
  --prefix TEXT              The prefix to give to the output files.
  --liftoverexecutable TEXT  The location of the `liftOver` executable.
  -v, --version              Prints the version of the plinkliftover package.
  --help                     Show this message and exit.

For example

plinkliftover liftover updating.map hg19ToHg38.over.chain.gz --prefix updated

map2bed:

Usage: plinkliftover map2bed [OPTIONS] MAPFILE

  Convert genotype data stored in a PLINK MAP file into a BED file, allowing
  one to use the online version of liftOver should the local executable is
  unavailable

Arguments:
  MAPFILE  A PLINK MAP file.  [required]

Options:
  -o, --output PATH  Location to save BED file to.  If one is not provided,
                     then it will be saved to where the MAP file is.
  -v, --version      Prints the version of the plinkliftover package.
  --help             Show this message and exit.

bed2map:

Usage: plinkliftover bed2map [OPTIONS] BEDFILE

  Convert genotype data stored in a PLINK MAP file into a BED file, allowing
  one to use the online version of liftOver should the local executable is
  unavailable

Arguments:
  BEDFILE  A BED file.  [required]

Options:
  -o, --output PATH  Location to save MAP file to.  If one is not provided,
                     then it will be saved to where the BED file is.
  -v, --version      Prints the version of the plinkliftover package.
  --help             Show this message and exit.

Note!

By default, PLINK 2.0 does not use/create the required MAP file. It can be generated using PLINK 1.9 by

plink --bfile original --recode --out to_update

where original is the prefix for the bed/bim/fam files and to_update is the prefix to give the new files.

🛡 License

License

This project is licensed under the terms of the GNU GPL v3.0 license. See LICENSE for more details.

📃 Citation

@misc{plinkliftover,
  author = {Miles Smith <miles-smith@omrf.org>},
  title = {Awesome `plinkliftover` is a Python cli/package created with https://github.com/TezRomacH/python-package-template},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/milescsmith/plinkliftover}}
}

Credits

This project was generated with python-package-template.

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

plinkliftover-0.5.2.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

plinkliftover-0.5.2-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file plinkliftover-0.5.2.tar.gz.

File metadata

  • Download URL: plinkliftover-0.5.2.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for plinkliftover-0.5.2.tar.gz
Algorithm Hash digest
SHA256 1b426c8556d9ee2683ef022299ce846cf39209dd3d0514cac27f58d3f2c699cd
MD5 876f6c2b1e9b090e8e2911cb22e672aa
BLAKE2b-256 9c64bbf23726a362375c140fc1f36b53f332584ff32415008ed596a4df0d1fa3

See more details on using hashes here.

File details

Details for the file plinkliftover-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for plinkliftover-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9b145960347f0392d67a97710764b3dffbd7c93815590378fa43b6130e01c3d
MD5 30d6cc013486ca0e0b3fb986267ea790
BLAKE2b-256 4717857f5e2277ccd8f62cf8ec5e06d917494a51015c88128e65dfcded875865

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