Predicting IBD using Microbiome data
An innovative approach for GI disease analysis involving gut microbiome datasets.
Summary of IBD Prediction Model
This project details the process of building and evaluating a predictive model for Inflammatory Bowel Disease (IBD) using microbial community data.
Dataset
The dataset consists of microbial abundance data (OTU tables) and associated metadata from four different IBD studies:
ibd_alm
ibd_engstrand_maxee
ibd_gevers_2014
ibd_huttenhower
The metadata includes information on the disease state of samples, which was standardized to create a binary label (IBD vs. non-IBD).
Process and Tools
Data Download and Extraction: The microbial and metadata files were downloaded from Zenodo and extracted from tar.gz archives.
Data Loading and Merging: Metadata and OTU tables from the four studies were loaded into pandas DataFrames. The metadata was combined, and the OTU tables were combined after aligning samples and including all taxa (filling missing values with zeros).
Data Preprocessing:
Missing values in the OTU table were imputed using the mean.
Features were scaled using StandardScaler.
The data was split into training and testing sets using train_test_split with stratification to maintain the proportion of IBD and non-IBD samples.
Model Training: An XGBoost classifier (xgb.XGBClassifier) was trained on the preprocessed data.
Model Evaluation: The model\‘s performance was evaluated using accuracy, precision, and recall metrics.
Feature Importance: The importance of microbial taxa in the original XGBoost model was analyzed and visualized.
Dimensionality Reduction and Feature Selection:
SelectKBest with f_classif was used to select the top 100 features based on univariate statistical tests.
Principal Component Analysis (PCA) was applied to the selected features to reduce dimensionality further to 50 components.
Model Retraining and Evaluation (Selected Features & PCA): The XGBoost model was retrained and evaluated using both the features selected by SelectKBest and the features transformed by PCA.
Saving Outputs: The trained models (original and with selected features), scaler, PCA transformer, transformed data, and feature importance data were saved for future use.
.
Analysis and Results
- Hypothesis: The study aimed to determine if microbial community composition can predict IBD status.
Initial Model Performance (All Features): The initial XGBoost model trained on all available features achieved good performance metrics:
Accuracy: 0.8776
Precision: 0.8958
Recall: 0.9773
- Feature Importance: The analysis of feature importance from the original model identified the top microbial taxa contributing to the prediction.
Feature importance chart
Model Performance (SelectKBest Features): Training the model on the top 100 features selected by SelectKBest resulted in slightly improved performance:
Accuracy: 0.8980
Precision: 0.8980
Recall: 1.0000
(Note: A RuntimeWarning about constant features and division by zero was encountered during SelectKBest, indicating some features may have had zero variance, but the selection and subsequent model training completed.)
Feature Importance (SelectKBest)
SelectkBest Chart
Model Performance (PCA Components): Training the model on the 50 PCA components derived from the SelectKBest features showed slightly lower performance compared to using the selected features directly:
- PCA Accuracy: 0.8571
- PCA Precision: 0.8936
- PCA Recall: 0.9545
- Normalization Attempts: Attempts were made to normalize the data by microbial family counts, but these were unsuccessful due to issues with aligning data structures after grouping and transposing.
- Conclusion: The results suggest that microbial community data can be used to predict IBD status, with the model trained on the top features selected by SelectKBest achieving the best performance in this analysis.
Source for dataset: Zenodo