Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

mut-scan

In-silico saturation mutagenesis and variant scoring from the command line. Every substitution at every position of a protein, or the variants you name, measured four ways: the published BLOSUM and PAM matrices, the Grantham chemical distance, hydropathy, charge, volume and polarity shifts, and - when you supply an alignment - what the homologues actually carry at that position. Coding sequences are read as codons, so a base change is reported as the residue change it causes. Pure Python with no third-party dependencies, and a self-contained HTML report with a substitution heatmap that opens from a local disk with no network connection and no JavaScript.

Install

Install the prerelease from PyPI:

python -m pip install --pre norvara-mut-scan

The Python package and command keep the shorter project name:

import mut_scan
mut-scan --version

Quickstart

One variant, measured:

mut-scan variants -i examples/hbb_human.fasta -v "E7V HbS, sickle haemoglobin" --homologs examples/hbb_homologues.afa
> NP_000509.1  147 aa  protein  BLOSUM62
  scanned  1 position  1 variant
  effects  missense 1
  distance moderately radical 1
  homologs 123 sequences from hbb_homologues.afa, positions 1-147
  E7V  HbS, sickle haemoglobin
    missense  BLOSUM62 -2 (fall 7)  Grantham 121 moderately radical
    hydropathy +7.7  charge +1.00  volume +1  polarity -6.4  charge lost, class changed
    homologs 117 with a residue, 0.0% carry V; most carry K (46.2%); 2.14 bits

Sickle haemoglobin is Glu6Val in the clinic and E7V here, because the RefSeq record begins with the initiator methionine that the mature protein has lost. Writing the reference residue is what catches that: E6V applied to this record names a proline and is refused rather than applied.

The same variant from the other direction, as the single base change it is:

mut-scan variants -i examples/hbb_human_cds.fasta --coding -v "c.20A>T sickle, in the coding sequence"
> lcl|NM_000518.5_cds_NP_000509.1_1  444 bp  DNA  NUC.4.4
  scanned  1 position  1 variant
  effects  missense 1
  distance moderately radical 1
  c.20A>T  sickle, in the coding sequence
    missense  codon 7 GAG>GTG  E>V  transversion  BLOSUM62 -2 (fall 7)  Grantham 121 moderately radical
    hydropathy +7.7  charge +1.00  volume +1  polarity -6.4  charge lost, class changed

And a saturation scan of a region, here the heparan-sulphate footprint of the AAV2 capsid:

mut-scan scan -i examples/aav2_vp1.fasta -r 580-590
> YP_680426.1  735 aa  protein  BLOSUM62
  scanned  11 positions  209 variants
  effects  missense 209
  distance conservative 35  moderately conservative 89  moderately radical 66  radical 19
  tightest G586 (8.1)  N582 (7.3)  N587 (7.3)  R585 (6.4)  R588 (6.4)  T581 (6.0)  Q584 (5.9)  Q589 (5.9)

What it measures

Four kinds of evidence, kept apart on purpose.

Measurement What it is What it is not
matrix score how often the change is seen in aligned proteins, from BLOSUM or PAM a statement about this protein
fall from the reference that score subtracted from the score the reference residue has against itself comparable across matrices
Grantham distance how chemically unalike the two residues are, from composition, polarity and volume a measure of importance
property shifts the change in hydropathy, charge, volume and polarity, in each property's own units a structural calculation
conservation what the homologues you supplied carry at that position corrected for how they were sampled

They are never combined into one number. The four disagree often, and the disagreements are the interesting part: a substitution the matrix tolerates at a position no homologue has ever varied is worth looking at precisely because the two disagree, and an average would hide it.

This is not a variant-effect predictor. There is no structure in it, nothing was trained on known pathogenic variants, and a change every measurement here calls radical may be perfectly tolerated in the protein it is in. It measures the substitution; the judgement stays with you.

The commands

scan                     every substitution at every position
-i, --input PATH         the sequence to scan, or '-' for standard input
-r, --region SPAN        scan only these positions: 585, 440-500, 700-, -100.
                         May be given more than once
    --include-stop       include the stop among the alternatives
    --max-variants N     refuse a scan larger than this

variants                 the variants you name
-v, --variant NOTATION   a variant, with an optional name after it. May be
                         given more than once
    --variants PATH      a file of them, one a line; '-' for standard input

shared by both
    --input-format       auto | fasta | fastq (default: auto)
    --limit N            read only the first N records
    --alphabet           auto | dna | rna | protein (default: auto)
    --matrix NAME        a built-in matrix, 'simple' for match/mismatch, or a
                         path to a matrix file
    --match SCORE        score for identical residues under 'simple'
    --mismatch SCORE     score for differing residues under 'simple'
    --hydropathy         kyte-doolittle | hopp-woods
    --coding             read a nucleotide record as codons, in frame from
                         its first base
    --homologs PATH      an aligned FASTA, one row of which is the record
    --window N           positions averaged for the smoothed profile

