Count how many sequencing reads (fastq) or contigs (fasta) contain each sequence of a reference file, with Seal from BBTools. Point it at a reference fasta file and a sample, or a folder of samples, and it writes one table of counts per reference sequence and per sample.
Any set of short sequences works: spoligotype spacers, marker or resistance genes, primer or probe sequences, plasmid or phage fragments, barcodes, spike-ins. seqcounter does not interpret them; it counts them, reproducibly and in the same way for reads and for assemblies.
$ seqcounter -ref refs.fasta -i samples/ -o results/
Reference assembly no_match paired single_end
absent 0 0 0 0
present 1 0 86 34
twice 1 0 154 65
Features
- Reads or assemblies: single-end or paired-end fastq, or fasta, gzipped or not. Both mates of a pair are counted, once each.
- Batch mode: point it at a folder; fastq and fasta files are found recursively and R1/R2 files paired automatically. Several samples can be counted at the same time.
- Both strands, and mismatches: a reference is found on either strand, and with up to
-mmismatches per k-mer (one by default). - Three reports: the counts table (
refseqcounts.tsv, the table the first version of seqcounter wrote, with the command that produced it on its first line), a per-sample summary of how much was read and how much matched, and a JSON report with the parameters, the software versions and the counts. - Nothing is hidden: references Seal cannot find (shorter than the k-mer size), names that would collide, and samples that failed are reported, not silently dropped. A failed sample leaves the others readable.
- Nothing to configure: no database, no index, no reference genome. Only the Python standard library, plus BBTools.
- Tested: 105 tests, 100% coverage, end to end on synthetic references, genomes and reads with known counts.
Installation
conda create -n seqcounter -c conda-forge -c bioconda bbmap python">=3.10"
conda activate seqcounter
pip install seqcounter
BBTools (which provides seal.sh) is not on PyPI, so it comes from bioconda; seqcounter itself needs nothing else.
See Installation for other options, including running
it from a clone with python seqcounter.py, as the first version did.
Quick start
seqcounter -ref refs.fasta -r1 sample_R1.fastq.gz -r2 sample_R2.fastq.gz -o results/ # Paired-end reads
seqcounter -ref refs.fasta -r1 sample.fastq.gz -o results/ # Single-end reads
seqcounter -ref refs.fasta -r1 assembly.fasta -o results/ # An assembly
seqcounter -ref refs.fasta -i samples/ -o results/ -p 4 # A folder, 4 at a time
-ref is a fasta file of the sequences to count: each one gives a row, named after the first word of its > line.
The counts are printed and saved in results/. To see it work on data with known counts, run
bash examples/run_example.sh, which generates its own references and samples.
What a count is: the number of reads, or contigs, that contain the reference sequence, not the number of copies it has in them. A reference present twice in a single-contig assembly is counted once; in reads, about twice as many reads match it. See How it works.
Documentation
The wiki covers installation, usage and options, output files, how it works, troubleshooting and the FAQ.
Citing
If you use seqcounter, please cite it and BBTools, which does the counting:
Duceppe M-O. seqcounter: count the occurrences of reference sequences in sequencing reads or genome assemblies. https://github.com/duceppemo/seqcounter
Bushnell B. BBTools. https://sourceforge.net/projects/bbmap/
GitHub's "Cite this repository" button gives the citation in APA and BibTeX formats, from
CITATION.cff.
Related
- spoligotyper — in silico spoligotyping of the M. tuberculosis complex. It counts the 43 spacers the way seqcounter counts any reference, and then reads them as a spoligotype, with the species, the lineage and a PDF report.
- brucetyper — in silico Bruce-ladder, Suis-ladder, AMOS and RB51 junction PCR for Brucella, from assemblies.
Contributing
Bug reports, questions and pull requests are welcome: see CONTRIBUTING.md.
Author
Marc-Olivier Duceppe, Canadian Food Inspection Agency (CFIA): marc-olivier.duceppe@inspection.gc.ca
License
Metadata
Release files for seqcounter 1.0.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 |
|---|---|---|---|---|
| seqcounter-1.0.0.tar.gz | 31.5 kB | With provenance | Details for seqcounter-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seqcounter-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for seqcounter-1.0.0-py3-none-any.whl |
Total release size: 51.8 kB
Release files / seqcounter-1.0.0.tar.gz
| Download URL | seqcounter-1.0.0.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0ec4289840c44046b38dcc38b494103ec1a0e82a2386a8014c3050c4addf7a9
|
|
BLAKE2b-256 checksum How to use checksums |
6bb134d20e8e740470987646b03d92390ea5093d2dceb03a9c6065b6c5fa95b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logRelease files / seqcounter-1.0.0-py3-none-any.whl
| Download URL | seqcounter-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af94a77b8479a60c88080ffccdebce67b147d247a0259823ce3e48a9fa5ced20
|
|
BLAKE2b-256 checksum How to use checksums |
2f7ed7335cccb093eb32647096a3322b2ffe49366fadbf865faac666de6d7e48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logSecurity for seqcounter 1.0.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for seqcounter-1.0.0.tar.gz
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 Oct 31, 2026.
Transparency logA 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.