Skip to main content

alignment-check

Assess a multiple sequence alignment (MSA) FASTA file for errors and anomalies, and gather general information about it, producing a single self-contained HTML report with interactive Plotly plots.

Installation

With pip

pip install alignment-check

With uv

To use it as a one-off command without installing it into a project:

uvx alignment-check ...

To add it as a dependency of a project:

uv add alignment-check

Usage

alignment-check alignment.fasta -o report.html

If no input file is given, the alignment is read from standard input:

cat alignment.fasta | alignment-check -o report.html

By default, the report is written to alignment_check_report.html in the current directory.

Options

Option Description
-o, --output PATH Where to write the HTML report (default: alignment_check_report.html).
--gap-chars CHARS Characters treated as alignment gaps (default: -.?).
--allow-all-id-chars Disable the check for sequence IDs containing characters that can break downstream tools.
--n2 Enable analyses that take O(n²) time in the number of sequences (currently: the pairwise identity histogram). Skipped by default.
--gc-low, --gc-high FLOAT Fixed thresholds for flagging unusual G/C content (default: statistical, based on the alignment's own distribution).
--gap-count-low, --gap-count-high FLOAT Fixed thresholds for flagging an unusual gap count.
--n-count-low, --n-count-high FLOAT Fixed thresholds for flagging an unusual N count.
--ambiguous-count-low, --ambiguous-count-high FLOAT Fixed thresholds for flagging an unusual ambiguous-nucleotide-code count.
--indel-minority-fraction FLOAT A column's minority group must be smaller than this fraction of all sequences to be a candidate indel column (default: 0.1).
--indel-min-length INT Minimum number of consecutive columns to report as an indel region (default: 10).
--long-stretch-fraction FLOAT Minimum length, as a fraction of sequence length, of a run of ambiguous/N characters to flag (default: 0.1).

Run alignment-check --help for the full, current list.

What gets checked

Errors (structural problems with the input): the file isn't FASTA, it doesn't exist, it's empty, it has only one sequence, sequences aren't all the same length, a sequence is entirely gaps or 'N's, nucleotide and protein sequences are mixed together, duplicate or empty sequence IDs, sequence IDs with problematic characters, and sequence characters that aren't valid nucleotide/protein/gap codes.

Anomalies (statistical or structural oddities, once the input is clean): sequences with unusual G/C content, gap count, N count, or ambiguous-code count (each flagged as a statistical outlier by default, or against a fixed threshold if given); gap-only columns; contiguous insertion/deletion regions found in only a minority of sequences; and long localized runs of ambiguous/N characters within an otherwise clean sequence.

Sequences flagged as all-gap or all-N are excluded from every check and plot beyond the error that flags them.

Info (general information, some as interactive plots): sequence count and length; a sortable per-sequence table (length, gap count, G/C%, N count, ambiguous-code count); and, across the alignment, plots of per-site gap fraction, per-site majority-character frequency, per-site nucleotide ambiguity (nucleotide alignments only), per-site homogeneity, and (with --n2) the distribution of pairwise sequence identities.

Development

uv sync
uv run pytest

Library code lives under src/alignment_check/, one check or info function per file (checks/ for errors and anomalies, info/ for general information and plots), each with a matching test file under tests/. The CLI script (src/alignment_check/cli/alignment_check.py) is the only place that wires these functions together.

Pre-commit hook

A .pre-commit-config.yaml runs the test suite before each commit. Install it once after cloning:

uv run pre-commit install

Committing the config file alone doesn't activate anything; each clone needs to run the command above once.

Versioning and releases

The package version is derived automatically from git tags (via uv-dynamic-versioning) — there is nothing to bump by hand in pyproject.toml. Tags must look like vX.Y.Z (e.g. v0.2.0).

To publish a new version to PyPI:

  1. Push a tag: git tag v0.2.0 && git push origin v0.2.0.
  2. Create a Release from that tag on the GitHub site (Releases -> Draft a new release).
  3. Publishing the release triggers .github/workflows/release.yml, which runs the tests, builds the package, and publishes it to PyPI using Trusted Publishing (no API token needed).

Before the first release, a maintainer needs to:

  • Add a Trusted Publisher for this repository on the PyPI project's "Publishing" settings page.
  • Create a pypi environment under the repository's Settings -> Environments (matching the environment: name: pypi used in release.yml).

Every push to main, and every pull request, runs the test suite via .github/workflows/test.yml.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alignment_check-0.2.0.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alignment_check-0.2.0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file alignment_check-0.2.0.tar.gz.

File metadata

  • Download URL: alignment_check-0.2.0.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alignment_check-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d56e4782320a524edc05b4734c72402688a29156a4655ed16d5540cbff0bfb23
MD5 5846111685354fce7430aa61778a5009
BLAKE2b-256 9aa986076015f8f6b09489eb43f7b806886da190707fb83643b86c580fc41e62

See more details on using hashes here.

File details

Details for the file alignment_check-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: alignment_check-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alignment_check-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5ddfe2e92419997c7e0b2d54a66d5f88bb260b5c93a935ddca3ae8f2b30fa5b
MD5 86132c65538cbe7f2a06896c6d69ef01
BLAKE2b-256 5c4d7bd9a88987f796df5c364ed305df8be1d6570fdd82d0113a14f79a784931

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

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