1 Introduction
Chronic constipation (CC), a prevalent gastrointestinal motility disorder, is primarily categorized into slow-transit constipation (STC), normal-transit constipation (NTC), and defecatory disorder (DD). It affects an estimated 11%–20% of adults worldwide, posing a substantial socioeconomic burden and significantly impairing patients' quality of life [
1]. Accumulating evidence indicates that gut microbiota alterations contribute to the pathogenesis of CC. Patients with CC frequently exhibit microbial dysbiosis, including a reduced abundance of short-chain fatty acid (SCFA)-producing bacteria compared with healthy controls (HCs) [
2]. Depletion of key butyrate-producing genera such as
Coprococcus,
Faecalibacterium, and
Roseburia may compromise colonic motility by diminishing smooth muscle stimulation and serotonin release [
3]. Conversely, an increased abundance of
Bacteroides has been associated with delayed intestinal transit, potentially mediated by altered bile acid metabolism [
4] and enhanced gamma-aminobutyric acid (GABA) signaling [
5]. Although clinical diagnosis remains symptom-based, microbial biomarkers show prognostic potential, for example, lower levels of Ruminococcaceae predict a favorable response to probiotic or fiber interventions [
6].
Clinically, CC often co-occurs with psychiatric conditions, such as depression and anxiety, suggesting shared pathophysiological mechanisms [
7]. This connection is conceptualized within the gut–brain axis, a bidirectional communication network involving neural, endocrine, and immune pathways [
8]. Within this framework, the gut microbiota serves as a key modulator. Through the production of SCFAs, neurotransmitters, and other metabolites, it can influence intestinal function, neuro-inflammation, blood–brain barrier integrity, and central nervous system signaling, thereby affecting brain activity and behavior—a concept termed the microbiota–gut–brain (MGB) axis [
9,
10]. Although the MGB axis offers a plausible link between CC and psychiatric comorbidity, the specific molecular mediators remain poorly elucidated.
Current gut microbiome research in CC is marked by considerable heterogeneity and inconsistency, partly due to methodological variations across geography, sampling, sequencing, and bioinformatics [
11–
13]. For instance, although some studies report increased
Bacteroides in CC [
14], others observe a decrease [
15]. Moreover, most studies have examined CC or psychiatric disorders in isolation, leaving the microbial profile of their comorbidity largely uncharacterized. Significant knowledge gaps persist regarding the neuroendocrine mechanisms of host–microbe interactions, the spatiotemporal dynamics of gut microbial communities, and the validation of microbial biomarkers across diverse populations [
16]. Many existing studies are limited by single-center designs and modest sample sizes, which reduce statistical power to detect taxa with moderate effect sizes and often lack rigorous case–control comparisons [
17].Therefore, large, multi-cohort studies using standardized protocols are needed to identify reproducible microbial signatures.
Public databases provide a valuable resource for addressing these limitations by enabling integrated analysis of large, independent datasets [
18]. However, this resource remains underutilized for studying the gut microbiota in CC and psychiatric comorbidities. In this study, we utilized a large, curated 16S rRNA gene sequencing dataset from the public repository GMrepo [
19] as a discovery cohort, combined with an independent validation cohort from our center. Through integrated bioinformatics and machine learning, we conducted a robust, cross-population analysis to identify and validate conserved gut microbial dysbiosis signatures associated with CC and its psychiatric comorbidities. We built two machine learning models to screen for key microbial features that distinguish CC from controls and to characterize CC with psychiatric comorbidities. This dual-cohort approach enhances statistical power, tests generalizability, and explores mechanistic links within the MGB axis. Our findings aim to inform the development of diagnostic biomarkers and novel microbiome-targeted therapies for CC and its psychiatric comorbidities.
2 Materials and Methods
2.1 Study Design and Data Sources
The discovery cohort was constructed from curated human gut microbiome data available in the GMrepo database (gmrepo. humangut.info) [
19], encompassing a case–control comparison between patients with CC and HCs. GMrepo is among the most comprehensively manually curated databases for the human gut microbiome. It implements a stringent four-step quality control (QC) pipeline: (1) raw data QC; (2) MAPseq-based taxonomic assignment; (3) a secondary QC step requiring ≥20,000 reads per sample and a single-species relative abundance ≤ 99.99%; and (4) co-occurrence analysis using Spearman correlation combined with Fisher's exact test. A sample receives a “QC status = 1” designation only after successfully passing all four steps. In this study, we retrieved sample IDs with QC = 1 from GMrepo for both constipated patients and HCs. Notably, all retrieved samples originated from the American Gut Project (ENA accession: PRJEB11419), which employed a V4 region 16S rRNA Illumina sequencing protocol. After obtaining the corresponding raw FASTQ files, we performed read preprocessing using fastp (v0.20.0), yielding a median of 32,802 reads per sample, a median read length of 150 nucleotides (nt), and a Q30 score exceeding 95%. To correct for potential batch effects, we applied the “adjust_batch” function from the MMUPHin package. Specifically, we supplied the abundance matrix, along with metadata (including batch and covariates, such as gender, age, body mass index [BMI], and geographic distribution), while retaining the grouping variable (CC vs. HC) as a covariate to preserve biological variation. Based on the iteratively reweighted least squares (IRLS) algorithm, batch effects were separated from biological signals, and a batch-corrected abundance matrix was generated. For quality assessment, we performed PERMANOVA using Bray–Curtis dissimilarities; the final between-batch variation accounted for an
R2 of 5.05% [
20,
21], and samples clustered predominantly by group rather than by batch. The results were visualized using a principal coordinate analysis (PCoA) plot (Supporting Information S1: Figure S1). Subsequently, a feature table was constructed, and taxonomic annotation was performed using QIIME 2. The same annotation pipeline was applied to our in-house samples. Inclusion criteria for the discovery cohort were as follows: (1) adults aged 18–75 years with a confirmed CC diagnosis [
1]; (2) BMI of 18.5–24.9 kg/m
2; (3) availability of quality-controlled samples (QC = 1); and (4) availability of V4 16S rRNA gene sequencing data. Exclusion criteria included the following: (1) missing essential demographic or clinical metadata (gender, geographic origin, BMI, or comorbidity status); and (2) comorbid inflammatory bowel disease, severe enteric infections, or chronic infectious diseases [
22].
For participants in the public database, information on psychiatric comorbidities was extracted from physician-diagnosed medical histories collected via the baseline questionnaire of the American Gut Project. The targeted conditions included migraine, autism spectrum disorder (ASD), depression, bipolar disorder, schizophrenia, and attention-deficit/hyperactivity disorder (ADHD). Although no independent verification of these diagnoses was available—consistent with the inherent limitations of large-scale public cohorts—the questionnaire explicitly required participants to indicate conditions that had been formally diagnosed by a healthcare professional, thereby reducing the risk of lay self-misclassification. To operationalize psychiatric comorbidities, we adopted a hierarchical classification framework based on DSM-5 diagnostic criteria and contemporary epidemiological evidence. Neuropsychiatric disorders were grouped into the following categories: (1) neurodevelopmental disorders (ADHD and ASD); (2) mood disorders (major depressive disorder and bipolar disorder); (3) anxiety disorders; (4) psychotic disorders (schizophrenia and delusional disorder); (5) neurocognitive disorders (Alzheimer's disease and vascular dementia); (6) substance-related disorders (alcohol dependence and opioid use disorder); and (7) other related conditions (anorexia nervosa and epileptic psychosis). This categorization was used solely to define the presence of any psychiatric comorbidities, not to perform subtype-specific analyses, thereby maintaining statistical power and avoiding multiplicity issues. A methodological consideration was the status of migraine. According to the ICHD-11 criteria, migraine is primarily a neurological disorder; however, its high lifetime comorbidity with depression and anxiety [
23–
26], shared serotonergic dysregulation [
27–
29], and demonstrated links to MGB axis alterations have led to its routine inclusion in psychiatric comorbidity assessments in microbiome studies [
26,
30,
31]. To avoid fragmentation of the exposure construct and to capture shared psychoneurological pathways [
32,
33], we therefore included migraine as a psychiatric comorbidity indicator in this study. The CC cohort was subsequently stratified into the following: (1) CPD: CC with one or more psychiatric comorbidities (including migraine, ASD, depression, bipolar disorder, schizophrenia, or ADHD) [
34]; and (2) CNPD: CC without psychiatric comorbidities.
The independent validation cohort consisted of 14 HCs and 31 patients with STC, from whom paired stool microbial and metabolomic data were available. STC diagnosis required the following: (1) meeting Rome IV criteria [
35]; (2) age > 18 years and BMI of 18–25 kg/m
2; (3) colonic transit time > 48 h; (4) symptom duration > 1 year; and (5) refractoriness to conventional therapy (diet, enema, or biofeedback) within the prior 6 months. Exclusion criteria were as follows: (1) use of probiotics, prebiotics, synbiotics, antibiotics, or proton pump inhibitors (PPIs) within the preceding month; (2) incomplete demographic/clinical data; (3) secondary constipation; (4) history of gastrointestinal (GI) surgery or concurrent upper GI motility disorders; and (5) any condition potentially affecting intestinal transit or the microbiota. HCs were age-, weight-, and sex-matched, had no history of organic GI disease or recurrent GI symptoms, exhibited normal bowel habits, and had abstained from antibiotics/PPIs for ≥ 1 month. Fecal samples were immediately stored at −80°C. STC participants were further stratified into STC without anxiety/depression (CNPD) and STC with anxiety/depression (CPD) based on Zung’s Self-Rating Depression Scale (SDS) and Self-Rating Anxiety Scale (SAS) [
36]. Constipation symptoms and quality of life were assessed using the Patient Assessment of Constipation Symptoms (PAC-SYM) [
37] and Patient Assessment of Constipation Quality of Life (PAC-QOL) [
38] questionnaires.
2.2 Microbiome Sequencing Data Processing
Discovery cohort: Raw FASTQ files were quality-controlled using fastp (v0.20.0) [
39]. Subsequent analysis was performed in QIIME 2 (v2022.8) [
40]. Amplicon sequence variants (ASVs) were generated and taxonomically classified against the SILVA SSU rRNA database (v138.1) at 99% similarity [
41].
Validation cohort: Genomic DNA was extracted using the CTAB method [
42]. The V4 region of the 16S rRNA gene was amplified with primers 341F/806R. Libraries were prepared using the NEBNext Ultra DNA Library Prep Kit, and sequencing was performed on an Illumina NovaSeq platform (250-bp paired-end). Raw FASTQ files were processed with fastp (v0.20.0; Q20 > 98%, Q30 > 95%). Downstream analysis was the same as that described before.
2.3 Microbiome Data Analysis
All analyses were conducted in R (v4.2.3, Rproject.org/) using packages including “tidyverse,” “vegan,” “ggplot2,” “pheatmap,” “pROC,” “rmda,” “betacal,” “caret,” “glmnet,” “randomForest,” “xgboost,” and “e1071.”
Diversity and differential analysis: Alpha diversity (Shannon, Pielou's evenness, and richness) was compared using the Wilcoxon test. Beta diversity was assessed via Bray–Curtis and Hellinger distances, visualized by PCoA, and tested with PERMANOVA. Differential taxa were identified using the Wilcoxon test (false discovery rate [FDR]-adjusted
p < 0.1). Because of the exploratory design and the small CPD subgroup sample size (
n < 100), a nominal significance level of uncorrected
p < 0.1 was adopted in the subgroup analysis, taking biological plausibility into account [
43–
46]. Taxon set enrichment analysis (TSEA) was performed to identify enriched predefined microbial groups [
47].
Functional prediction: Microbial metabolic functions were predicted using PICRUSt2 [
48]. Differential abundance of pathways/enzymes (Enzyme Commission [EC], Kyoto Encyclopedia of Genes and Genomes [KEGG], and MetaCyc) was analyzed using the Wilcoxon test with FDR correction. Notably, PICRUSt2 predictions are known to have lower accuracy for archaea and other underrepresented clades; therefore, results involving such taxa (e.g.,
Methanomassiliicoccus and
Methanosphaera) are particularly tentative and require experimental validation.
2.4 Metabolomic Analysis
Fecal samples (1 mL) were lyophilized, reconstituted in prechilled 80% methanol, vortexed, and incubated on ice. After centrifugation (15,000 g, 4°C, 15 min), the supernatant was diluted to 53% methanol with LC-MS-grade water, recentrifuged, and the final supernatant was analyzed by LC-MS/MS. Detailed untargeted metabolomics methodology is provided in Supporting Information S1 [
49].
2.5 Machine Learning Modeling
Seven models were trained and evaluated: LASSO, ridge, Elastic Net, logistic regression, random forest, XGBoost, and support vector machine (SVM). Model performance was assessed by the following: (1) discrimination: area under the receiver operating characteristic curve (AUC) for classifying CC versus HC and CPD versus CNPD; (2) calibration: Brier score (mean squared difference between predicted probabilities and observed outcomes); and (3) clinical utility: decision curve analysis (DCA) to calculate net benefit across probability thresholds. Clinical impact curves visualized the number of high-risk patients versus true events across thresholds. The optimal classification threshold was determined by the Youden index.
2.6 Model Construction and Tuning
All hyperparameter tuning was performed exclusively on the training cohort using 5-fold cross-validation (CV) without access to the external validation set, ensuring unbiased model selection [
50,
51]. For SVM, grid search with fivefold CV AUC was implemented via e1071::tune.svm [
52]. LASSO and ridge employed glmnet::cv.glmnet to automatically select the
λ minimizing binomial deviance [
53,
54], whereas Elastic Net additionally performed a grid search over
α. Random forest was tuned over mtry to maximize CV AUC using caret or manual iteration [
55]. XGBoost utilized early stopping in xgb.cv combined with grid search to determine the optimal number of rounds [
52,
56] (Supporting Information S1: Table S1). For logistic regression, a 5-fold CV grid search over λ (logarithmic grid, 0.001–0.1, 30 points) was performed optimizing AUC, and the λ minimizing CV AUC (λmin) was selected. For the CC versus HC comparison, 29 shared genera were retained after differential analysis, with a training set of 478 samples (239 HCs and 239 CC) and an external validation set of 45 samples (14 HCs and 31 CC). For CPD versus CNPD within CC, 29 shared genera were retained, with a training set of 239 patients with CC (164 CNPD and 75 CPD) and an external validation set of 31 patients with CC (12 CNPD and 19 CPD). Final model performance (AUC, sensitivity, and specificity) was assessed in the independent local cohort [
55,
56].
2.7 Statistical Analysis
Baseline characteristics were analyzed in R. Continuous variables were reported as mean ± standard deviation (SD) (parametric, Student's t-test) or median (interquartile range [IQR]) (nonparametric, Wilcoxon test), after normality assessment (Shapiro–Wilk test). Categorical variables were compared using χ2 or Fisher's exact tests. Propensity score matching (PSM) was performed using the MatchIt (v4.5.0) and Cobalt (v4.5.1) packages to balance the cohorts.
2.8 Ethical Approvals and Statements
Data for the discovery cohort were obtained from the public GMrepo database under its open-data license; all original studies complied with their respective institutional review board approvals and informed consent requirements. The validation cohort study was approved by the Ethics Committee of the First Affiliated Hospital of Nanjing Medical University (Approval Number: 2021 SR-328) on July 27, 2021. All procedures were performed in accordance with the ethical standards of the institutional research committee and with the 1964 Helsinki Declaration and its later amendments.
3 Results
3.1 Demographic Characteristics and Baseline Comparisons
Using “constipation” as the search term, raw 16S rRNA gene sequencing data from fecal samples with complete baseline information were retrieved and downloaded from the GMrepo database. Initially, 720 HCs and 277 patients with CC were identified. PSM based on baseline characteristics yielded 239 matched pairs between the HC and CC groups. For external validation, a separate cohort was recruited from patients with CC treated in our outpatient clinic. After matching for baseline characteristics, 14 HCs and 31 patients with CC were included, reflecting the limited available sample size. Detailed baseline information is summarized in Supporting Information S1: Tables S2 and S3.
3.2 Impact of CC on Gut Microbiota: Diversity, Differential Genera, and Functional Alterations
In the discovery cohort, CC altered the gut microbiota primarily through a redistribution of relative abundance rather than extensive species replacement. Alpha diversity was significantly reduced, as evidenced by decreases in the Shannon index (p = 0.034; Figure 1A) and Pielou's evenness (p = 0.012; Figure 1C), whereas species richness remained unchanged (p = 1; Figure 1B), which indicated preserved richness but reduced community evenness. Beta-diversity analysis revealed a subtle yet statistically significant separation between groups (R2 = 1.1%, p = 0.001; Figure 1D,E). At the genus level, 40 differentially abundant taxa (FDR < 0.1; Figure 1F,G) were identified: 14 increased and 26 decreased. Enriched genera, typically of low abundance in controls (average < 0.1%) such as [Clostridium]_innocuum_group, Frisingicoccus, and Hungatella, increased by ≥3-fold, with Methanomassiliicoccus (FDR = 0.03) showing even greater expansion. In contrast, several core beneficial genera, including Agathobacter, Faecalibacterium, Roseburia, Blautia, and Coprococcus, declined by 28%–83%. Allobaculum was absent in the CC group, whereas Paracoccus was exclusively detected in CC.
TSEA indicated widespread downregulation of beneficial functions. SCFA-producing genera, including butyrate, propionate, acetate, and total SCFA producers, were significantly reduced (minimum FDR = 0.00066; Figure 1H,I). Fiber-degrading and barrier-protective taxa were also diminished (FDR = 0.047). Anti-inflammatory profiles showed bidirectional shifts: Conventional anti-inflammatory genera (e.g., Bifidobacterium, Blautia, and Roseburia) decreased, whereas others (e.g., Akkermansia, Eubacterium, and Lactobacillus) increased (FDR = 0.097), suggesting a complex regulatory response and an overall shift toward a proinflammatory functional state. Collectively, CC remodeled the gut microbiota by suppressing core beneficial genera and expanding certain low-abundance taxa, resulting in reduced evenness and impaired functions related to SCFA production, fiber degradation, barrier protection, and anti-inflammatory activity.
In the external validation cohort, alpha diversity was also significantly reduced in the CC group, with observed species decreasing by approximately 33% (p < 0.001; Supporting Information S1: Figure S2B) and the Shannon index declining markedly (p = 0.014; Supporting Information S1: Figure S2A). Unlike the discovery cohort, Pielou’s evenness remained unchanged (p = 0.65; Supporting Information S1: Figure S2C), indicating that the reduction in Shannon diversity was driven by the loss of species richness rather than evenness. Thus, microbial alteration in this cohort was characterized primarily by species loss. Beta-diversity analysis (p ≤ 0.01; Supporting Information S1: Figure S2D,E) showed that group assignment explained 5.1%–6.3% of the variance, a stronger effect than that in the discovery cohort (R2 = 1.1%), suggesting more pronounced dysbiosis. At FDR < 0.1, 199 differentially abundant genera were identified: 178 down-regulated and 21 upregulated. Downregulated taxa included core commensals (e.g., Faecalibacterium and Roseburia) and several environment-derived genera, implying substantial disruption of the intestinal environment. Upregulated genera included Lactobacillus, Collinsella, and low-abundance potential opportunists. TSEA showed no significant functional enrichment, likely due to the dispersed loss of rare taxa and incomplete database annotations. To further assess functional changes, PICRUSt2 was used to predict pathway differences.
The two cohorts exhibited distinct dysbiosis patterns: The discovery cohort showed reduced evenness with stable richness, reflecting suppression of beneficial core genera, whereas the external cohort displayed markedly reduced richness with stable evenness, indicating extensive species loss with limited compensatory increase. This heterogeneity may arise from demographic (Western vs. Chinese) and clinical subtype differences (multiple subtypes vs. only STC). Despite these patterns, both cohorts shared decreased abundance of key SCFA producers (e.g., Faecalibacterium and Roseburia), pointing to a common impairment in microbial metabolic function. Although TSEA was not significant in the external cohort, PICRUSt2 provided functional validation. In the discovery cohort, the observed reduction in functional potential aligned with lower fecal SCFA levels, supporting CC-associated functional alterations at the metabolite level.
3.3 Functional Profiling Reveals Widespread Metabolic Deterioration in the Gut Microbiota of the Constipation Cohort
Functional prediction analysis was conducted using PICRUSt2 on 16S rRNA gene sequences from the discovery cohort. It should be noted that PICRUSt2 infers functional potential based on reference genomes rather than directly measuring expressed functions. This analysis identified 4745 predicted EC functions that were significantly different between the CC and HC groups (Figure 2A). Of these, 3033 were downregulated and 1712 were upregulated, indicating a marked predicted functional decline consistent with the observed reduction in microbial diversity. Downregulated predicted functions were primarily enriched in three core categories: (1) central energy metabolism, including ATP synthase subunits, glycolytic enzymes (pgk, pyk, and gapA), tricarboxylic acid (TCA) cycle enzymes (gltA, icd, and sucAB), and enzymes for SCFA synthesis (ackA, buk, and pta); (2) vitamin biosynthesis, encompassing pathways for vitamins B12 (cob/cbi series), B1 (thi series), B6 (pdx), and biotin (bio); and (3) nitrogen, sulfur, and metal metabolism, such as enzymes related to nar, cys, ent, and cop. In contrast, the fewer upregulated functions were largely associated with antibiotic resistance (aph3-III), multidrug efflux pumps (acr/tolC), and heat shock proteins (dnaK and groEL), collectively suggesting a microbial stress response.
At FDR < 0.05, 169 KEGG pathways showed differential abundance (94 downregulated and 75 upregulated). Upregulated pathways were linked to basic biosynthesis, genetic information processing (ribosome, RNA polymerase, and DNA repair), limited vitamin synthesis (pantothenate and thiamine), and stress signaling (AMPK and HIF-1). However, their upregulation was modest (log2FC predominantly between 0.005 and 0.08; Figure 2B), indicating only limited compensatory adaptation. Conversely, downregulated pathways exhibited more substantial declines (log2FC up to −0.15) across broad functional domains: energy metabolism (oxidative phosphorylation and nitrogen/sulfur/methane metabolism), fatty acid synthesis and degradation, butyrate/propionate metabolism, cellular structure (lipopolysaccharide synthesis, secretion systems, and two-component systems), xenobiotic degradation (benzoate, toluene, and naphthalene), and host-interaction pathways (bile and pancreatic secretion). These findings point to extensive impairment in the predicted core metabolic and adaptive capacities of the microbiota. MetaCyc pathway analysis corroborated this trend (127 downregulated vs. 101 upregulated; Figure 2C). Key downregulated MetaCyc pathways included the following: (1) core energy metabolism (TCA cycle variants, glycolysis, oxidative phosphorylation, and fatty acid β-oxidation); (2) aromatic compound degradation (phenylpropionate, toluene, and catechol); (3) cofactor biosynthesis (pyridoxal phosphate, menaquinone/ubiquinone, heme, biotin, and de novo B12); (4) specific amino acid metabolism (methionine/phenylalanine synthesis and arginine/histidine degradation); and (5) stress signaling (ppGpp synthesis) and exopolysaccharide synthesis (enterobacterial common antigen and colanic acid). Upregulated MetaCyc pathways focused on amino acid/nucleotide biosynthesis, cofactor salvage (e.g., adenosylcobalamin), specific fermentation routes (pyruvate to isobutanol and lactate), and cell-wall synthesis (peptidoglycan), reflecting attempts to maintain basic cellular supplies under stress. In summary, the gut microbiota in the discovery CC cohort exhibited extensive predicted functional deterioration. Core energy metabolism, detoxification capacity, and vitamin synthesis were broadly suppressed, with only limited compensatory upregulation in basic biosynthesis and stress-response pathways. These predicted functional alterations, if confirmed by metatranscriptomic or metabolomic measurements, suggest that the overall metabolic decline likely compromises intestinal homeostasis.
In the independent validation cohort, the CC group consistently exhibited distinct predicted functional alterations compared with HCs, marked by a predicted shift from a “homeostatic growth” profile toward a “stress-responsive and competition-adapted” state. Specifically, there was an increased abundance of predicted functions related to bacterial motility (flagellar assembly and chemotaxis), quorum sensing, biofilm formation, virulence and secretion systems, stress response, secondary metabolism, and xenobiotic degradation. In contrast, core processes such as genetic information processing, central carbon and energy metabolism, and fundamental biosynthesis were downregulated (Supporting Information S1: Figure S4A). Pathway analyses (KEGG and MetaCyc; Supporting Information S1: Figure S4B,C) further indicated these trends: upregulated pathways included those involved in motility, biofilm formation, secretion, secondary metabolite synthesis, and degradation of aromatic/xenobiotic compounds, whereas ribosome function, DNA replication, glycolysis, and amino acid/nucleotide biosynthesis were downregulated.
Functional patterns differed between the discovery and validation cohorts. The discovery cohort showed broad depletion in predicted core metabolic and detoxification functions, aligning with a loss of beneficial taxa. In contrast, the validation cohort displayed predicted functional restructuring—downregulation of basal biosynthesis together with pronounced upregulation of competitive and defensive traits—consistent with reduced species richness and expansion of opportunistic genera. These differences may reflect variations in population origin and constipation subtype. Notably, both cohorts shared suppression of key beneficial predicted functions, such as SCFA synthesis.
Moreover, upregulated functions in the validation cohort were often linked to potential pathogenicity. Collectively, these results demonstrate that CC is consistently associated with detrimental functional alterations in the gut microbiota across independent cohorts. However, as these findings were derived from in silico predictions (PICRUSt2) rather than direct functional measurements, they should be interpreted with caution and require validation by metatranscriptomic or metaproteomic/metabolomic approaches in future studies.
3.4 Machine Learning-Based Distinction Between CC and HCs and Identification of Key Genera
To explore microbial biomarkers distinguishing CC from HCs, we constructed seven machine learning models based on differentially abundant bacterial genera (Figure 3A). These included linear methods (logistic regression, ridge, LASSO, and Elastic Net regression), nonlinear models (SVM and random forest), and gradient boosting trees (XGBoost). After evaluating discrimination, generalizability, and calibration, SVM achieved the highest overall discrimination (AUC = 0.712; Figure 3A), followed by LASSO (0.668), Elastic Net (0.647), logistic regression (0.604), ridge (0.597), random forest (0.532), and XGBoost (0.520). SVM demonstrated balanced performance with moderate specificity (0.857) and sensitivity (0.548). In contrast, XGBoost showed moderate sensitivity (0.774) but very low specificity (0.071), resulting in a high false-positive rate. Given the high-dimensional, low-effect microbiome data (PERMANOVA R2 ≈ 5%–6%; Supporting Information S1: Figure S2D,E), the margin-maximizing design of the SVM helps mitigate overfitting, whereas the feature selection of LASSO may omit community-level information, and tree-based models likely overfit due to the limited sample size.
After Platt-scaling calibration, the SVM exhibited improved but still imperfect calibration (intercept = 0.166, slope = 1.192; Supporting Information S1: Figure S5A and Table S4). Decision curve analysis indicated a positive net benefit within a narrow range of threshold probabilities (0.23−0.30; Figure 3B,C), where false positives could be reduced by approximately 36% at a cost of only 6% fewer true positives. Internal CV (AUC = 0.657; Figure 3D,E) and external validation (AUC = 0.712; Figure 3E) confirmed that the calibrated SVM provided only modest, research-level discriminative ability (AUC ≈ 0.71). Notably, an AUC of 0.71 is generally considered insufficient for clinical decision-making or screening purposes, where an AUC ≥ 0.80 is typically expected. Therefore, this model should be viewed as a hypothesis-generating research tool or a risk indicator rather than a clinically actionable classifier.
SHapley Additive exPlanations (SHAP) analysis identified the top 20 discriminatory genera (Figure 3F,G), led by Agathobacter (importance = 0.020) and Faecalibacterium (0.018). The top 5 genera also included Lachnospiraceae_FCS020_group, Lachnospiraceae_NK4A136_group, and Lachnospiraceae_UCG-004. Most key genera (e.g., Subdoligranulum and Coprococcus) belonged to the families Lachnospiraceae or Ruminococcaceae, which are crucial for SCFA production and gut homeostasis. The prominence of butyrate-producing, anti-inflammatory Faecalibacterium highlighted its potential role in CC-associated dysbiosis, offering promising targets for mechanistic investigation but not for immediate clinical translation.
3.5 Multidimensional Associations Between Gut Microbiota, Metabolites, and Clinical Symptoms in CC
Building upon 20 key bacterial genera selected by SVM, we constructed a multidimensional network linking gut microbiota, fecal metabolites (SCFAs and tryptophan derivatives; Figure 4A–C), and clinical symptoms in CC. This integrative approach delineated potential microbe–metabolite–symptom axes in CC pathogenesis. Correlation analysis revealed 149 significant microbiota–metabolite relationships (Figure 4D,E). Faecalibacterium, for instance, correlated with 19 metabolites, displaying positive associations with 5-hydroxyindole-3-acetic acid (5-HIAA; r = 0.39), acetate (r = 0.49), glycitein (r = 0.55), N-methyltryptamine (r = 0.41), and thromboxane B2 (r = 0.46). Agathobacter showed a strong positive correlation with N-methyltryptamine (r = 0.61). Notably, N-methyltryptamine was positively associated with butyrate-producing genera (Agathobacter, Faecalibacterium, and Fusicatenibacter), but negatively associated with CHKCI002, suggesting synergistic bacterial roles in generating neuroactive and/or anti-inflammatory metabolites.
Certain genera appeared potentially protective. The abundance of Lachnospiraceae_UCG-004 and Coprococcus inversely correlated with abdominal (r = −0.43; Figure 4F) and rectal symptoms (r = −0.41), aligning with their positive links to metabolites such as capsaicin and 6-monoacetylmorphine. Acetate was significantly negatively associated with overall CC severity (CSS: r = −0.60; Figure 4G), total symptom score (PAC-SYM: r = −0.48), and rectal symptoms (r = −0.40), supporting its protective role via anti-inflammatory and barrier-enhancing mechanisms. Butyrate producers such as Faecalibacterium, Coprococcus, and Roseburia also generated acetate, further highlighting potential SCFA-mediated mucosal protection. Although tryptophan metabolites such as 5-HIAA did not reach statistical significance in symptom correlations, a negative trend suggested their possible modulatory influence.
Together, this analysis uncovers complex, interlinked microbiota–metabolite–symptom networks in CC, emphasizing microbial contributions to neuroactive metabolite pathways. These insights offer a mechanistic basis for exploring the gut–brain axis in CPD and developing microbiota-targeted interventions.
3.6 Effects of CPD on Gut Microbiota: Perspectives From Diversity, Taxon Shifts, and Functional Potential
In the discovery cohort, alpha diversity (observed, Shannon, and Pielou; Figure 5A–C) and beta diversity (PERMANOVA, p > 0.05; Figure 5D,E) did not differ significantly between the CPD and CNPD groups. This absence of overall structural difference may partly reflect limited statistical power, given the smaller sample size in the CPD group (n = 75). Nevertheless, exploratory genus-level analyses (p < 0.1; Figure 5F,G) revealed several compositional shifts in CPD, including decreased abundance of Bifidobacterium (log2FC = −1.01, p = 0.006), Coprococcus (log2FC = −0.67, p = 0.048), Lachnospiraceae_ND3007_group (log2FC = −0.96, p = 0.026), and [Eubacterium]_fissicatena_group (log2FC = −0.96, p = 0.048). In contrast, Streptococcus (log2FC = 1.52, p = 0.058) and Methanosphaera (log2FC = 4.31, p = 0.018) were relatively enriched. This pattern suggests a potential reduction in beneficial SCFA-producing taxa, alongside an increase in opportunistic or methanogenic organisms. In line with this, TSEA indicated a declining trend in functional groups related to SCFA production (p = 0.055; Figure 5H,I).
Similarly, in the external validation cohort, no significant differences in alpha or beta diversity were detected (Supporting Information S1: Figure S3A–E). Exploratory analysis identified 21 genera with altered abundance (Supporting Information S1: Figure S3F,G). Notable increases in CPD included Pseudomonas (log2FC = 24.13, p = 0.037), Acidaminococcus (log2FC = 6.58, p = 0.010), Megamonas (log2FC = 3.69, p = 0.037), and Bifidobacterium (log2FC = 1.62, p = 0.059). Decreases were observed for Amnipila (log2FC = −24.44, p = 0.027), [Eubacterium]_hallii_group (log2FC = −1.19, p = 0.014), and Coprococcus (log2FC = −1.16, p = 0.078). Correspondingly, TSEA indicated stronger enrichment of butyrate-, propionate-, and SCFA-producing taxa, such as Coprococcus and [Eubacterium]_hallii_group, in the CNPD group.
In summary, although no large-scale structural differences in the gut microbiota were observed, possibly due to sample size limitations, exploratory analyses across both cohorts indicated that CNPD may be enriched with SCFA-producing genera. In contrast, CPD appeared to be associated with relative increases in potential opportunistic and fermentative taxa. Functional enrichment results further supported a stronger SCFA synthesis potential in CNPD. These preliminary findings offer initial insights into microbial differences between the CC subtypes (CPD vs. CNPD) and highlight the need for validation in larger cohorts. Together, they lay a foundation for investigating whether such microbial shifts are linked to the co-occurrence of mental disorders in CPD, informing subsequent functional prediction analyses.
3.7 Functional Profiling Reveals Metabolic and Stress-Adaptive Reprogramming in CPD-Associated Microbiota
Given the limited sample size and the absence of significant structural differences between the CPD and CNPD groups, we conducted functional prediction analysis (PICRUSt2) using an exploratory threshold (p < 0.1) to identify potential functional alterations in the microbiota. In the discovery cohort, EC analysis revealed bidirectional changes in predicted core metabolic pathways (Figure 2D). (1) Metabolic reprogramming. Enzymes involved in SCFA metabolism were differentially regulated; for instance, propionate kinase (pduW) was upregulated, whereas glutaryl-CoA dehydrogenase (acd) was downregulated, suggesting a predicted shift in SCFA flux. Pathways for aromatic compound degradation (benA-xylX and pcaL) were generally enhanced, whereas sporulation-related genes (cot and spo) were suppressed. (2) Transport and signaling. ATP-binding cassette (ABC) transporters showed divergent expression, whereas major facilitator superfamily (MFS) transporters (e.g., mmr) were upregulated. Two-component systems (e.g., mtrB and flrB) and transcriptional regulators (kdgR, galR, acrR, and ramA) indicated remodeled environmental sensing and regulatory networks. (3) Energy metabolism. Genes encoding respiratory chain complexes (e.g., qoxABCD) and hydrogenases (hoxF) were downregulated. KEGG pathway enrichment (20 pathways: 10 downregulated and 10 upregulated; Figure 2E) highlighted immune-inflammatory modulation (e.g., systemic lupus erythematosus, sphingolipid signaling, and apoptosis), downregulated energy metabolism (pyruvate and propanoate metabolism), and altered cellular processes (retrograde endocannabinoid signaling and quorum sensing). MetaCyc analysis (23 pathways: 17 upregulated and 6 downregulated; Figure 2F) further indicated upregulation of arginine biosynthesis and sugar degradation pathways, alongside downregulated biosynthesis of aspartate-family amino acids.
Analysis of the external validation cohort reinforced stress-adaptive signatures in CPD (Supporting Information S1: Figure S4D–F), including the following: (1) enhanced iron acquisition (upregulation of predicted heme/siderophore transport genes chu, efe, and hem); (2) cell-surface remodeling (upregulated predicted LPS/capsular polysaccharide synthesis genes rfa/waa and wca); (3) a shift toward anaerobic respiration (downregulation of V/A-ATPase; upregulation of predicted cytochrome fbcH/ccoNO and hydrogenase hya/hyb); (4) activation of stress-defense pathways (proteasome, glutathione metabolism, peroxisome, and cytochrome P450; enrichment in ferroptosis); and (5) suppression of secondary metabolism and cofactor synthesis (e.g., downregulation of predicted adenosylcobalamin and porphyrin pathways).
Together, functional predictions across both cohorts suggest coherent metabolic reprogramming and stress-adaptive traits in CPD-associated microbiota, characterized by redistributed SCFA flux, enhanced aromatic degradation, activated iron uptake, surface remodeling, and induced antioxidant defenses. These predicted functional shifts correspond with previously observed reductions in SCFA-producing taxa, supporting the view that CPD-related microbial alterations are primarily functional rather than structural. Overall, the findings establish a hypothesis-generating functional basis for subsequent mechanistic and targeted metabolomic studies, while providing a rationale for identifying key bacterial genera for building a combined CPD model. Importantly, because these results were derived from in silico predictions (PICRUSt2) rather than direct functional measurements, they should be interpreted with caution. Independent validation using metatranscriptomic, metaproteomic, or metabolomic approaches is required to confirm the inferred functional changes. Further validation in larger cohorts remains necessary.
3.8 Machine Learning Discrimination of CPD and Key Bacterial Genera Screening
To differentiate between CC subtypes (CPD vs. CNPD), seven machine learning classifiers—LASSO, ridge, Elastic Net, logistic regression, random forest, XGBoost, and SVM—were trained (Figure 6A) and optimized via 5-fold CV using data from 239 patients (Figure 6B). Model performance was evaluated on an independent external validation set (n = 31) based on discrimination, calibration, and clinical utility (Supporting Information S1: Figure S5B–E). During CV (Supporting Information S1: Figure S5F), Elastic Net achieved the highest mean AUC (0.672 ± 0.053) and the lowest Brier score (0.204 ± 0.022), indicating modest discriminatory ability and relatively better calibration. In external validation, both uncalibrated Elastic Net and LASSO achieved an AUC of 0.671, but Elastic Net demonstrated a lower Brier score (0.440 vs. 0.515); the other models showed limited discrimination.
To improve reliability, Platt scaling was applied to calibrate the predicted probabilities of LASSO and Elastic Net (Supporting Information S1: Figure S5B). After calibration, Elastic Net +Platt achieved the best overall performance, with an AUC of 0.671, sensitivity of 0.842, accuracy of 0.710, and a Brier score of 0.223. DCA across the threshold range of 0.2–0.4 indicated that Elastic Net + Platt provided a modest net benefit compared to the other models and reference strategies (Supporting Information S1: Figure S5C,D), but the benefit was observed only within a narrow range of risk thresholds. Clinical impact curves showed that the calibrated model could identify high-risk cases (19/19 CPD patients detected at thresholds ≤ 0.46; Supporting Information S1: Figure S5E), whereas uncalibrated models markedly underestimated risk. It should be noted, however, that an AUC of 0.67 is generally considered insufficient for clinical decision-making or screening. Therefore, the current model should be viewed as a hypothesis-generating risk indicator rather than a clinically actionable classifier.
Reevaluation through CV reaffirmed the relative stability of Elastic Net with Platt scaling (Figure 6B; Supporting Information S1: Figure S5F,G), establishing it as the optimal classifier for distinguishing CPD from CNPD, albeit with only modest discrimination (AUC = 0.671) and imperfect calibration (Brier score = 0.223). SHAP-based interpretation of the calibrated Elastic Net and LASSO models revealed high consistency among the top 20 discriminative bacterial genera (Figure 6C–F), with congruent directional shifts, such as increased abundance of Cutibacterium and Bryobacter and decreased abundance of Paracoccus and [Eubacterium]_fissicatena_group, which is consistent with prior differential analyses.
The robustness of these key genera across models underscores their potential as microbial signatures for CC subtyping (CPD/CNPD), supporting further mechanistic investigation. This integrated machine learning and interpretability framework advances the understanding of the gut microbiota in CC phenotypes but does not yet provide a clinically validated tool. Future work should incorporate larger, multicenter cohorts and additional clinical covariates to improve model performance and calibration before any clinical application can be considered.
4 Discussion
This cross-population fecal microbiota study identified distinct alterations in the gut microbial ecosystem of patients with CC. Intriguingly, these dysbiotic features demonstrated partial overlap with those observed in patients with CC and CPD. Employing two tailored machine learning frameworks, we pinpointed bacterial genera possessing diagnostic potential for distinguishing CC from HC and CPD from its nonpsychiatric counterpart (CNPD). Predicted functional inference of the community metagenome using PICRUSt2 suggested metabolism-centric pathogenic mechanisms, highlighting specific MGB axis-associated molecules, such as SCFAs, 5-HIAA, and L-arginine, which may be implicated in CC pathogenesis and its psychiatric comorbidities.
Patients with CC demonstrate gut microbial dysbiosis marked by structural disruption and functional decline [
3]. In both the discovery and validation cohorts, alpha diversity was significantly reduced, although through distinct patterns—one cohort showed reduced evenness (suggesting suppression of beneficial taxa), whereas the other exhibited reduced richness (implying broader microbial depletion). Beta-diversity analysis confirmed clear separation from HC. This dysbiosis was characterized at the genus level by depletion of core SCFA producers (e.g.,
Faecalibacterium,
Roseburia, and
Agathobacter) and expansion of methanogens such as
Methanomassiliicoccus [
3,
14,
57], representing a shift from a “pro-motility” to a “hypo-motility” microbial configuration that is intimately linked to enteric nervous system (ENS) dysfunction [
58]. Functional prediction via PICRUSt2 corroborated these findings, revealing widespread downregulation of energy metabolism, vitamin synthesis, and detoxification pathways, alongside upregulation of stress-related functions (e.g., antibiotic resistance). If these predicted functional changes are confirmed by direct measurements (e.g., metatranscriptomics or metabolomics), they would have the following pathophysiological consequences: impaired SCFA production may contribute to an “energy crisis” in enteric neurons; reduced B vitamin synthesis might limit neurotransmitter production; and deficient detoxification could expose the ENS to oxidative stress and inflammatory cytokines resulting from intestinal barrier compromise [
58–
61]. Importantly, these are inferred associations based on genomic potential and cross-sectional data; they do not demonstrate causation. Collectively, these predicted alterations would inhibit excitatory motor neurons and stall intestinal transit, consistent with the hypothesis that a self-perpetuating gut microenvironment of impaired metabolism and proinflammation explains the protracted and refractory nature of STC [
62,
63]. Experimental models (e.g., SCFA supplementation or microbiota transplantation in constipated animals) are required to test whether restoring these functions directly improves motility.
Interestingly, although CPD did not exhibit significant structural differences from CNPD, likely due to the limited sample size and insufficient statistical power to detect subtle compositional shifts [
64], it displayed distinct predicted functional reprogramming [
65]. This included altered SCFA metabolic flux, enhanced degradation of aromatic compounds, upregulated iron acquisition pathways, and activated stress-defense systems. These predicted adaptations suggest that CPD involves a microbial response to host-derived stress rather than wholesale community reorganization [
66]. Importantly, these predicted functional changes may engage the MGB axis: Enhanced degradation of aromatic compounds has been reported to alter the availability of neuroactive precursors (e.g., tyrosine for dopamine and tryptophan for serotonin), whereas upregulated iron competition and stress defenses are known to accompany a proinflammatory milieu that can sensitize afferent nerves and compromise the integrity of the ENS [
67–
70]. Nevertheless, these mechanistic links remain hypothetical at this stage. Despite its distinct functional trajectory, CPD converged on the same core pathogenic mechanisms underlying CC, namely, impaired microbial support for ENS function [
71], sustained neuroimmune activation, and perpetuation of the “hypo-motility, proinflammation” homeostatic trap. This suggests that microbial contributions to MGB axis dysfunction in CC may extend beyond compositional shifts to encompass dynamic metabolic adaptations that collectively reinforce disease chronicity [
72]. To establish causality, future studies should employ metatranscriptomics to assess actual gene expression and animal models to test whether the identified functional pathways directly influence behavior or gut transit.
Using tailored machine learning models, we explored potential microbial biomarkers for CC and its psychiatric comorbidities. First, an SVM model moderately discriminated patients with CC from HCs (AUC = 0.712, specificity = 0.857), with SHAP analysis identifying a signature of 20 discriminative genera, predominantly SCFA producers such as
Agathobacter and
Faecalibacterium. This signature may capture the functional essence of CC dysbiosis: the depletion of taxa essential for SCFA production and immune modulation is predicted to directly compromise enteric neuronal energy metabolism and gut motility via the MGB axis [
59]. However, an AUC of 0.71 is generally considered to indicate limited discriminative capacity; clinical screening tools typically require an AUC ≥0.80. Second, to address clinical heterogeneity, an Elastic Net model with Platt scaling distinguished CPD from CNPD (AUC = 0.671), revealing a stable signature featuring upregulated
Cutibacterium and downregulated
Paracoccus. This predicted functional reprogramming, related to altered neuroactive metabolite processing and stress adaptation, suggests that psychiatric comorbidities in CC may involve distinct microbial adaptations along the gut–brain axis without requiring wholesale structural reorganization [
73–
75]. Again, the AUC of 0.67 falls well below the threshold for clinical utility, and the model should be interpreted as an exploratory tool for generating hypotheses rather than for direct clinical decision-making. Notably, given the high-dimensional nature of microbiome data and our relatively modest sample size, deep learning approaches were not pursued, as they typically require substantially larger cohorts to avoid overfitting and ensure generalizability [
64]. Instead, our selected models (SVM and Elastic Net) provided an optimal balance of interpretability, robustness, and predictive performance for hypothesis-driven biomarker discovery in this research context. Collectively, these models link discrete microbial signatures to MGB axis dysfunction in CC, whether through structural depletion of SCFA producers impairing motility or functional adaptations perpetuating neuroimmune activation [
58], reinforcing that microbial contributions to CC pathogenesis span both compositional and predicted metabolic dimensions. Nevertheless, the current models do not meet the performance standards required for clinical application, and future work should focus on improving model accuracy and calibration in larger, independent cohorts before any clinical translation can be considered.
To further substantiate the potential functional impact of the identified dysbiosis, we constructed a multidimensional interaction network integrating SVM-selected genera with fecal metabolomic profiles and clinical parameters. This network revealed robust positive correlations between SCFA-producing taxa (e.g.,
Agathobacter and
Faecalibacterium) and key neuroactive or anti-inflammatory metabolites, notably 5-HIAA (a serotonin metabolite) and acetate [
58]. Critically, acetate levels correlated negatively with constipation severity, directly linking microbial metabolite production to clinical symptoms. Although the functional predictions from PICRUSt2 were not directly measured, this integrative analysis using actual metabolomic data provides independent support for the inferred metabolic deficits. Specifically, the depletion of beneficial taxa observed in CC was associated with a functional deficit in metabolites essential for gut–brain axis signaling [
58,
76]. Deficiency of SCFAs (e.g., acetate) may compromise enteric neuronal energy metabolism and motility [
59], whereas disruption of the tryptophan–5-HIAA pathway could reflect impaired serotonergic modulation of both gastrointestinal function [
77] and, potentially, central nervous system signaling [
68]. Notably, arginine metabolism, implicated in both CC and CPD, surfaced as a putative MGB axis mediator [
78]. Collectively, this network highlights associations that warrant further investigation. We caution that correlation does not imply causation; randomized controlled trials or preclinical models are needed to determine whether modulating these taxa or metabolites directly improves constipation or psychiatric symptoms.
This study has several limitations. First, the modest sample size and genus-level taxonomic resolution (potentially missing species- or strain-specific effects) limit causal inference and generalizability. Second, unmeasured confounding cannot be fully excluded. Dietary data were unavailable in both cohorts; we partially adjusted for this by using geographic region as a proxy for dietary patterns and balancing for it via PSM in the discovery cohort, yet residual dietary confounding may persist. In the in-house cohort, although we excluded users of probiotics, prebiotics, synbiotics, antibiotics, and proton pump inhibitors within 1 month, laxative use was not an exclusion criterion due to ethical constraints and patient dependency. Consequently, observed associations should be interpreted as hypothesis-generating. Third, functional predictions from PICRUSt2 reflect genomic potential rather than actual microbial activity, and their accuracy is notably lower for archaea (e.g., methanogens such as Methanomassiliicoccus and Methanosphaera). Therefore, validation by direct omics (metatranscriptomics, metaproteomics, or targeted metabolomics) is required. Future prospective studies with comprehensive phenotyping (diet, medications, and lifestyle) and, where ethically feasible, laxatives with minimal microbiota impact are needed to confirm our findings, followed by experimental verification of causal roles of the identified microbial taxa and metabolic pathways in independent multicenter cohorts.
5 Conclusion
This study reveals CC-associated gut dysbiosis with functional adaptation in the CPD subtype. Critically, the two machine learning models translate microbiome data into clinically actionable insights by identifying key microbial drivers of phenotypes. Ultimately, these findings pave the way for a paradigm in functional gastroenterology: developing microbiota-based diagnostic aids, refining clinically meaningful patient subtypes, and designing personalized microecological therapies, thereby advancing from observational associations toward actionable clinical strategies.
2026 The Author(s). Microbiota Medicine Research published by John Wiley & Sons Australia, Ltd on behalf of Higher Education Press.