tables [NAME]            list the matrices and scales, or print one

Variant notation

Written Means
E7V, Glu7Val, p.E7V residue 7, a glutamate, becomes valine
7V residue 7 becomes valine, with nothing asserted to check
E7*, E7Ter residue 7 becomes a stop
c.20A>T, 20A>T, A20T base 20, an adenine, becomes thymine
E7del, 7_9del residue 7, or residues 7 to 9, removed
7_8insKL lysine and leucine inserted between residues 7 and 8
E7_K9delinsR residues 7 to 9 replaced by one arginine

Positions are 1-based and inclusive. A notation that names its reference residue is checked against the record and refused if it does not match, with the residue that is actually there in the message.

An HGVS prefix is accepted and is read as nothing more than a statement of which molecule the change is written in: p. for a protein record and c., g., m., n. or r. for a nucleic-acid one. This package does not model coordinate systems - a position is a position in the record as it was given, never a transcript coordinate mapped onto a genome - so a notation is written back out with the prefix that matches the record rather than the one it arrived with.

Outputs

Flag Output
--format table (default) the readable summary on stdout
--format tsv one row per variant, on stdout
--format json | none every measurement as JSON, or nothing
--output PATH | - one row per variant, as a TSV
--positions PATH one row per position, as a TSV
--fasta PATH every mutated sequence, as FASTA
--report PATH the self-contained HTML report

Any combination may be requested in a single pass. Compressed input is recognised from its magic bytes, so gzip, bzip2 and xz files need no flag and no particular file name.

Every input is opened, and every output destination resolved, checked and opened, before any input is read, so a run that cannot be written does not start and a run that fails leaves no file behind. An output is refused if it names an input under any name - a hard link and a symlink are the same file, and comparing names alone would let a run truncate what it is reading - and two outputs are refused if they name one file, since the second would silently replace the first. A matrix file, a variants file and a homologue alignment all count as inputs, because all of them are read.

Reading the output

  • A raw matrix score is not comparable across positions. Tryptophan scores 11 against itself under BLOSUM62 and serine 4, so the same -1 is a fall of 12 at one and of 5 at the other. Every substitution is therefore reported with the fall from the reference residue's own score beside it, and the heatmap is coloured by the fall. Scores are also not comparable across matrices: BLOSUM62 is in half-bit units and BLOSUM45 in third-bit units.
  • A missing measurement is empty, never zero. A Grantham distance of 0 is two identical residues; no distance at all is a residue the three properties are not defined for. The TSV and JSON leave those fields empty.
  • An indel has no substitution score, because a matrix scores one residue against one residue. The property columns still have a meaning for it: a shift is the property summed over the new residues less the old, which is the per-residue shift for a substitution and the change in the protein's total for an indel.
  • Conservation is evidence, not a correction. The counts are of the sequences you supplied. A hundred near-identical strains and a hundred species that last shared an ancestor in the Cambrian give the same arithmetic and do not mean the same thing, so the depth and the gap share are reported beside every column. The query's own row is left out of the counts, and positions the alignment does not cover have no evidence rather than evidence of nothing.
  • The hydropathy scales point opposite ways. Kyte-Doolittle is high for hydrophobic residues and Hopp-Woods high for hydrophilic ones, so +2 means opposite things on the two. Every output names the scale and its direction.
  • Only the standard genetic code is carried. A mitochondrial or ciliate sequence translated by it is wrong in a way nothing here would notice, so --coding names the table it used. A coding sequence that is not a whole number of codons, does not begin with ATG, or holds an internal stop is reported as such rather than scanned silently.
  • The flags are prompts, not findings. A proline introduced into a helix usually ends it, a lost glycine may be a lost hinge, a lost cysteine may be a lost disulphide - but this package has no structure and cannot tell you whether any of those is the case here.
  • A TSV field carries the input's text as it was given. An identifier or a variant name beginning with =, + or @ is written unchanged, because silently rewriting a value to suit a spreadsheet would be a change to the data. Import the file as text rather than letting a spreadsheet evaluate it. Control characters are a different matter and are refused at the input, in a FASTA header, a variant name and a matrix comment alike, since those are printed to a terminal.
  • Nothing is quietly corrected. A variant whose reference residue does not match is refused with the residue that is there; a region covering nothing is an error; an aligned record is refused until its gaps are removed; a residue no matrix scores is reported without a score rather than skipped; an option that cannot apply is named on standard error rather than ignored.

