Clustering microbiome sequences: 90% cluster homogeneity
We built a pipeline that groups microbiome sequences by their nucleotide order, separates human from bacterial sequences, and identifies the microorganisms present – with an average within-cluster homogeneity of 90%.
The situation
Changes in gut microbiota reveal how host and microbiome interact and can point to new options for therapeutic intervention. The route there runs through sequence data – and in raw form that data is barely interpretable: very many sequences, high similarity between them, no immediately visible order.
Two confounders sit in front of the biological analysis. First, samples taken from the human body inevitably mix host and bacterial sequences. Second, technical effects from sample processing create patterns that are easily mistaken for biological signal. Leave either untreated and you are interpreting artefacts.
The data
Samples were taken from the colon and consisted of stool and blood. Raw sequencing data was provided by the client as FASTQ files.
Methods
Unsupervised clustering with self-organizing maps. SOMs are a neural, unsupervised clustering method: they arrange sequences by nucleotide order so that similar sequences end up as neighbours, measured by Euclidean distance. Two properties were decisive for this project – SOMs can compensate for batch effects and control the false-positive rate caused by technical error. The advantage over predefined categories: the structure emerges from the data, including where no reference exists.
Separating host and bacterial genome with BLAST. BLAST finds similarities between biological sequences. We used it to separate human genome from bacterial genome – the step without which any subsequent analysis of microbial composition remains distorted – and then to identify the microorganisms present.
Making patterns visible. Heatmaps show which pattern dominates within a given cluster. The result is therefore not merely a grouping but an interpretable statement about the contents of each group.
Outcome
The SOMs produced clusters of high homogeneity: 90% on average within clusters. The neural representation made it possible to identify similarities across a large number of DNA sequences on the basis of Euclidean distance, and the heatmaps revealed the dominant pattern in each cluster.
The BLAST results yielded a detailed picture of the microorganism composition in the patients studied. Those results form the basis for further questions: host–microbiota interaction, the effect of medication, and the influence of environmental factors.
Transferability
The pattern – structure without supervision, remove confounders before the biological analysis, present results interpretably – reaches beyond microbiome analysis. It applies wherever large volumes of similar biological sequences or profiles have to be ordered before a question becomes answerable at all.
Today
Dependable standards have emerged in microbiome analytics since this project. We now work with nf-core/ampliseq in Nextflow: denoising to exact sequence variants with DADA2, taxonomy through QIIME2 against SILVA or GTDB, containerised and version-pinned so an analysis stays reproducible years later.
Host sequence removal no longer runs through BLAST but through targeted alignment against a human reference with minimap2 or Bowtie2 – faster and more complete.
Batch effects are handled with methods built for the purpose rather than as a side effect of clustering.
And where unsupervised structure is the goal, embeddings from genomic foundation models such as Evo 2 replace hand-built features, followed by density-based clustering that also recognises groups of differing size and density.
Last updated: 30 July 2026