fastqp
Simple FASTQ, SAM and BAM read quality assessment and plotting using Python.
Features
- Requires only Python with Numpy, Scipy, and Matplotlib libraries
- Works with (gzipped) FASTQ, SAM, and BAM formatted reads
- Tabular, tidy, output statistics so you can create your own graphs
- A useful set of default graphics rivaling comparable QC packages
- Counts all IUPAC ambiguous nucleotide codes (NMWSKRYVHDB) if present in sequences
- Downsamples input files to around 2,000,000 reads (user adjustable)
- Allows a 5′ and 3′ (left and right) cycle limit for statistics and graphics
- Tracks kmers for the entire input file and reports over-represented kmers
- Optional sequence duplication rate over the entire input file (Bloom filters)
- Plots base call reference mismatches for aligned reads
- Optionally ignores reads flagged as vendor QC-fail in SAM/BAM input
Requirements
- Python 3.10 or newer
- numpy 1.23.5+, scipy 1.9.3+, matplotlib 3.5.3+, cycler, six, simplesam 0.1.4.2+
- BAM file support requires samtools
Installation
pip install [--user] fastqp
The optional sequence duplication calculation (-d/--count-duplicates) needs
the pybloom-live package:
pip install [--user] 'fastqp[duplicates]'
Usage
usage: fastqp [-h] [-q] [-a NAME] [-p BASE_PROBS] [-k {2,3,4,5,6,7}]
[-o OUTPUT] [-e TEXT] [-t {fastq,gz,sam,bam}] [-ll LEFTLIMIT]
[-rl RIGHTLIMIT] [-mq MEDIAN_QUAL] [-s BINSIZE | -n NREADS | -d]
[--aligned-only | --unaligned-only] [--ignore-qcfail]
input
simple NGS read quality assessment using Python
positional arguments:
input input file (one of .sam, .bam, .fq, or .fastq(.gz) or
stdin (-))
options:
-h, --help show this help message and exit
-q, --quiet do not print any messages (default: False)
-a NAME, --name NAME sample name identifier for text and graphics output
(default: input file name)
-p BASE_PROBS, --base-probs BASE_PROBS
probabilities for observing A,T,C,G,N in reads
(default: 0.25,0.25,0.25,0.25,0.1)
-k {2,3,4,5,6,7}, --kmer {2,3,4,5,6,7}
length of kmer for over-represented kmer counts
(default: 5)
-o OUTPUT, --output OUTPUT
base name for the output ZIP of figures (default:
fastqp_figures)
-e TEXT, --text TEXT file name for tidy text output, or - for stdout
(default: -)
-t {fastq,gz,sam,bam}, --type {fastq,gz,sam,bam}
file type (default: auto)
-ll LEFTLIMIT, --leftlimit LEFTLIMIT
leftmost cycle limit (default: 1)
-rl RIGHTLIMIT, --rightlimit RIGHTLIMIT
rightmost cycle limit (-1 for none) (default: -1)
-mq MEDIAN_QUAL, --median-qual MEDIAN_QUAL
median quality threshold for failing QC (default: 30)
-s BINSIZE, --binsize BINSIZE
number of reads to bin for sampling (default: auto)
-n NREADS, --nreads NREADS
number of reads sample from input (default: 2000000)
-d, --count-duplicates
calculate sequence duplication rate; disables sampling
and scans the whole file (default: False)
--aligned-only only aligned reads (default: False)
--unaligned-only only unaligned reads (default: False)
--ignore-qcfail skip reads flagged as vendor QC fail (SAM/BAM FLAG
0x200; no effect on FASTQ) (default: False)
Output
fastqp writes two kinds of output:
-
Figures: a ZIP archive named
<--output>.zip(defaultfastqp_figures.zip) containing PNG files such asquality_score_quantiles.png,quality_score_distribution.png,quality_score_heatmap.png,read_length_distribution.png,cycle_specific_gc.png,gc_distribution.png,cycle_specific_base_composition.png,cycle_specific_kmers.pngandcycle_specific_potiential_adapter_kmers.png. SAM/BAM input also producescycle_specific_base_mismatches.png. -
Tidy statistics: a headerless, tab-separated, four-column table written to
--text(default: standard output; use-e FILEfor a file):sample observation cycle value sample name reads,read_len,q05–q95,A/C/G/T/...,pos_gc,read_gc, kmer,duplicatecycle number or Nonenumeric value Rows from multiple runs can be concatenated (the sample name is the first column), which makes it easy to load them into R, Spotfire or similar tools:
stats <- read.delim("fastqp_stats.tsv", header = FALSE, col.names = c("sample", "observation", "cycle", "value"))
-d/--count-duplicates scans the entire input file (sampling is disabled) and
requires the duplicates extra described above. Note that the
--aligned-only, --unaligned-only and --ignore-qcfail filters only apply
to SAM/BAM input, which carries alignment and QC flags; they are ignored for
FASTQ. For SAM/BAM input, per-cycle base, quality and kmer statistics are
reported in the original read orientation (reverse-strand reads are
reverse-complemented), while the mismatch plot compares reads against the
reference orientation.
Changes
See releases page for details.
Examples
Acknowledgements
This project is freely licensed by the author, Matthew Shirley, and was completed under the mentorship financial support of Drs. Sarah Wheelan and Vasan Yegnasubramanian at the Sidney Kimmel Comprehensive Cancer Center in the Department of Oncology.
Metadata
Release files for fastqp 0.3.6
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 |
|---|---|---|---|---|
| fastqp-0.3.6.tar.gz | 38.4 kB | Without provenance | Details for fastqp-0.3.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastqp-0.3.6-py3-none-any.whl | Python 3 | none | any | Details for fastqp-0.3.6-py3-none-any.whl |
Total release size: 68.6 kB
Release files / fastqp-0.3.6.tar.gz
| Download URL | fastqp-0.3.6.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dee3c4c2f248b51a0b358157273395ff59c48270737a7fe4bca7334d4bb957e
|
|
BLAKE2b-256 checksum How to use checksums |
2e1d3af6c130ed27f71b21b0de225739620a35d349301153eaa10afc8319bd19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / fastqp-0.3.6-py3-none-any.whl
| Download URL | fastqp-0.3.6-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
beb20e5e8fc18f8960a73f8cbdb3c01426adb4952cfa7d119e9a6550aa969cbc
|
|
BLAKE2b-256 checksum How to use checksums |
bbd29e57cc9a95cf6e364ce7556e0f0be2d4475b3ef28083fb9f0da3cf1b2201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for fastqp 0.3.6
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.