Bacterial genome encoder that renders draft assemblies as Chaos Game Representation images and embeds them for nearest-neighbour species search.
No providers recorded yet. Browse all providers
PanSpace is a convolutional encoder that maps a bacterial genome assembly to a single dense vector, so that species identification becomes a nearest-neighbour lookup in an embedding index rather than a sequence alignment. It was built by the algorithmic bioinformatics group at the University of Milano-Bicocca with collaborators at Bielefeld University and Comenius University Bratislava, and posted to bioRxiv in March 2025.
The problem it targets is resource cost, not accuracy. Bacterial genome collections have outgrown BLAST-style alignment outside a compute cluster, and the alignment-free sketching tools that replaced it still need tens of gigabytes of RAM and disk to index a resource such as AllTheBacteria. PanSpace discards the sequence after a single pass: an assembly is reduced to its k-mer counts, those counts are laid out as an image, and a small CNN compresses that image into a fixed-length embedding. The encoder weighs 1.1 MB, and the resulting index is small enough to query on a laptop.
The design is deliberately narrow: PanSpace embeds whole assemblies for taxonomic search, not arbitrary DNA sequences, and offers none of the variant-effect capabilities of genomic language models. Within that scope, the released encoders apply to new draft assemblies without retraining.
The encoder, CNNFCGR, stacks two ConvFCGR layers with 4k filters each, flattens, and projects to an n-neuron dense layer with L2 normalisation, so embeddings lie on the unit sphere and Euclidean distances fall in [0, 2]. FCGR matrices are rescaled to [0, 1] by their maximum and clipped at the 80th percentile to stop overrepresented k-mers from dominating. Training uses the Rectified Adam optimiser at a learning rate of 0.001 for up to 100 epochs with early stopping, on semi-hard triplets only — switching to hard triplets after semi-hard training degraded results. The headline configuration uses 8-mers and 256-dimensional embeddings, trained on high-quality AllTheBacteria assemblies restricted to species with at least 13 examples — 1,841,109 assemblies in total, of which 1,656,597 were indexed and 184,512 held out as queries. That index occupies 1.6 GB and 7.0 GB of peak RAM to build, against 13-75 GB of disk and 40-154 GB of RAM for the three sketching modes of GSearch, the most accurate competing tool. Querying 1,000 held-out assemblies on 48 CPU threads takes 2 minutes 28 seconds at 3.7 GB peak RAM, versus 5 minutes and 81.2 GB for the best GSearch configuration. Macro-averaged species-level precision, recall, and F1 are 0.993, 0.990, and 0.991 against 0.996, 0.995, and 0.995 for that configuration; at genus level PanSpace reaches 0.999 on all three.
The intended users are clinical microbiology and food-safety labs that need to name the organism in a draft assembly quickly and locally. Because the index and encoder fit in a couple of gigabytes, a field or hospital lab can classify isolates without shipping data to a cluster, and the same machinery supports similarity search over pangenome collections for surveillance and strain tracking. The library can also train new encoders on other labelled genome collections, or as an autoencoder when labels are unavailable.
PanSpace shows that a learned embedding can substitute for genome sketching in taxonomic indexing at a fraction of the resource cost, within a few thousandths of the leading tool's accuracy. The tradeoff is not free: index construction took about 43 hours against 7.5 hours for the fastest GSearch mode, and generating the intermediate FCGR matrices for AllTheBacteria needs 480 GB of scratch space at k = 8 — a one-time cost borne by whoever builds an index, not whoever queries it. The code is GPL-3.0 licensed and the pretrained encoders, indexes, and data splits are archived on Zenodo under CC BY 4.0, so the full pipeline can be reproduced or rebuilt for a different reference database.
Much of this page is generated or calculated automatically. Flag anything that looks off and we will re-run it.