Abstract
Sequence diversity is one of the major challenges in the design of diagnostic, prophylactic and therapeutic interventions against viruses. DiMA is a novel tool that is big data-ready and designed to facilitate the dissection of sequence diversity dynamics for viruses. DiMA stands out from other diversity analysis tools by offering various unique features. DiMA provides a quantitative overview of sequence (nucleotide/protein) diversity by use of Shannon's entropy corrected for size bias, applied via a user-defined k-mer sliding window to an input alignment file, and each k-mer position is dissected to various diversity motifs. The motifs are defined based on the probability of distinct sequences at a given k-mer position, whereby an index is the predominant sequence, while all the others are (total) variants to the index. The total variants are sub-classified into the major (most common) variant, minor variants (occurring more than once and of frequency lower than the major), and the unique (singleton) variants. DiMA allows user-defined, sequence metadata enrichment for analyses of the motifs. The application of DiMA was demonstrated for the alignment data of the relatively conserved Spike protein (2,106,985 sequences) of severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) and the relatively highly diverse Pol protein (3,874) of human immunodeficiency virus-1 (HIV-1). The tool is publicly available as a web server (https://dima.bezmialem.edu.tr), as a Python library (via PyPi) and as a command line client (Via GitHub).
Introduction
Viral evolution presents a significant hurdle for medical interventions. Rapid mutation rates in viruses like SARS-CoV-2 and HIV-1 create a "sequence diversity" challenge that complicates the design of effective vaccines, diagnostics, and drugs. While many tools can measure how much a sequence varies, they often struggle with "big data" (millions of sequences) or fail to provide a granular view of how that diversity is structured. Researchers need to know more than just "this position is variable." They need to know which specific variants are dominant, which are rare "singletons," and how these patterns correlate with metadata like the host species or the year of collection.
DiMA (Diversity Motif Analyser) is a high-performance tool designed to quantify and dissect viral sequence diversity using Shannon’s entropy and a unique "motif" classification system. It enables researchers to handle millions of sequences, identifying highly conserved regions and tracking how specific variants emerge and shift over time and geography.
Methods
DiMA operates on Multiple Sequence Alignments (MSA) of either protein or nucleotide sequences. Its core logic revolves around two main concepts:
- Sliding Window k-mers: Instead of looking at single positions, DiMA uses a user-defined window (e.g., 9 amino acids for proteins) to capture local evolutionary context.
- Shannon’s Entropy with Bias Correction: It calculates entropy—a measure of disorder—for every k-mer position. Crucially, it applies a statistical adjustment to correct for sample size bias, ensuring results remain reliable even when comparing datasets of different sizes.
The tool’s most distinctive feature is its Motif Classification. It breaks down the sequences at any given position into four categories:
- Index: The most common (predominant) sequence.
- Major Variant: The second most common sequence.
- Minor Variants: Sequences appearing more than once but less frequently than the major variant.
- Unique Variants: "Singletons" that appear only once in the entire dataset.
DiMA is implemented in Python with Rust bindings for speed and is available as a web server, a command-line tool, and a library.
Results and Validation
The authors validated DiMA using two contrasting viral datasets:
- SARS-CoV-2 Spike Protein: A massive dataset of 2,106,985 non-redundant sequences sourced from GISAID. This represents a "big data" scenario for a relatively conserved protein.
- HIV-1 Pol Protein: A smaller but much more diverse dataset of 2,472 sequences from the Los Alamos HIV database.
As expected, the SARS-CoV-2 Spike protein was found to be generally conserved, with an average entropy of ~0.28. In contrast, the HIV-1 Pol protein was significantly more diverse, with an average entropy of ~0.84. In the Spike protein, position 675 was identified as a major diversity peak (entropy ~1.97). At this site, the "Index" sequence only accounted for ~39.67% of the population, while the "Major Variant" was nearly as common at ~37.74%. In the HIV-1 Pol protein, position 225 showed extreme diversity where the "Index" sequence appeared in only ~14.71% of cases, with minor variants making up the bulk of the population (~66.5%).
Discussion and Key Insights
DiMA introduces the concept of Motif Switching, where a specific sequence's role changes over time. A variant that starts as "unique" might become a "minor" or even "major" variant as the virus evolves under selective pressure. By finding "Historically Conserved Sequences" (HCS)—stretches where the index sequence has >80% incidence—DiMA helps pinpoint stable regions of the virus that are ideal targets for universal vaccines or drugs.
Furthermore, DiMA allows users to overlay metadata, revealing, for example, that a specific SARS-CoV-2 variant was most common in certain regions during specific timeframes before declining. This metadata integration provides a holistic view of sequence diversity, from raw alignment to interactive dashboards.
Limitations and Future Work
The authors acknowledge that DiMA’s accuracy is heavily dependent on the quality of the initial Multiple Sequence Alignment (MSA). Because MSA tools use heuristics, they can sometimes introduce errors that DiMA might interpret as biological diversity. Currently, the tool focuses on substitutions (point mutations) and does not account for larger structural changes like copy number variations. Future iterations may explore additional diversity metrics beyond Shannon’s entropy and aim to overcome the 100MB file size limit currently imposed on the web server version.
Summary updated