heyfastq
FASTQ sequence file utilities, written in pure Python, with no dependencies.
Summary
The package comes with one program, heyfastq, which provides
utilities for single or paired FASTQ files.
Installation
Install from PyPi with:
pip install heyfastq
Or get the dev version from GitHub:
git clone https://github.com/kylebittinger/heyfastq.git
pip install .
Usage
Run heyfastq -h to learn more about usage options.
Dev
Heyfastq is built around the idea of piping reads (or read pairs) through filter and map functions. The fundamental unit that moves through heyfastq pipelines is the R object, which can be either a Read or a ReadPair. These generic Rs move through functions that take in ReadPipes and output ReadPipes, allowing for easy composition of pipelines.
from heyfastqlib.read import Read, ReadPair, R, ReadPipe
from heyfastqlib.pipelines import filter_reads, map_reads
def unit_filter(r: R) -> bool:
return True
def unit_map(r: R) -> R:
return r
input_fastq = (r for r in [Read("1", "ACTG", "HHHH"), Read("2", "GTCA", "HHHH"), Read("3", "AAAA", "####")])
filter_counter = {"input_reads": 0, "input_bases": 0, "output_reads": 0, "output_bases": 0}
map_counter = {"input_reads": 0, "input_bases": 0, "output_reads": 0, "output_bases": 0}
output_fastq = map_reads(filter_reads(input_fastq, unit_filter, filter_counter), unit_map, map_counter)
This is all well and good, but how do we actually deal with fastq files, not just objects already in python?
from heyfastqlib.io import parse_fastq, write_fastq
with open("r1.fq") as f_in, open("o1.fq", "w") as f_out:
write_fastq(f_out, parse_fastq(f_in))
with open("r1.fq") as f1_in, open("r2.fq") as f2_in, open("o1.fq", "w") as f1_out, open("o2.fq", "w") as f2_out:
write_fastq((f1_out, f2_out), parse_fastq((f1_in, f2_in)))
Putting it all together, assuming we've imported/created the objects from above, let's read our fastqs then apply our filter then our map and finally write them to fastqs again:
with open("r1.fq") as f1_in, open("r2.fq") as f2_in, open("o1.fq", "w") as f1_out, open("o2.fq", "w") as f2_out:
write_fastq((f1_out, f2_out), map_reads(filter_reads(parse_fastq((f1_in, f2_in)), unit_filter, filter_counter), unit_map, map_counter))
Metadata
Release files for heyfastq 0.2.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 | |
|---|---|---|---|
| heyfastq-0.2.3.tar.gz | 20.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| heyfastq-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.5 kB
Release files / heyfastq-0.2.3.tar.gz
| Download URL | heyfastq-0.2.3.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d52a1633a074164fd62a56f139534ea92201042525dfa73f86fe7a84aa26647
|
|
BLAKE2b-256 checksum How to use checksums |
16aadcafe70acdee34b1b72c9a1985671023d301021429a4e35ba48511fcf235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency logRelease files / heyfastq-0.2.3-py3-none-any.whl
| Download URL | heyfastq-0.2.3-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4b0819ec591e8788e78ed287b59ca4edcb013dd3d18e3acc22275e1daf2fcd3
|
|
BLAKE2b-256 checksum How to use checksums |
4a3ba632895779b796bca337f8add7ed691c1ce51ce7184218e1f294fb23b909
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency log