Microbiome studies identify bacteria by reading one gene, the 16S ribosomal RNA gene, and treating it as a flat string of letters. That gene is not a flat object. It folds into a fixed three-dimensional scaffold inside the ribosome, where positions hundreds of letters apart sit next to each other and constrain each other's mutations. We propose to place each sequencing read onto a solved 3D structure of the 16S molecule and let a neural network pass messages between nucleotides that touch in space. Each message carries the relative position and orientation of the two nucleotides, expressed in small coordinate systems attached to each nucleotide. The bet is that this structural prior tells the model which distant positions to read together. That should matter most where sequence-only methods fail: species-level identification, rare taxa, and telling true within-genome variants apart from sequencing errors.
The motivation is concrete. Johnson et al. show that the commonly sequenced V4 window fails to classify 56% of sequences at species level, and that the small differences between the multiple 16S copies inside one genome form a strain-distinguishing "SNP fingerprint" that standard pipelines throw away as noise (Evaluation of 16S rRNA gene sequencing for species and strain-level microbiome analysis). The existing learned and marker-based approaches both model the gene as 1D. Read2Pheno uses a CNN, a recurrent network and attention (Learning, visualizing and exploring 16S rRNA structure using an attention-based deep neural network). Sequence-based biomarkers (SBBs) combine nucleotide positions from a multiple alignment, and their cost grows combinatorially beyond two or three loci (Improved detection of disease-associated gut microbes using 16S sequence-based biomarkers). Neither uses the fold. The fold is exactly the object that says which multi-locus combinations are biologically meaningful.
Core Claim
The 16S fold is nearly universal across bacteria. A single solved structure, or a small set of them, can therefore act as a fixed prior over which nucleotide positions interact. A read encoder that threads reads onto these templates and aggregates information along 3D-neighbor edges should beat sequence-only encoders of equal size on species-level and rare-taxon classification, with the largest gains in low-data regimes.
The specific new ingredient is how relative geometry is represented. Each nucleotide carries a local reference frame, meaning an orthonormal coordinate system anchored to the nucleotide's own atoms. Edges carry the neighbor's position and orientation expressed in that frame.
We are explicit about one point a careful reader will raise. On a single fixed template, rotation invariance buys nothing, because the pose never changes. The frames earn their place for two other reasons. First, they give a pose-independent description of relative geometry, so the same edge features are consistent across several templates deposited in arbitrary coordinate systems, for example small-subunit structures from different organisms. Second, they encode orientation (stacked versus paired versus side-by-side), which a plain contact map discards. Whether that second point matters is the central empirical question, and we design the experiments so a negative answer is informative.
Research Program
We first build the templates. Following the coarse-grained 3-bead nucleotide representation of gRNAde, each nucleotide is reduced to three atoms: its phosphate, a ribose carbon (C4′), and the base nitrogen that anchors the base to the sugar. Gram–Schmidt orthogonalization of these three points gives a rotation matrix $R_i$ for nucleotide $i$. We extract 16S chains from structures in the RNASolo repository that gRNAde and RiboSphere train on. If ribosomal small-subunit coverage there is thin, we fall back to deposited 30S structures directly. The rest of the ribosome is ignored at first, since both gRNAde and RiboSphere are single-chain methods and 16S is itself one chain.
For an edge from nucleotide $i$ to a spatial neighbor $j$ within a cutoff radius, the edge feature is
$$e_{ij} = \big(R_i^{T}(x_j - x_i),\; R_i^{T}R_j\big),$$
where $x_i$ is the ribose-carbon position of nucleotide $i$. The first term is where the neighbor sits in $i$'s frame. The second is the transition matrix that rotates $j$'s frame into $i$'s. Both terms are unchanged by any rigid motion of the template. This is the frame-transition construction of Wang et al., who use it to pass orientation-aware messages between misaligned local frames, reused here for nucleic acids. Following Lippmann et al., who show that tensorial messages carried across canonical frames outperform messages reduced to scalars, we test both scalarized and vector-valued messages.
Next comes threading. Each read, whether a short V4 amplicon or a full-length PacBio read, is aligned to the template's reference numbering. Aligned nucleotides inherit template frames and edges. Hypervariable loops that carry insertions relative to the template have no coordinates. For these nucleotides we propagate frames along the backbone from the nearest anchored neighbors, and flag them with a "no structure" indicator rather than inventing geometry.
The encoder is a hybrid in the spirit of CDConv (Continuous-Discrete Convolution for Geometry-Sequence Modeling in Proteins). CDConv combines sequence-order convolution with backbone local frames on proteins and reports 77.7% superfamily accuracy on SCOPe versus 70.3% for a GearNet variant. We adapt its sequence-plus-geometry design to RNA. RNA has a different backbone chemistry and, in this setting, a template shared across all inputs rather than a structure per input. Sequence convolutions supply local motif detectors. Frame-aware message passing along 3D edges supplies long-range coupling. A pooled read embedding feeds taxonomy heads. For the phenotype tasks, a set-pooling layer produces a sample embedding.
As a mechanistic probe, we test one sharp hypothesis about errors. A real mutation inside a helix tends to come with a compensatory change in its base-pairing partner, and a sequencing or PCR error does not. A model with pairing-geometry edges should therefore separate the two better than a sequence model. We test this with simulated reads from genomes whose multiple 16S copies are known, as in Johnson et al.'s in silico setup. This lets us ask whether the within-genome SNP fingerprint can be recovered rather than discarded.
Baselines
The naive reference point is the standard RDP naive-Bayes k-mer classifier. On the SILVA 495-genus benchmark it reports 97.6% genus accuracy, higher than Read2Pheno's 95.9% (Learning, visualizing and exploring 16S rRNA structure using an attention-based deep neural network). This is the strongest competitor at genus level. We do not expect to beat it meaningfully there; matching it within about half a point is the bar. Our claim lives at species level and on rare taxa, where we run RDP with the identical reference set and taxonomy. For species-level resolution we found no reported RDP or full-length number on Lacuna for this benchmark, only Johnson et al.'s 56% V4 species-level failure. So we reproduce Johnson's in silico trimming on Greengenes and HOMD and report our own numbers for every method on identical splits.
The strongest learned 1D method is Read2Pheno. We retrain it on the same reads. We also train a sequence transformer with the same parameter count, training data, compute budget and number of hyperparameter trials as our model, because Read2Pheno's recurrent layers are known to scale poorly to 1,500-base reads. For host phenotypes on the American Gut Project body-site task, Read2Pheno reports about 88% sample accuracy against 83% for OTU-based methods. We treat 88% as the number to beat. SBB features fed to logistic regression serve as the marker-based baseline for phenotype tasks.
Two ablations isolate the key ingredient. The first, contact-only, keeps the same 3D neighbor graph but replaces $e_{ij}$ with distance plus a paired/unpaired bit, removing orientation and frames. The second, shuffled-structure, keeps our architecture but swaps the real graph for a random graph with the same degree distribution. This tests whether gains come from the real fold or merely from extra long-range edges.
Beating the baselines means two things. At species level, macro-F1 on held-out rare species must exceed the size-matched transformer and contact-only model by more than seed-to-seed variation. The shuffled-structure control must also lose clearly to the real graph.
Why not just…?
Why not just use the RDP classifier, which already beats deep models? At genus level it probably should be used, and we say so. Its k-mer independence assumption, however, cannot express that two distant positions change together. Johnson et al. show that the failure is at species and strain level, not genus. The species-level splits and the error-versus-SNP simulation test directly whether modeling coupled positions helps where RDP's assumption bites.
Why not just train a large sequence transformer and let attention discover long-range couplings? This is the real threat. Full attention can in principle learn the fold's contacts from covariation. Our answer is sample efficiency, not capacity. With abundant data a transformer may close the gap, and we expect it to. We therefore report learning curves at 1%, 10% and 100% of training reads, plus rare-taxon macro-F1. If the transformer matches us at every data scale, we conclude that the structural prior is unnecessary.
Why not just use a secondary-structure or contact graph without frames? This is the contact-only ablation, and it may well capture most of the gain, since base pairing is the dominant constraint. The proposal is designed so that this outcome is a clean result: orientation-level 3D geometry adds nothing beyond topology for 16S classification. Only a consistent gap favoring frame edges, concentrated on tertiary rather than secondary contacts, would justify the local-frame machinery.
Proposed Experiments
The decisive checks are four. First, on Greengenes/HOMD species-level splits, we compare V4-trimmed and full-length reads. Structure should help more for full-length reads, where linearly distant hypervariable regions that touch in 3D are both present. We held out entire species and report macro-F1 across frequency bins.
Second, the three-way comparison of frame-aware, contact-only and shuffled-structure graphs, run under identical budgets, determines whether the gain is geometric, topological or spurious.
Third, on SILVA's 495 genera we check that we stay near RDP's 97.6%. On American Gut body sites, and on the Gevers IBD cohort used by Read2Pheno, we check whether sample-level accuracy exceeds about 88%.
Fourth, in the simulated multi-copy genome setting, we measure how well each model separates true within-genome variants from injected substitution errors. The measure is area under the ROC curve (AUROC), reported separately for errors placed inside helices and in loops. The structure-specific prediction is that the advantage appears only for errors inside helices.
We also inspect which edges carry the largest learned message norms. We ask whether they concentrate on known tertiary contacts between hypervariable regions, which is the structural counterpart of Read2Pheno's finding that 1D attention highlights V2 to V4.
References
- Evaluation of 16S rRNA gene sequencing for species and strain-level microbiome analysis
- Learning, visualizing and exploring 16S rRNA structure using an attention-based deep neural network
- Improved detection of disease-associated gut microbes using 16S sequence-based biomarkers
- gRNAde: Geometric Deep Learning for 3D RNA inverse design
- RiboSphere: Learning Unified and Efficient Representations of RNA Structures
- Graph Neural Network with Local Frame for Molecular Potential Energy Surface
- Beyond Canonicalization: How Tensorial Messages Improve Equivariant Message Passing
- Continuous-Discrete Convolution for Geometry-Sequence Modeling in Proteins