Skip to main content

Annostat

PyPI CI License: MIT

Validate, analyze and compare bacterial annotations from matching FASTA and GFF3 files. Outputs include offline HTML reports, JSON/TSV results, CDS FASTA exports and editable SVG plots. Annostat analyzes existing annotations; it does not annotate genomes or establish biological correctness.

This README describes 1.2.0. Check annostat --version; package indexes may provide an earlier release. See the changelog for version-specific fixes.

Installation

Python 3.10+ is required. Matplotlib and Biopython install automatically.

python -m pip install annostat
annostat --version

Use an isolated environment: python3 -m venv .venv, then source .venv/bin/activate on Linux/WSL/macOS or .\.venv\Scripts\Activate.ps1 in Windows PowerShell.

Bioconda is available on Linux, WSL and macOS:

conda create -n annostat -c conda-forge -c bioconda --strict-channel-priority annostat
conda activate annostat

For development or an unreleased fix:

git clone https://github.com/dpatel511/annostat.git
cd annostat
python -m pip install -e .

Quick start

From a source checkout, use the included example files:

annostat validate -f data/GCF_000007145.1.fna -g data/GCF_000007145.1.gff3
annostat analyze -f data/GCF_000007145.1.fna -g data/GCF_000007145.1.gff3 -o results

Open results/report.html. Use summary.json for machine-readable metrics, tables/ for counts and QC findings, sequences/ for CDS nucleotide/protein FASTA files, and plots/ for SVG figures. --table-format tsv selects a TSV feature overview; the default is CSV. --profile adds peak Python-memory measurement and stage timings.

Choose the comparison mode

Mode Input Result
compare Two or more annotations Aggregate counts, normalized profiles and pairwise metric differences
compare --gene-level Exactly two annotations of identical genome sequences and IDs Also matches individual CDS models and compares predicted proteins

Aggregate comparison:

annostat compare \
  --genome A genome-a.fna annotation-a.gff3 \
  --genome B genome-b.fna annotation-b.gff3 -o comparison

CDS-level comparison on the same unchanged assembly:

annostat compare --gene-level \
  --genome RefSeq genome.fna refseq.gff3 \
  --genome Bakta genome.fna bakta.gff3 -o gene-comparison

The gene-level report opens with differences/review findings; All relationships retains access to unchanged pairs. Ambiguous links can be inspected together as a locus with per-source CDS counts and coordinate tracks. These groups do not establish gene split/merge events.

Open gene-comparison/comparison.html and inspect a CDS to connect its coordinates, translation context and alignment to the classification. comparison.txt is the text summary; all relationships remain in tables/gene_comparisons.tsv and JSON. Unresolved loci also show overlapping source pseudogene/RNA records, opposite-strand CDSs and sequence-edge context, with original identifiers and explicit overlap measurements. All observations are in tables/gene_context.tsv; they do not establish why the annotations differ or identify the correct model.

Matching uses CDS structure, strand and frame, not gene names. Exact unique matches anchor the comparison, followed by mutually unique start/stop alternatives. Other overlaps remain unresolved. Equal first-codon letters can occur at different positions: TTG can initiate a shorter model but encode L internally in a longer model. Reports distinguish each model's first-codon positions and first predicted amino acid from aligned shared-codon differences.

See the gene-comparison reference for rules, columns, formulas and limitations, or the demonstration for a short presentation using real annotation files.

Other workflows

Filters create additional exports and do not change the full analysis. All enabled criteria must be satisfied:

annostat analyze -f genome.fna -g annotation.gff3 -o results \
  --min-cds-length 300 --max-cds-length 900 --require-cog --exclude-hypothetical

Aggregate completed single-annotation analyses; sample directory names must be unique. This does not aggregate gene-comparison tables:

annostat summarize results/sample-a results/sample-b -o cohort

Downloads require the optional official NCBI Datasets CLI and internet access. Local analysis works offline and does not transmit inputs:

annostat fetch GCF_000007145.1 -o ncbi-data
annostat compare --genome Sample sample.fna sample.gff3 \
  --reference GCF_000007145.1 -o reference-comparison

Run annostat COMMAND --help for options. inspect is an alias for analyze; the older option-only invocation is deprecated. python -m annostat is equivalent to the installed command.

