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.3.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.

A product-label matrix separates missing descriptions, explicit hypothetical labels and other product text among accepted identical-protein pairs. Select a count to inspect those pairs. Other product text does not establish a known function. The matrix is also available in tables/gene_product_status.tsv.

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.
  • Spliced gene → mRNA → CDS models (for example funannotate fungal output) are read as one CDS model per transcript CDS ID; alternative isoforms stay separate. The report shows gene, mRNA, CDS-model and CDS-row counts. CDSs inherit product/Dbxref from their mRNA, then gene. Use --genetic-code 1 for nuclear fungal inputs without transl_table. Overlaps between isoforms of one gene are not QC overlap/duplicate findings. A gene's Name counts as its symbol when it has no gene attribute and the name is not its ID or locus tag, and COG categories are read from note=COG:X when Dbxref has none (funannotate). mRNAs are not counted as RNA features. The 5S/16S/23S rRNA check runs only for bacterial tables (4, 11, 25); tRNA coverage also reads yeast-style names such as tD(GUC).
  • NCBI tables 1, 3, 4, 11 and 25 are supported, per CDS. A CDS's own GFF3 transl_table (or its sequence region's) applies to that CDS; every other CDS uses analyze --genetic-code TABLE / compare --genetic-code LABEL TABLE, else a table declared by every CDS, else the bacterial default 11. RefSeq fungal GFF3 declares tables only on mitochondrial CDSs, so pass --genetic-code 1 for their nuclear genes. Rows of one CDS that declare different tables are rejected, as is an override when every CDS declares another table. Reports list per-table CDS counts.
  • 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_product_status.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. Terminal output escapes characters its selected encoding cannot represent; report files retain UTF-8 text:

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.3.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.3.0
File Size Uploaded Provenance Actions
annostat-1.3.0.tar.gz 190.4 kB With provenance Details for annostat-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 348.8 kB

Release files / annostat-1.3.0.tar.gz

Download URL annostat-1.3.0.tar.gz
Size 190.4 kB
Tags Source
SHA-256 checksum
How to use checksums
80ce9af947140f64eea5ddba66cb4f5f7e9e93b5b1c8674656bb15bf07a5d754
BLAKE2b-256 checksum
How to use checksums
d94bae84105a045826b1177caedfa929f7140a1f62f80b1c62eccc06ed9c3147
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 20, 2026.

Transparency log

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

Download URL annostat-1.3.0-py3-none-any.whl
Size 158.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e902c469cface8e29700ead0f152de17888d1e550fb9410745dc00bcd20c716
BLAKE2b-256 checksum
How to use checksums
f015667d3edbd00a4aead82dd17ca2998ae7660bbf12ff7fe2d4d8c997cb2c5e
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 20, 2026.

Transparency log

Security for annostat 1.3.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.3.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 20, 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