CA-MER: Chaos Game-Based k-MER Representation
- CA-MER is a unified framework for encoding DNA k-mer statistics via Chaos Game Representation, harmonizing geometric and compositional data.
- It establishes a bijection between FCGR pixels and k-mers through precise grid partitioning and closed-form expressions.
- The framework leverages dihedral symmetries and nucleotide permutations to enhance interpretation in synthetic reconstruction and machine-learning applications.
CA-MER, short for Chaos-game-based -MER representations, denotes the use of Chaos Game Representation (CGR) and Frequency CGR (FCGR) as encodings of DNA -mer statistics. In the formal framework established for DNA over , a CGR discretized at resolution is mathematically equivalent to the FCGR of order , and vectorization of that FCGR is exactly the -mer frequency vector up to a fixed bijection between pixels and -mers. CA-MER therefore unifies geometric visualization, histogram-based image representations, and classical compositional statistics within a single mathematical object (He et al., 27 Jun 2025).
1. Formal definition of CGR in the CA-MER framework
For the nucleotide alphabet , CGR is defined on an axis-aligned square centered at the origin with side length $2$: The four vertices are assigned nucleotides by
0
Given a DNA sequence 1, its CGR is the sequence of points 2 defined by
3
Each base is therefore plotted at the midpoint between the previous point and the vertex associated with that base. In this formulation, CGR is an iterative affine map rather than a purely heuristic image-generation procedure.
A key object is the last point of the CGR of a word 4, denoted 5. If 6 and 7 with 8, then the coordinates of the last point admit the closed form
9
This expression is central because it turns the recursive geometry of CGR into an explicit combinatorial encoding of 0-mers.
2. FCGR as discretized CGR and as a 1-mer count array
For a fixed order 2, the CGR square is partitioned into a uniform 3 grid. A grid cell of order 4 with indices 5 is centered at
6
with matrix indexing convention 7 from top to bottom and 8 from left to right. The FCGR of order 9 is then the histogram
0
so FCGR is exactly the point density of CGR on the 1 grid.
For each 2-mer 3, the corresponding CGR cell 4 is the open square centered at 5 with side 6. The framework establishes three structural facts: 7 is the center of 8; the cells 9 for distinct 0 are disjoint; and there are exactly 1 such cells. Proposition 1 proves that these cells coincide with the grid partition: each 2-mer corresponds to exactly one FCGR pixel, and each pixel corresponds to exactly one 3-mer (He et al., 27 Jun 2025).
The central theorem states that for any sequence 4 and any 5-mer 6 with 7,
8
Thus the number of occurrences of 9 in the sequence is exactly the number of CGR points falling in the cell associated with 0. Combined with the bijection between 1-mers and pixels, this yields Corollary 4: the FCGR matrix 2 obtained by discretizing 3 at resolution 4 is exactly the array of 5-mer counts. The same result also implies that no CGR point lies on a cell boundary, so the use of open cells is unambiguous.
A common misconception is that FCGR images at fixed order 6 necessarily contain information beyond classical 7-mer composition. In this framework they do not: at order 8, FCGR, discretized CGR, and the 9-mer count vector are exact reformulations of one another.
3. Pixel assignment, binary decoding, and lexicographic order
The correspondence between 0-mers and FCGR pixels can be expressed geometrically or combinatorially. In the geometric form, if 1 with 2, the associated pixel indices are
3
Taken over all 4, this produces a bijection between the 5 pixels of the FCGR and the 6 possible 7-mers.
The paper also introduces a base-4 lexicographic indexing of 8-mers using
9
and
0
This induces the lexicographic order 1. If the pixel coordinates satisfy
2
with 3, then Lemma 5 gives the inverse decoding rule
4
The pixel indices therefore determine the 5-mer directly from the binary expansions of 6 and 7.
Proposition 6 further states that if 8 is the 9-mer with lexicographic index $2$0, then $2$1. This means that vectorization of FCGR in any consistent scan order is a re-ordering of the classical $2$2-mer frequency vector. The geometric image and the compositional vector differ only by indexing convention (He et al., 27 Jun 2025).
4. Dihedral symmetries and nucleotide permutations
Because CGR is defined on a square, its natural symmetry group is the dihedral group $2$3, consisting of four rotations and four reflections. The framework makes this correspondence explicit by mapping the geometric symmetries of the square to a subgroup $2$4 of nucleotide permutations. Examples include
$2$5
with analogous definitions for the remaining elements of $2$6. Each permutation is extended to words by monoid morphism.
Theorem 7 states that for words $2$7 and one of these eight permutations $2$8,
$2$9
where the right-hand side applies the corresponding 0 symmetry matrix to every CGR point. Geometric transformations of the CGR are therefore in one-to-one correspondence with specific renamings of nucleotides (He et al., 27 Jun 2025).
This result has two immediate consequences. First, the set of all CGR images of DNA sequences is closed under the eight square symmetries. Second, orientation normalization of CGR images can be interpreted as choosing a canonical representative in the 1-orbit, which is equivalent to fixing a canonical nucleotide labeling. A plausible implication is that image-level data augmentation by rotations or reflections is not generically label-preserving unless the downstream task is invariant under the corresponding nucleotide permutation.
The same symmetry principle extends to avoided 2-mers. If a sequence avoids a unique 3-mer 4 and a nucleotide permutation 5 is applied, then the transformed sequence avoids 6. In CGR terms, a symmetry that moves a hole corresponding to 7 yields a hole corresponding to 8.
5. Inverse CA-MER: reconstruction from prescribed 9-mer distributions
The inverse direction of CA-MER starts from a target 00-mer distribution or FCGR and reconstructs a DNA sequence with matching or approximately matching 01-mer statistics. Using the base-4 indexing above, the 02-mer frequency vector of a sequence 03 is
04
and the empirical 05-mer distribution is
06
These distributions must satisfy marginal consistency constraints arising from 07-mer overlaps. For each 08-mer 09,
10
The reconstruction algorithm builds a De Bruijn multigraph of order 11. Vertices are the 12-mers appearing as prefixes or suffixes of 13-mers with positive target count, and each 14-mer 15 with prefix 16 and suffix 17 contributes 18 parallel edges from 19 to 20. Any Eulerian path in this multigraph corresponds to a sequence whose 21-mer counts match the edge multiplicities. Exact realizability requires the integer balance condition
22
at every vertex, together with strong connectivity of the nonzero-edge subgraph.
Given 23, sequence length 24, and a target distribution 25 satisfying the marginal constraints, the algorithm proceeds by scaling 26 to pseudo-counts 27, building the De Bruijn multigraph, computing the vertex imbalance
28
adding artificial edges along paths of length at most 29 to balance the graph, optionally adding up to 30 additional edges to ensure strong connectivity, constructing an Eulerian cycle with Hierholzer’s algorithm, and finally decoding the cycle into a DNA sequence (He et al., 27 Jun 2025).
Theorem 8 gives the approximation guarantee. If 31, 32, and 33 satisfies the marginal constraints, then whenever
34
there exists an algorithm outputting a sequence 35 whose empirical 36-mer distribution 37 satisfies
38
The error arises from rounding and from artificial balancing edges; the bound shows that any marginal-consistent 39-mer distribution can be approximated to arbitrary precision by a sufficiently long synthetic sequence.
6. Synthetic CGR generation, empirical evaluation, and machine-learning use
Because the framework proves the equivalence
40
the reconstruction algorithm directly enables controllable synthesis of FCGR and CGR images. One specifies a target 41-mer distribution 42, reconstructs a sequence 43 with 44, and then computes 45 or 46. By the core equivalence theorem, the resulting image matches the target pixelwise 47-mer statistics (He et al., 27 Jun 2025).
Two classes of experiments are reported. In template-based reconstruction from real genomes, the study samples a 48k-bp fragment for each of 49 species from each major kingdom, computes empirical 50-mer distributions for 51, reconstructs sequences, and measures total variation distance between original and reconstructed distributions. The reported errors are small and below the theoretical 52 across kingdoms. In de-novo reconstruction, points are sampled from the relevant sub-polytope of 53 satisfying the marginal constraints by a hit-and-run MCMC method. For 54, sequences are reconstructed with
55
using 56, and the observed reconstruction errors are all 57.
The practical complexity is also stated explicitly. Building the De Bruijn multigraph is 58; balancing and adding artificial edges is 59 in the worst case; Eulerian cycle construction is 60; and sequence generation is 61. For moderate 62, specifically 63, and 64, the reported web implementation runs in 65 s and 66 MB RAM on a laptop.
The machine-learning motivation is downstream analysis on FCGR or CGR images, including CNN-based taxonomic classification and contrastive or self-supervised approaches. The data specifically notes applications to CNN-based taxonomic classifiers using FCGR/CGR images, citing Rizzo 2016, Safoury and Hussein 2019, Avila Cartes et al. 2023, and DeepMicrobes-style architectures, as well as contrastive or self-supervised settings such as DeLUCS and CGRclust. Within this setting, synthetic reconstructions can preserve species-specific genomic signatures at the level of 67-mer bias patterns while varying local sequence content.
7. Scope, interpretive consequences, and limitations of CA-MER
The theoretical significance of CA-MER is that it turns CGR and FCGR from visually motivated encodings into rigorously characterized representations of 68-mer composition. At fixed order 69, any numerical method operating on FCGR images is, in the strict sense established here, a method on 70-mer frequencies. This suggests that convolutional filters learned on FCGR images should be interpreted as detectors of local structure in the ordered arrangement of 71-mer counts rather than as exploiting information absent from the underlying 72-mer vector (He et al., 27 Jun 2025).
The framework also clarifies the geometric semantics of CGR patterns. Fractal-looking regions, empty cells, and dense regions are no longer merely descriptive image features: each pixel corresponds to a specific 73-mer, and absence or over-representation of that pixel corresponds to low or high count of that 74-mer. Likewise, square symmetries are not arbitrary image manipulations but exact realizations of nucleotide permutations.
At the same time, the representational limits are explicit. For a given 75, CA-MER ignores all structure beyond 76-mer counts. Higher-order dependencies, longer motifs, and structural features are therefore not captured by the representation. Reconstruction is not unconstrained: marginal consistency must hold or be enforced, and sufficiently large sequence length is needed to obtain the stated approximation guarantees. The dimension 77 also grows rapidly with 78, so although FCGR has fixed size independent of sequence length, high-resolution CA-MER becomes increasingly expensive as 79 increases.
Within those assumptions, CA-MER is a reversible representation up to approximation and length requirements. That reversibility supports controlled perturbation of genomic signatures, generation of synthetic FCGR/CGR images with prescribed statistics, and direct analysis of how changes in 80-mer composition affect downstream alignment-free classification and representation learning.