Graph-Meta is a topology-aware learning framework designed to classify metagenomic contigs into four major biological classes: Prokaryotes, Viruses, Plasmids, and Microeukaryotes. By leveraging the assembly graph topology, the model resolves ambiguities in fragmented assemblies that traditional sequence-based classifiers often miss.
Metagenomic assembly often results in fragmented short-read sequences that lack sufficient statistical signal for accurate classification. Graph-Meta addresses this by using a Graph Neural Network (GNN) to propagate information from high-confidence regions of the assembly graph to fragmented, ambiguous neighbors.
- Graph Attention Network (GATv2): Uses a dynamic attention mechanism to prioritize reliable overlap edges in the assembly graph.
-
Multi-Modal Features: Fuses canonical k-mer composition (
$k=3..7$ ), GC content, coverage depth, and log-transformed length. - Scalable Architecture: Implements Neighbor Sampling (Mini-batching) to reduce memory requirements from > 200 GB to < 24 GB, fitting on a single NVIDIA A40 GPU.
- Imbalance-Aware: Utilizes a Weighted Cross-Entropy Loss to handle the dominance of prokaryotic sequences over minority classes like viruses.
The system operates in four distinct stages as shown in the pipeline below:
- Data Acquisition & Simulation: Synthetic read generation using InSilicoSeq (short-read) and NanoSim (long-read).
- Assembly & Graph Construction: Processing reads via
metaSPAdesormetaFlyeto extract contigs (nodes) and overlaps (edges). - Feature Extraction: Normalizing k-mer frequencies and calculating sequence statistics.
- Graph Learning: Multi-layer message passing to refine class predictions based on topological context.
The GNN architecture allows nodes to aggregate feature information from their neighbors to update internal representations. This process captures homophily—the tendency for connected contigs to belong to the same taxonomic group.
Experiments conducted on synthetic benchmarks (GENERIC and FILTERED scenarios) demonstrate that the GNN significantly improves performance on fragmented data.
| Method | GENERIC (Balanced) | FILTERED (Mobile Enriched) |
|---|---|---|
| 4CAC (Baseline) | 0.71 | 0.72 |
| XGBoost (No Graph) | 0.52 | 0.64 |
| GNN (Ours) | 0.75 | 0.76 |
Note: In short-read data, the GNN improved minority class identification (viruses and plasmids) by up to 20% over baselines.
- Python 3.8+
- PyTorch & PyTorch Geometric
- metaSPAdes / metaFlye (for assembly graph generation)
git clone [https://github.com/shbnmzr/graph-meta.git](https://github.com/shbnmzr/graph-meta.git)
cd graph-meta
pip install -r requirements.txt