Classification of Neisseria meningitidis genomes with a bag-of-words approach and machine learning

Marco Podda, Simone Bonechi, Andrea Palladino, Mattia Scaramuzzino, Alessandro Brozzi, Guglielmo Roma, Alessandro Muzzi, Corrado Priami, Alina Sîrbu, Margherita BodiniiScience 2024

TL;DR

This paper introduces a novel "bag-of-words" machine learning approach to classify bacterial genomes directly, bypassing traditional alignment methods. By encoding entire genomes as histograms of "words" (subsequences), they achieved high accuracy in classifying Neisseria meningitidis strains for capsule type (99.6%) and disease phenotype (90.2%), while also identifying potential virulence factors.

What Problem Does This Paper Address?

Classifying bacterial strains is crucial for understanding disease outbreaks, tracking antibiotic resistance, and developing vaccines. While whole genome sequencing provides a wealth of data, using entire genomes as input for machine learning (ML) models has been challenging due to their large size and the complexity of their structure. Traditional methods often rely on alignment, which is computationally expensive and struggles with variations in gene presence and assembly quality. Existing ML approaches for genomic analysis typically focus on specific regions or features, not the entire genome as a holistic input. This paper aims to bridge this gap by developing a method that can efficiently process and learn from complete bacterial genomes for classification tasks.

Methods

The core of this work is a "bag-of-words" approach adapted for genomic data. Here's a breakdown of the key techniques:

  • Genome Tokenization: Bacterial genomes are first broken down into smaller units, or "words." Two methods were explored:
  • SentencePiece (SP): An unsupervised subword tokenizer, similar to those used in natural language processing, which learns to segment sequences into variable-length tokens based on frequency.
  • k-mers: Fixed-length subsequences of the genome (e.g., 3-mers, 4-mers, etc.).
  • Bag-of-Words Encoding: After tokenization, each genome is represented as a histogram. This histogram counts the occurrences of each unique "word" (token) within the genome, effectively creating a "bag" of words where positional information is discarded.
  • TF-IDF Vectorization: To further refine the representation, Term Frequency-Inverse Document Frequency (TF-IDF) was applied. This method weighs the importance of each word by considering its frequency within a genome (TF) and its rarity across all genomes (IDF), helping to highlight more discriminative features.
  • Gradient Boosting Machine (lightGBM): A powerful ensemble learning algorithm was used as the classifier. lightGBM builds a model by sequentially combining multiple decision trees, optimizing for accuracy.
  • In Silico Knockouts: To validate the ML model's learning and identify biologically relevant genes, the researchers simulated the removal of specific genes or genomic regions. By observing how these knockouts affected the classification predictions, they could infer the importance of those genes for the phenotype being classified.
  • PCA and SHAP Analysis: Principal Component Analysis (PCA) was used to visualize genome similarity and identify potential biases, while SHAP (SHapley Additive exPlanations) was employed to understand which "words" (features) contributed most to the model's predictions.

The novelty lies in applying NLP-inspired tokenization (SentencePiece) and the bag-of-words approach to entire bacterial genomes for classification, combined with in silico gene knockouts for biological validation.

Datasets

The study utilized a large dataset of Neisseria meningitidis genomes:

  • Source: PubMLST database.
  • Initial Dataset: 25,959 non-complete N. meningitidis genomes with a sequence length of at least 1.5 Mbp.
  • Task-Specific Datasets:
    • Capsule Classification: 25,290 genomes, balanced for capsule type B (labeled 1) and non-B (labeled 0).
  • Disease Classification: 20,442 genomes, balanced for carrier (labeled 0) and invasive phenotypes (labeled 1).
  • Bias Mitigation: The datasets were resampled to reduce biases in assembly quality between different classes, ensuring a more robust training process.
  • Splitting: The final datasets were split into training, validation, and test sets for model development and independent evaluation.

Key Insights and Ideas

  • Genomes as Text: The fundamental insight is that entire bacterial genomes can be treated as "text" and processed using techniques borrowed from natural language processing, enabling a holistic view of genomic information.
  • SentencePiece's Advantage: SentencePiece proved more effective than k-mers for genome tokenization, likely due to its ability to create longer, more contextually relevant "words" and its efficiency in handling large vocabularies.
  • Bag-of-Words for Genomics: The bag-of-words approach, by ignoring positional information, elegantly sidesteps the computational burden of genome alignment, making rapid classification feasible.
  • ML for Biological Discovery: The in silico knockout experiments demonstrate that ML models trained on genomic data can not only classify phenotypes but also pinpoint genes that are biologically significant for those phenotypes, acting as a powerful tool for hypothesis generation.
  • Beyond Known Virulence Factors: The study identified several potential new virulence factors, highlighting the power of this approach to uncover novel biological insights that might be missed by traditional methods.

Key Results

  • High Classification Accuracy:
    • Capsule B group genotype: 99.6% accuracy on an independent test set.
  • Invasive phenotype: 90.2% accuracy on an independent test set.
  • Model Performance: The SentencePiece approach with an 8,000-word vocabulary was optimal for capsule classification, while a 32,000-word vocabulary was best for disease classification.
  • Capsule Locus Importance: In silico knockout of the capsule locus significantly altered capsule type predictions, confirming its critical role.
  • Virulence Factor Identification: Knocking out known virulence factors (VFs) also impacted disease phenotype predictions, with 52.8% of strains shifting to a carrier phenotype.
  • Novel VF Candidates: Analysis of gene knockouts identified 306 "relevant" genes, of which 44 were known VFs, and 6 were identified as potential new VFs based on their biological functions.
  • Outperforming Traditional Methods: The ML approach outperformed classification based solely on gene presence/absence (84.2% accuracy for disease).

Limitations and Future Work

  • Loss of Positional Information: The bag-of-words approach inherently discards positional information, which might be relevant for regulatory elements or gene interactions. The authors acknowledge this as a trade-off for computational efficiency.
  • Experimental Validation Needed: While in silico knockouts provide strong evidence, experimental validation (e.g., laboratory knock-in/knockout experiments) is crucial to confirm the role of identified potential virulence factors.
  • Incomplete VF List: The study acknowledges that the list of known virulence factors is not exhaustive, and other factors beyond VFs can influence invasiveness.
  • Future Directions:
    • Incorporating positional information into the bag-of-words approach, if computational power allows.
  • Applying this method to other bacterial species and for different classification tasks (e.g., antibiotic resistance, strain tracking).
  • Using the method for next-generation GWAS studies.
  • Further experimental validation of the identified potential virulence factors.

Summary updated

BibTeX
@inproceedings{podda2024classification,
  author = {Marco Podda and Simone Bonechi and Andrea Palladino and Mattia Scaramuzzino and Alessandro Brozzi and Guglielmo Roma and Alessandro Muzzi and Corrado Priami and Alina Sîrbu and Margherita Bodini},
  title = {{Classification of Neisseria meningitidis genomes with a bag-of-words approach and machine learning}},
  booktitle = {iScience},
  year = {2024},
  doi = {10.1016/j.isci.2024.109257},
}
Figure