Skip to main content

Generic mutation and mutation-of-interest calling from consensus genomes

Project description

mutme

mutme is a lightweight Python command-line tool for detecting and annotating mutations of interest in viral consensus genome sequences.

It runs Nextclade against a user-supplied reference genome and GFF3 annotation, then matches amino-acid substitutions, deletions, insertions, and premature stop codons against a curated mutation annotation table.

mutme helps you answer a simple question at scale:

“Which mutations of interest are present in my consensus genomes?"

It can also provide generic annotations associated with each mutation, for example antiviral-resistance mutations, lineage markers, or any other genotype/phenotype you're interested in.

You provide:

  • a reference genome (FASTA)
  • a genome annotation (GFF3)
  • a mutation annotation table (CSV/TSV)
  • a query sequence file containing the consensus genomes (FASTA)

[!IMPORTANT] mutme is intentionally generic and database-agnostic. It does not attempt to interpret biological meaning beyond what you encode in your annotation table.

Key Features

  • Exact string matching against mutation-of-interest tables
  • Supports:
    • Amino-acid substitutions
    • Deletions
    • Insertions
    • Premature stop codons
  • Robust handling of multiple annotation rows per mutation
  • Long-format output suitable for downstream analysis

Table of Contents

Installation

Requirements

  • Python >= 3.10
  • Nextclade >= v3.18 installation available on $PATH

Install from source

pip install git+https://github.com/vidrl/mutme

Install with Anaconda

mamba create -n mutme -c conda-forge -c bioconda python=3.14 nextclade=3.18
mamba activate mutme
pip install git+https://github.com/vidrl/mutme

Directly from repository:

mamba create -f https://raw.githubusercontent.com/vidrl/mutme/main/conda.yml

Quick Start

mutme run \
  --sequences sequences.fasta \
  --reference reference.fasta \
  --gff reference.gff3 \
  --annotations mutations.csv \
  --output results.csv

Notes:

  • --sequences can contain one or many consensus sequences.
  • Output will contain a seq_name column so you can see which result belongs to which input sequence.

Annotations Table

How to write the annotations table

Your annotation table must have a mutation column (case-insensitive). Everything else is optional — add as many extra columns as you like. One special case is a comment column, which can contain e.g. links to the mutation phenotype study.

Mutation encoding (what goes in the mutation column)

Gene names must be defined in the GFF3 (see below). If CDS are included ensure that the Name attribute matches the gene name used in the annotation table. Nextclade will prefer the Name attribute for amino acid mutation prefixes.

  • Substitution: {gene}:{aa}{pos}{aa} (S:N87Y)
  • Deletion: {gene}:{pos}- or {gene}:{aa}{pos}- (S:87- or S:N87-)
  • Insertion: {gene}:{pos}{aa-ins} (S:214:EPE)
  • Stop codon: {gene}:{aa}{pos}* or {gene}:{pos} (S:N87* or S:87)

Output Table

Default output columns (always present):

  • seq_name - the FASTA record name (so multiple sequences are kept separate)
  • seq_quality - Nextclade QC overall status
  • mutation - the matched mutation from your annotation table

If your annotation table has extra columns, those columns are included too.

Examples

“I only care if these mutations are present”

Input annotation table (CSV)

mutation
S:N87Y
S:87-
S:214:EPE
S:87

Output table (example)

seq_name,seq_quality,mutation
sample_01,good,S:N87Y
sample_01,good,S:87-
sample_02,mediocre,S:214:EPE
sample_03,good,S:87

"I want to annotate mutations with mAb susceptibility values”

Here’s a more “real” example with multiple numeric columns. The values below are just an illustration of what your table can look like.

Input annotation table (CSV)

mutation,casirivimab_fold,imdevimab_fold,sotrovimab_fold,comment
S:E484K,12.5,8.1,1.2,Reduced neutralization for several mAbs
S:K417N,3.4,1.1,0.9,May reduce some class 1 mAbs
S:214:EPE,,,,Insertion seen in some lineages
S:87,,"",,Premature stop at position 87
S:87-,,"",,Deletion at position 87

[!TIP] Columns can be floats, ints, strings, or left empty. If you include a comment column, you can choose to carry it into the output with --include-comments.

Output table (example with --include-comments)

seq_name,seq_quality,mutation,casirivimab_fold,imdevimab_fold,sotrovimab_fold,comment
sample_01,good,S:E484K,12.5,8.1,1.2,Reduced neutralization for several mAbs
sample_01,good,S:214:EPE,,,,Insertion seen in some lineages
sample_02,good,S:K417N,3.4,1.1,0.9,May reduce some class 1 mAbs
sample_03,mediocre,S:87,,"",,Premature stop at position 87
sample_03,mediocre,S:87-,,"",,Deletion at position 87

[!NOTE] The output keeps your original columns (and their values) attached to each mutation hit. A sequence with no hits won’t appear in the output unless you choose to emit empty rows (not enabled by default).

