This is the documentation of DiMA . The newest release is .
This documentation of the development version includes changes that are not released yet. The newest release is .
How DiMA measures diversity
DiMA (sequence Diversity dynamics analyser for viruses) describes how variable a viral protein or gene is along its length (Tharanga et al. 2025). It continues a line of work that measured the diversity of dengue, HIV-1 and influenza A proteomes position by position (Khan et al. 2008; Hu et al. 2013; Abd Raman et al. 2020). This page introduces the quantities every result is built from; the following pages derive each measure in detail.
The input: an alignment
Section titled “The input: an alignment”DiMA reads a multiple sequence alignment:
k-mer positions
Section titled “k-mer positions”DiMA slides a window of
positions, numbered from 1. In each sequence, the
The default -k.
Valid k-mers and support
Section titled “Valid k-mers and support”A k-mer is valid when all its
The support
The support threshold and the low-support labels
Section titled “The support threshold and the low-support labels”Estimates from few sequences are unreliable, so DiMA compares each position’s support with a
support threshold -s). Its default is the paper’s, 100 (“default is 100 sequences,
arbitrarily defined”), which the paper also uses for HIV-1 (Tharanga et al. 2025); the paper’s Fig. 2
shows 30, the default of DiMA v5.0.9:
| Label | Support | Meaning |
|---|---|---|
| NS | no support: no sequence has a valid k-mer | |
| LS | low support | |
| ELS | support equal to the threshold | |
| eligible (no label) | enough support |
Only eligible positions receive the paper’s sample-size correction of the entropy, and only
they enter the summary statistics (mean, lowest and highest entropy). LS and ELS positions are
still reported, with their observed values; NS positions have no entropy at all, because there is
nothing to measure — where the paper assigns them a pseudo-entropy of 0 (see
why DiMA departs from it). The
low_support_count of a run is the number of NS, LS and ELS positions, as in DiMA v5.0.9.
What is measured at each position
Section titled “What is measured at each position”- Shannon entropy of the variant distribution, corrected for sample size, and the observed (plug-in) value; the estimated sample coverage (Entropy and its correction).
- Diversity motifs: each variant is classified as Index, Major, Minor or Unique, with its incidence; the incidence of all non-Index (total) variants and of the distinct non-Index variants (Diversity motifs and summaries).
- Optionally, the count of every variant per value of chosen FASTA header fields such as host, country or year (Stratify by header metadata).
- Across positions: historically conserved sequences, stretches whose most common k-mer is (almost) invariant (Historically conserved sequences).
A worked example: MERS-CoV spike position 25
Section titled “A worked example: MERS-CoV spike position 25”The paper’s Fig. 1C dataset ships with DiMA as samples/mers_spike_aa.fasta: 191 MERS-CoV spike
protein sequences, 1,353 columns, so
| Variant | Count | Incidence | Motif |
|---|---|---|---|
SVKSACIEV | 129 | 75.88% | Index |
SFKSACIEV | 14 | 8.24% | Major |
SVKPACIEV | 9 | 5.29% | Minor |
SAKSACIEV | 6 | 3.53% | Minor |
SLKSACIEV | 4 | 2.35% | Minor |
SVKSACIAV | 4 | 2.35% | Minor |
SAKSVCIEV, SIKSACIEV, SVKSACIKV, SVKSVCIEV | 1 each | 0.59% each | Unique |
The support is
Determinism
Section titled “Determinism”Every quantity above is computed exactly from the counts: DiMA uses no random numbers, so the same alignment and options always give the same results, on every operating system and with any number of threads (see Make results reproducible). Where the paper’s procedure is random — the entropy correction — DiMA computes the exact expected value of its regression intercept instead of one random draw (see The exact expectation).
References
Section titled “References”- Abd Raman HS, Tan S, August JT, Khan AM. Dynamics of Influenza A (H5N1) virus protein sequence diversity. PeerJ. 2020;7:e7954. doi:10.7717/peerj.7954 ↩︎
- Falk K, Rötzschke O, Stevanović S, Jung G, Rammensee HG. Allele-specific motifs revealed by sequencing of self-peptides eluted from MHC molecules. Nature. 1991;351(6324):290-296. doi:10.1038/351290a0 ↩︎
- Hu Y, Tan PT, Tan TW, August JT, Khan AM. Dissecting the Dynamics of HIV-1 Protein Sequence Diversity. PLoS ONE. 2013;8(4):e59994. doi:10.1371/journal.pone.0059994 ↩︎
- Khan AM, Miotto O, Nascimento EJM, Srinivasan KN, Heiny AT, Zhang GL, Marques ET, Tan TW, Brusic V, Salmon J, August JT. Conservation and Variability of Dengue Virus Proteins: Implications for Vaccine Design. PLoS Neglected Tropical Diseases. 2008;2(8):e272. doi:10.1371/journal.pntd.0000272 ↩︎
- Rammensee H. Peptides Naturally Presented by MHC Class I Molecules. Annual Review of Immunology. 1993;11(1):213-244. doi:10.1146/annurev.immunol.11.1.213 ↩︎
- Tharanga S, Ünlü ES, Hu Y, Sjaugi MF, Çelik MA, Hekimoğlu H, Miotto O, Öncel MM, Khan AM. DiMA: sequence diversity dynamics analyser for viruses. Briefings in Bioinformatics. 2025;26(1):bbae607. doi:10.1093/bib/bbae607 ↩︎ 1 2 3