Scientific scope

  • FASTA IDs are the first whitespace-delimited header tokens and must match GFF3 IDs. Coordinates are 1-based inclusive; strand and phase matter.
  • Repeated CDS IDs count once and join multipart rows; the feature overview retains individual GFF3 rows. Phase continuity is validated. Circular coordinates extending past the sequence length require a region with Is_circular=true. Gene comparison does not align different or rotated assemblies. Reconcile coordinates rather than renaming IDs to bypass checks.
  • NCBI tables 4, 11 and 25 are supported. A consistent GFF3 transl_table is used when present; otherwise the default is 11. Use analyze --genetic-code TABLE or compare --genetic-code LABEL TABLE for inputs without that metadata. Conflicting overrides are rejected.
  • Initiator M is a translation rule, not experimental evidence. Nonzero initial phase and 5′ partial markers prevent initiator recoding. Supported contiguous codon transl_except annotations include standard amino acids, Sec, Pyl, TERM and OTHER (X). Unapplied exception entries produce an unapplied_translation_exception QC warning; affected accepted pairs have limited protein evidence. Their exported translations/lengths are provisional. Complex exception positions still need external verification.
  • GC is G+C divided by A+C+G+T; ambiguity-only genomes have unavailable GC. Assembly length includes ambiguous bases. Coding density uses the union of CDS intervals, counting overlaps once.
  • COG coverage uses CDS with source-provided categories divided by all CDS. Category profiles use category assignments; a CDS can have several categories. Missing categories are unavailable, not biological zero. Gene-symbol and COG-ID Jaccard scores compare labels, not orthologs or ANI.
  • First-codon counts include partial CDSs and do not prove initiation. Pooled codon usage includes complete codons, including terminal stops; incomplete trailing bases are excluded. CDS histograms disclose a lower empirical 99th-percentile view cutoff; mean and median use all CDS lengths.
  • QC findings identify records for review. Unmatched calls do not establish gene absence; annotation differences do not establish DNA mutations, altered function, statistical significance or which annotation is correct.

Outputs and reproducibility

Workflow Files to start with
analyze report.html, summary.json, tables/, sequences/, plots/
validate validation.json and validation.tsv when findings exist
compare comparison.html, comparison.json, dataset/pairwise TSV tables and SVG plots
compare --gene-level Also comparison.txt, tables/gene_comparisons.tsv, tables/gene_context.tsv, plots/gene_consequences.svg
summarize cohort.html, cohort.tsv, cohort.json

Standalone validation writes nothing for clean inputs. Full analysis retains validation/validation.json; its TSV is written only for findings. COG plots are omitted when category data is unavailable. Reports work offline; the interactive gene table requires JavaScript, while TSV/JSON/text exports do not. An analysis summary's output_files list records generated files.

JSON records schemas, input SHA-256 hashes and calculation policy. Scientific fingerprints exclude paths and timings. Missing measurements remain null/NA, separate from zero. Cohorts flag mixed versions or calculation policies; regenerate inputs consistently before comparing their metrics.

Terminal output and troubleshooting

Progress and diagnostics go to stderr, final summaries to stdout:

annostat analyze -f genome.fna -g annotation.gff3 -o results >summary.txt 2>run.log

--quiet suppresses routine output; errors remain visible. Exit status 0 means success, 1 means a validation threshold was reached, and 2 means invalid options or a runtime failure. Validation defaults to --fail-on error; use --fail-on warning for stricter CI or --fail-on never to retain findings without failing a pipeline. Its PASS/FAIL label describes structural validity, independently of that exit policy.

If the command is missing, activate its environment or use python -m annostat. --gene-level belongs to compare and needs 1.1.0 or newer. For input errors, inspect validate output before changing files. For bug reports, include the version, command, error and a small non-sensitive example in the issue tracker.

See the release and Bioconda automation guide for publishing and recipe-update expectations.

Development and references

python -m compileall -q annostat tests
python -m unittest discover -v

Translation and coordinates follow the NCBI genetic codes and NCBI GFF3 documentation. See the 1.1.1 validation record for the tested panel and limits, and the changelog for release changes. Computational consistency and source checks do not replace independent biological validation.

The optional multi-tool public-data audit checks five assemblies, source proteins, scientific exports and browser rendering.

Metadata

Release files for annostat 1.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 annostat 1.2.0
File Size Uploaded Provenance Actions
annostat-1.2.0.tar.gz 168.3 kB With provenance Details for annostat-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 313.7 kB

Release files / annostat-1.2.0.tar.gz

Download URL annostat-1.2.0.tar.gz
Size 168.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54069d51cd29dde31282c387df529d854e29497d288e3f6a48e7b11578576640
BLAKE2b-256 checksum
How to use checksums
588f5aaeb1a1249fe52c9016bbf26ea56ba11b4fdaeaa7b43692a4c6e46d0ebe
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 Nov 11, 2026.

Transparency log

Release files / annostat-1.2.0-py3-none-any.whl

Download URL annostat-1.2.0-py3-none-any.whl
Size 145.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0c81ad82e938f8e25aa71f79ca86e1a773973b1994c56f3ccd8f5c2924b24ff
BLAKE2b-256 checksum
How to use checksums
214000f518199cfc23ed85565433319f019d1e47a7ad67e58df44886b2ea97a7
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 Nov 11, 2026.

Transparency log

Security for annostat 1.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for annostat-1.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 Nov 11, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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