Skip to main content

Python wrapper for pgenlib's basic reader and writer.

Project description

This provides a basic Python API for pgenlib; see python_api.txt for details.

Build instructions

PyPI: pip install Pgenlib

To build from GitHub instead, clone the repository:

# clone repo
git clone https://github.com/chrchang/plink-ng
# go to python folder
cd plink-ng/2.0/Python

Then install Cython and NumPy:

pip3 install "cython>=0.29.21" "numpy>=1.19.0"

and then build and install the package

python3 setup.py build_clib build_ext -i
python3 setup.py install

You can test the package with pytest.

Example usage:
#write a 2 sample file
import numpy as np
import pgenlib as pg

with pg.PgenWriter("test.pgen".encode("utf-8"), 2, variant_ct=3, nonref_flags=False) as writer:
	writer.append_alleles(np.array([0,1,1,1],dtype=np.int32))
	writer.append_alleles(np.array([0,1,0,0],dtype=np.int32))
	writer.append_alleles(np.array([0,0,0,0],dtype=np.int32))

See tests/test_pgenlib.py for more sophisticated examples.

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

Pgenlib-0.90.2.tar.gz (1.4 MB view hashes)

Uploaded Source

Built Distributions

Pgenlib-0.90.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (435.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (440.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (445.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

Pgenlib-0.90.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

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