Command reference

mutme provides two main commands: run (the core workflow) and subset-gff3 (a helper for trimming GFF3 files based on mutations in an annotation table).

mutme run

Run Nextclade using a custom reference and GFF3, then match detected amino-acid mutations against an annotation table.

Basic usage

mutme run \
  --sequences sequences.fasta \
  --reference reference.fasta \
  --gff reference.gff3 \
  --annotations mutations.csv \
  --output results.csv

[!NOTE] Input sequence file sequences.fasta may contain one or many consensus sequences. Each FASTA record is processed independently and results are distinguished by sequence name in the output table.


Required options

Option Description
--sequences, -s Input FASTA with one or more consensus sequences
--reference, -r Reference genome FASTA
--gff, -g Genome annotation in GFF3 format
--annotations, -a Mutation annotation table (CSV/TSV)
--output, -o Output file path (CSV/TSV)

Common optional options

Option Description
--annotations-delimiter Delimiter used by annotation table (default ,, use \t for TSV)
--output-delimiter Delimiter for output table (default ,)
--include-comments, -c Include a comment column in output if present in annotation table
--alignment-preset Nextclade alignment preset (default, high-diversity, short-sequences)
--nextclade-bin Path or name of Nextclade executable (default nextclade)
--nextclade-extra-args Extra arguments passed directly to Nextclade
--nextclade-keep-tsv Keep intermediate Nextclade TSV output

Example: TSV annotations, CSV output

mutme run \
  -s sequences.fasta \
  -r reference.fasta \
  -g reference.gff3 \
  -a annotations.tsv \
  -o results.csv \
  --annotations-delimiter '\t'

Example: keep Nextclade output for debugging

mutme run \
  -s sequences.fasta \
  -r reference.fasta \
  -g reference.gff3 \
  -a mutations.csv \
  -o results.csv \
  --nextclade-keep-tsv

mutme subset-gff3

Subset a GFF3 file to only genes (and optionally CDS features) referenced by mutation prefixes in an annotation table.

Basic usage

mutme subset-gff3 reference.gff3 mutations.csv --output subset.gff3

How it works

  • Reads the annotation table
  • Extracts prefixes from the mutation column (e.g. S from S:E484K)
  • Keeps matching GFF3 records using gene or CDS features
  • Preserves GFF3 headers and comments

Required arguments

Argument Description
gff3_path Input GFF3 file
table_path Annotation table (CSV/TSV)

Common optional options

Option Description
--output, -o Output GFF3 path (if omitted, no file is written)
--delimiter, -d Annotation able delimiter (default ,, use \t for TSV)
--mutation-column Name of mutation column (default mutation)
--prefix-separator Separator used in mutation strings (default :)
--no-strip-prefixes Do not strip whitespace around prefixes
--gene-feature-type GFF3 feature type treated as genes (default gene)
--gene-attr-key GFF3 attribute used to match gene features to annotation prefix (default gene)
--include-cds Also include CDS features
--cds-feature-type GFF3 feature type for CDS records (default CDS)
--cds-gene-attr-key GFF3 attribute key used to match CDS features (default gene)
--json Emit machine-readable JSON summary instead of text

Example: subset genes only

mutme subset-gff3 \
  reference.gff3 \
  mutations.csv \
  --output subset.gff3

Example: include CDS records and emit JSON summary

mutme subset-gff3 \
  reference.gff3 \
  mutations.tsv \
  --include-cds \
  --output subset.gff3 \
  --json

Example: inspect prefixes without writing a file

mutme subset-gff3 \
  reference.gff3 \
  mutations.csv

This prints summary statistics but does not write an output GFF3.

External Dependencies

mutme relies on Nextclade for sequence alignment and mutation calling.

Aksamentov et al. (2021) - Nextclade: clade assignment, mutation calling and quality control for viral genomes - Journal of Open Source Software

Citation

If you use mutme in published work, please cite Nextclade (see link above) and acknowledge this repository.

Project details


Download files

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

Source Distribution

mutme-0.1.2.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

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

mutme-0.1.2-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file mutme-0.1.2.tar.gz.

File metadata

  • Download URL: mutme-0.1.2.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mutme-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1579cba3d6352a63b4572fec2fc5db62400c606efc79fa7b3f05e505b2b8eac4
MD5 75095f8515e98f60f3ff15205a46334d
BLAKE2b-256 5f2aa78f3356e72525b3d6b90f00ea815dcf23258177ef106721f11001fef6d6

See more details on using hashes here.

File details

Details for the file mutme-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mutme-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mutme-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31cbe7dd3ed17afecda9e50bff09074b91b9359907e751c0f7a2f753f0c1511a
MD5 42b0244a9bc904dc4d84613d238ee845
BLAKE2b-256 4faadf95f1efe2fcf9d4a93d30f004420018f96bd3f71b5811c824bfb55ed433

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page