Anything a reader needs in order to read a number correctly is printed after a !, shown in the report, and carried in the JSON under qualifications, because a program reading the JSON cannot see a note printed beside it.

The HTML report

mut-scan scan -i examples/hbb_human.fasta --homologs examples/hbb_homologues.afa --report hbb.html -f none

One document, no network, no script: the parameters, the per-record metrics, the substitution heatmap as SVG with every cell carrying its own values as a tooltip, the conservation entropy as a strip beneath it, the mean fall and the smoothed hydropathy profile along the sequence, and the positions that tolerate least. A table of up to 500 kB can be downloaded from the page as the same tab-separated file --output would have written; a larger one - the variants table of a whole capsid scan is about 3 MB - is named with its size and a pointer to --output instead of being carried as a data URI, because a document nothing will open is not a deliverable. Output is byte-deterministic for a given input, so two runs of the same command produce the same bytes.

The heatmap draws at most 400 positions and says so when it has drawn fewer than were scanned; --region narrows the scan to the rest.

Size and speed

Measured on one core: a saturation scan of the 735-residue AAV2 capsid - 13,965 substitutions, each scored and measured - takes 0.09 s, and the same run writing all four outputs, including the 11 MB of mutated sequences, takes 0.26 s. The work is linear in the number of variants, which is 19 times the number of residues for protein and 3 times the number of bases for nucleic acid, so a file of records costs a file's worth of work.

The assessments are held in memory rather than streamed, because the per-position summary is over all of them: that scan is about 20 MB above the interpreter, or roughly 1.4 kB a variant. --max-variants bounds it and --region narrows it. The limit is applied as soon as the records have been read and before any variant is built; it cannot be applied earlier, because how large the scan is depends on the lengths of the records, and a file is usually far longer than its longest record.

Examples

examples/ holds real records, downloaded unmodified: the VP1 capsid protein of adeno-associated virus 2 (YP_680426.1), human beta globin as protein and as the coding sequence of its mRNA (NP_000509.1, NM_000518.5), and an alignment of that protein with 123 beta-globin homologues, one per species, built from Ensembl Compara and anchored on the human sequence. Beside them are two lists of named variants, one of haemoglobin variants and one of capsid-engineering substitutions. Re-fetch the records with python examples/fetch_examples.py.

References

  • Henikoff S, Henikoff JG (1992). Amino acid substitution matrices from protein blocks. PNAS 89:10915-10919.
  • Dayhoff MO, Schwartz RM, Orcutt BC (1978). A model of evolutionary change in proteins. In Atlas of Protein Sequence and Structure 5:345-352.
  • Grantham R (1974). Amino acid difference formula to help explain protein evolution. Science 185:862-864.
  • Kyte J, Doolittle RF (1982). A simple method for displaying the hydropathic character of a protein. Journal of Molecular Biology 157:105-132.
  • Hopp TP, Woods KR (1981). Prediction of protein antigenic determinants from amino acid sequences. PNAS 78:3824-3828.

License

PolyForm Noncommercial License 1.0.0. See LICENSE.

Metadata

Release files for norvara-mut-scan 1.0.0rc2

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

Source distribution (sdist)

Source distribution for norvara-mut-scan 1.0.0rc2
File Size Uploaded Provenance Actions
norvara_mut_scan-1.0.0rc2.tar.gz 213.5 kB With provenance Details for norvara_mut_scan-1.0.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for norvara-mut-scan 1.0.0rc2
File Interpreter ABI Platform Actions
norvara_mut_scan-1.0.0rc2-py3-none-any.whl Python 3 none any Details for norvara_mut_scan-1.0.0rc2-py3-none-any.whl

Total release size: 305.8 kB

Release files / norvara_mut_scan-1.0.0rc2.tar.gz

Download URL norvara_mut_scan-1.0.0rc2.tar.gz
Size 213.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bc1b697740348dfc2e9df330beca55bc8450e6abd9155c69a3203be2ef1c5615
BLAKE2b-256 checksum
How to use checksums
60eaff008ffae96cc54af6a1de2062ada6eedb5f19cbdd7b9b86178c11060686
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 1, 2026.

Transparency log

Release files / norvara_mut_scan-1.0.0rc2-py3-none-any.whl

Download URL norvara_mut_scan-1.0.0rc2-py3-none-any.whl
Size 92.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4297801777969df6df971fbe451cac5676a6fe5eb55a8d3b45b150413bde2f38
BLAKE2b-256 checksum
How to use checksums
9f970393a580b260047766e9e4458a019948deddd76e20f93b848be0c21fb248
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 1, 2026.

Transparency log

Security for norvara-mut-scan 1.0.0rc2

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 norvara_mut_scan-1.0.0rc2.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 1, 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.

Release history Release notifications | RSS feed

This release
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