Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graph-Meta: Improving Multi-Class Metagenomic Contig Classification with Graph-Based Learning

License: Apache 2.0 Python 3.8+ PyTorch

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.

Overview

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.

Key Features

  • 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.

Methodology

The system operates in four distinct stages as shown in the pipeline below:

System Pipeline

  1. Data Acquisition & Simulation: Synthetic read generation using InSilicoSeq (short-read) and NanoSim (long-read).
  2. Assembly & Graph Construction: Processing reads via metaSPAdes or metaFlye to extract contigs (nodes) and overlaps (edges).
  3. Feature Extraction: Normalizing k-mer frequencies and calculating sequence statistics.
  4. 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.


Experimental Results

Experiments conducted on synthetic benchmarks (GENERIC and FILTERED scenarios) demonstrate that the GNN significantly improves performance on fragmented data.

Short-Read Performance (Macro-F1)

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.


Getting Started

Prerequisites

  • Python 3.8+
  • PyTorch & PyTorch Geometric
  • metaSPAdes / metaFlye (for assembly graph generation)

Installation

git clone [https://github.com/shbnmzr/graph-meta.git](https://github.com/shbnmzr/graph-meta.git)
cd graph-meta
pip install -r requirements.txt

About

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.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages