KBank¶
Bacterial surface glycan database, biosynthetic gene-to-glycan alignment, and de novo polysaccharide structure prediction.
Built on Structure-of-Arrays (SoA) Compressed Sparse Row (CSR) chemical graphs and Numba-accelerated message-passing kernels, KBank bridges SeroGen biosynthetic gene cluster predictions directly to chemical polysaccharide structures (CSDB / IUPAC / KEGG KCF).
Key Capabilities¶
-
Curated Geno-Glycomic Database (
kbank.db)
Provides 1,530 curated bacterial polysaccharide structures (
CSDB,IUPACLinear, andKEGG KCF) paired with complete biosynthetic gene clusters and MCL protein homology families across Klebsiella, Acinetobacter, Escherichia, Salmonella, Streptococcus, and Pseudomonas. -
CSR Directed Glycan Graphs (
kbank.glycan,kbank.sugars)
Represents repeating-unit oligosaccharides and modifications inside contiguous SoA CSR arrays with root-invariant topological hashing, Weisfeiler-Lehman graph kernels, and direct
CSDB/IUPAC/KEGG KCFparsing and serialization. -
Bipartite Gene-to-Glycan Alignment (
kbank.biosynthesis.align)
Maps individual glycosyltransferases, acetyl/pyruvyltransferases, and
Wzypolymerases onto specific sugar linkages viaBiosyntheticAssignerandPanGraphConsensusPriorExpectation-Maximization homology priors. -
De Novo Polysaccharide Structure Prediction (
kbank.biosynthesis.predictor)
Combines Operon Precursor Pool gating, factorized 1D-CNN enzyme classifiers (
BiosyntheticClassifierSuite), a Relational Message-Passing GNN (RelationalMPNN), and a branch-and-bound Constrained Spanning Arborescence solver (GlycanPredictor).
End-to-End Geno-Glycomic Pipeline¶
flowchart LR
LOC["<b>Segmented BGC Locus</b><br/><i>SeroGen LocusPredictor</i>"]
CLS["<b>Factorized 1D-CNN Suite</b><br/><i>GT Donor, Mechanism & Wzy</i>"]
ALN["<b>Bipartite EM Aligner</b><br/><i>BiosyntheticAssigner + PanGraph Prior</i>"]
MPNN["<b>Relational MPNN + Arborescence</b><br/><i>GlycanPredictor De Novo Solver</i>"]
GLY["<b>Directed Glycan Graph</b><br/><i>CSDB / IUPAC / KEGG KCF</i>"]
LOC --> CLS --> ALN --> MPNN --> GLY
Quickstart¶
from kbank.biosynthesis.predictor import GlycanPredictor
from kbank.db.records import GlycanRecords
from serogen.core.io.fasta import GenomeAssembly
from serogen.loci.predictor import LocusPredictor
# Load curated bacterial glycan-locus reference database
records = GlycanRecords.load()
# Segment capsule/O-antigen locus from a genome assembly
assembly = GenomeAssembly.from_fasta("KL106.fasta")
locus = LocusPredictor().predict(assembly)[0]
# Predict top candidate polysaccharide structures via Relational MPNN
predictor = GlycanPredictor.from_records(records)
top_hit = predictor.predict(locus, top_k=1)[0]
print(top_hit.glycan.to_csdb().decode(), f"(p={top_hit.probability:.2%})")
from kbank.biosynthesis.align import BiosyntheticAssigner
from kbank.db.records import GlycanRecords
records = GlycanRecords.load()
assigner = BiosyntheticAssigner()
# Align a biosynthetic gene cluster to its paired glycan structure
record = records[0]
assignment = assigner.assign_record(record.glycan, record.locus)