Skip to main content

viralconseq

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. CI PyPI Documentation License: MIT

viralconseq infers consensus genome sequences from viral high-throughput sequencing data. It is a Python package that validates inputs, writes a Snakemake configuration and launches one of four reference-guided consensus workflows: Illumina paired-end or Nanopore reads, against a single or a segmented reference. viralconseq runs on *nix systems and processes entire sequencing runs in minimal time on a regular computer.

Full documentation: https://viralconseq.readthedocs.io/en/latest/

Features

  • Reference-guided consensus assembly for Illumina (fastp → minimap2 → samtools/GSAlign) and Nanopore (minimap2 → Clair3 → bcftools) reads
  • Amplicon primer clipping from a BED scheme, with primer/reference consistency checks
  • Segmented viruses: a multi-record reference FASTA is split per segment and every segment is assembled in one run
  • Optional intra-host variant calling (LoFreq) for Illumina data
  • Consensus QC with viralQC: virus and clade assignment plus a genome-quality score (A–D) for every consensus sequence (Nextclade + BLAST), on by default
  • Content-level input validation: truncated FASTQs, protein FASTAs or mismatched primer schemes are rejected before the run starts
  • Nanopore models resolved for you: --clair3-model auto reads the basecalling model from the reads; models are cached by viralconseq setup; barcodes without mapped reads degrade to an all-N consensus instead of failing the run
  • Resources that bind: detected cores and a memory budget are passed to Snakemake by default (--threads-total, --max-memory)
  • One place to look: summary.tsv with a status column per sample, a share-ready consensus/ directory and a self-contained interactive report.html
  • Per-sample coverage statistics, a multi-sample alignment ready for phylogenetics, versions.tsv, and a run_manifest.json with input checksums for reproducibility

Installation

Install the CLI from PyPI:

pip install viralconseq

conda/mamba is required at runtime. viralconseq orchestrates Snakemake, which builds the per-rule tool environments (aligner, variant callers, QC tools) via --use-conda on first run. Make sure conda or mamba is installed and on your PATH; pre-build those environments and download the viralQC databases (about 1 GB) up front with viralconseq setup --pipelines all.

To install from source instead, setup.sh does the whole thing in one command: it finds conda/mamba/micromamba (even when they are not on PATH), creates or updates the viralconseq environment from environment.yml, installs the package into it and then runs viralconseq setup --pipelines all (per-rule envs, viralQC databases, Clair3 models):

git clone https://github.com/InstitutoTodosPelaSaude/viralconseq.git
cd viralconseq
bash setup.sh                        # everything; re-running is a no-op for what is already there
bash setup.sh --no-setup             # environment + package only
bash setup.sh --skip-clair3-models   # Illumina-only site: no Clair3 models

bash setup.sh --help lists the pass-through options (--conda-prefix, --viralqc-db, --clair3-model-dir, --clair3-models, --skip-viralqc-db, --cores, --env-name). Or do the same steps by hand:

conda env create -n viralconseq -f environment.yml
conda activate viralconseq
pip install -e ".[dev]"

Per-rule conda environments under viralconseq/scripts/envs/ are managed automatically by Snakemake; the top-level environment.yml only installs viralconseq itself and its core runtime dependencies.

Quick start

viralconseq setup --pipelines all                                  # pre-build per-rule conda envs + download viralQC databases (once)
viralconseq create-samplesheet --input <run-dir> --output samples.csv
viralconseq consensus illumina --sample-sheet samples.csv --reference ref.fasta \
    --primer-scheme primers.bed --run-name run1 --config-file run1.yml --output results/
viralconseq consensus nanopore --sample-sheet samples.csv --reference ref.fasta \
    --run-name run1 --config-file run1.yml --output results/
viralconseq rerun results/run1/config.yml --dry-run                # replay a run from its config
viralconseq create-report results/run1                             # rebuild report.html

Global options: --log-level {DEBUG,INFO,WARNING,ERROR} and --json-logs (e.g. viralconseq --log-level DEBUG consensus illumina ...).

Each subcommand has its own --help; the same information is exhaustively documented in the docs/ Sphinx site (rendered on ReadTheDocs at the link above), including a step-by-step tutorial.

Tests

make test          # unit suite (unittest)
make test-dryrun   # snakemake -n against every workflow (pytest)
make lint          # black + ruff
make typecheck     # mypy

Citation

A scientific publication describing viralconseq is being prepared. Meanwhile, please cite this repository (see CITATION.cff). Primary references for the upstream tools (fastp, MultiQC, minimap2, SAMtools/BCFtools, BEDtools, LoFreq, Clair3, GSAlign, gofasta, viralQC, Nextclade, BLAST+) are listed in the documentation.

Acknowledgements

viralconseq is the consensus-inference half of ViralUnity, developed at the Instituto Todos pela Saúde together with Felippe Nacif. It was split into a standalone package (from ViralUnity v1.5.0) so that the consensus workflows can be validated, benchmarked and published independently of the metagenomics pipeline.

License

MIT — see LICENSE.

Metadata

Release files for viralconseq 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viralconseq 0.2.0
File Size Uploaded Provenance
viralconseq-0.2.0.tar.gz 134.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for viralconseq 0.2.0
File Interpreter ABI Platform
viralconseq-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 296.5 kB

Release files / viralconseq-0.2.0.tar.gz

Download URL viralconseq-0.2.0.tar.gz
Size 134.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb6c1641bb29770e1367add35cfc649fac6dfa4c37bdc4e6b8583307b4ce8df
BLAKE2b-256 checksum
How to use checksums
df8c10ef1fba56566b0e146e9f21f0b4a19762d10ccec5a8885fa81b43cdf731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Release files / viralconseq-0.2.0-py3-none-any.whl

Download URL viralconseq-0.2.0-py3-none-any.whl
Size 162.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9a9a8b36741bfcc5806a04607980bc87a5977a2123a76466bbf86f928636dc8
BLAKE2b-256 checksum
How to use checksums
4b396320fe8c05047b262219a3ff659434ed7d7020dafd4183e8f94ef2faf7ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Security for viralconseq 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for viralconseq-0.2.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 Sep 29, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page