pafpy
A lightweight library for working with PAF (Pairwise mApping Format) files.
Documentation: https://pafpy.xyz
Table of Contents
Install
PyPi
pip install pafpy
Conda
conda install -c bioconda pafpy
Locally
If you would like to install locally, the recommended way is using poetry.
git clone https://github.com/mbhall88/pafpy.git
cd pafpy
make install
# to check the library is installed run
poetry run python -c "from pafpy import PafRecord;print(str(PafRecord()))"
# you should see a (unmapped) PAF record printed to the terminal
# you can also run the tests if you like
make test-code
Usage
For full usage, please refer to the documentation. If there is any functionality
you feel is missing or would make pafpy more user-friendly, please raise an issue
with a feature request.
In the below basic usage pattern, we collect the BLAST identity of all primary alignments in our PAF file into a list.
from typing import List
from pafpy import PafFile
path = "path/to/sample.paf"
identities: List[float] = []
with PafFile(path) as paf:
for record in paf:
if record.is_primary():
identity = record.blast_identity()
identities.append(identity)
Another use case might be that we want to get the identifiers of all records aligned to a specific contig, but only keep the alignments where more than 50% of the query (read) is aligned.
from typing import List
from pafpy import PafFile
path = "path/to/sample.paf"
contig = "chr1"
min_covg = 0.5
identifiers: List[str] = []
with PafFile(path) as paf:
for record in paf:
if record.tname == contig and record.query_coverage > min_covg:
identifiers.append(record.qname)
Contributing
If you would like to contribute to pafpy, checkout CONTRIBUTING.md.
Metadata
Release files for pafpy 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pafpy-0.2.0.tar.gz | 11.2 kB | Without provenance | Details for pafpy-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pafpy-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pafpy-0.2.0-py3-none-any.whl |
Total release size: 23.9 kB
Release files / pafpy-0.2.0.tar.gz
| Download URL | pafpy-0.2.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ecbbb6cf6b3f25e2a76d4dd02503f70bb5604523e11754646c6aace813daa74
|
|
BLAKE2b-256 checksum How to use checksums |
6df7e60d83b1ccd37118f78527f5992c269c16473a2b6fef7b556040e34d1ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Release files / pafpy-0.2.0-py3-none-any.whl
| Download URL | pafpy-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
103d723c5701cf0d2aafdcf357c1a7fd5c2b80b61727783d4bfb57b0807d93f6
|
|
BLAKE2b-256 checksum How to use checksums |
ca845110df7fd7b7895a1fe63798b41f3f44cf4066e05997eab574cfdf88116d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Security for pafpy 0.2.0
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.