fastx
Just a fasta/q parser based on kseq.h for CPython and PyPy.
Install with:
pip install fastx
Example use:
import fastx
for name, seq, qual for Fastx(filename):
print(">{}\n{}".format(name, seq))
This library was inspired by the benchmarking page below and that the existing fastest entry for python works only on CPython. It is not intended for general use.
https://github.com/lh3/biofast
Benchmarking
Line profiling the previous code we find program spent as much time adding python objects together as it does in the pyfastx package:
Line # Hits Time Per Hit % Time Line Contents
==============================================================
28 @profile
29 def main():
30 1 21.0 21.0 0.0 n, slen, qlen = 0, 0, 0
31 5682011 7366975.0 1.3 47.9 for name, seq, qual in pyfastx.Fastq(sys.argv[1], build_index=False):
32 5682010 2324629.0 0.4 15.1 n += 1
33 5682010 2783887.0 0.5 18.1 slen += len(seq)
34 5682010 2909447.0 0.5 18.9 qlen += qual and len(qual) or 0
35 1 158.0 158.0 0.0 print('{}\t{}\t{}'.format(n, slen, qlen))
This modules works both under CPython and PyPy, unlike pyfastx which is strictly a CPython extension. When using PyPy, the difference between the Python and C implementation is narrowed dramatically.
Running cpython
5682010 568201000 568201000
real 0m11.444s
user 0m10.944s
sys 0m0.284s
Running pypy
5682010 568201000 568201000
real 0m1.973s
user 0m1.555s
sys 0m0.258s
Running C
5682010 568201000 568201000
real 0m1.764s
user 0m1.508s
sys 0m0.217s
Metadata
Release files for fastx 0.0.3
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 | |
|---|---|---|---|---|
| fastx-0.0.3.tar.gz | 6.4 kB | Without provenance | Details |
Release files / fastx-0.0.3.tar.gz
| Download URL | fastx-0.0.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9437ea98ee23d667b7aea853967290dd91908876c10f838d81fdd281eab08027
|
|
BLAKE2b-256 checksum How to use checksums |
a1dc781603630a119de76926069b1259ada0fa7102370f1d1d5754ceeea888ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.5
|
Security for fastx 0.0.3
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.