Main

Immune checkpoint blockade (ICB) has revolutionized the field of oncology by prolonging the survival of patients with different tumor types at advanced stages1. However, only a subset of patients responds to ICB, and the treatment can induce a variety of immune-related adverse events (irAEs), including colitis2,3. Cross-sectional studies have assessed the gut microbiome before ICB initiation4,5,6,7,8,9,10,11,12, but the field is hampered by a lack of consensus as different studies often report different microbial biomarkers of response4—a heterogeneity that is probably the result of many methodological, biological and/or clinical confounders but that also arises from the high intra- and inter-individual variation of the gut microbiome13,14,15. Despite the lack of a thorough understanding of underlying mechanisms, multiple microbiome-directed clinical trials are ongoing in the oncoimmunology field, including fecal microbiota transplantation (FMT) trials16. To better interpret the findings from these trials and to increase our understanding of gut microbiome dynamics more generally and in the context of ICB, there is an urgent need for longitudinal microbiome studies along the course of ICB treatment.

In this Article, we therefore describe the profiling of the gut microbiome (via shotgun metagenomics followed by MetaPhlAn417 and microbial metabolic (MetaCyc)18 analyses) at four time points during the first 12 weeks of treatment in a multicenter cohort comprising 175 patients treated with ICB for advanced melanoma (Extended Data Fig. 1). First, because patients received an immunotherapy infusion at each study visit (thus, the effect of ICB on the gut microbiome may increase as the treatment progresses), we hypothesize that many microbial abundances may increase or decrease over the treatment period. Second, because baseline abundances of several microbial taxa have already been shown to differ between ICB response and nonresponse, we further hypothesize that patients responding and not responding to the treatment exhibit different patterns of microbial increase/decrease. To model this, we used a Bayesian regression model with higher-order interactions, allowing patients with progression-free survival (PFS) ≥12 months and patients with PFS <12 months to exhibit different longitudinal (linear) trajectories for each microbial feature. While we focus on the overall comparison between patients with PFS ≥12 and PFS <12 months averaging over the effect of multiple confounders, our methodology also allowed us to analyze microbial dynamics between patients with PFS ≥12 and PFS <12 months in three relevant clinical scenarios, namely therapy regimen (mono versus combination ICB), the development of ICB-induced colitis and concomitant proton-pump inhibitor (PPI) use. The latter two have well-studied effects on the gut microbiome19,20.

Results

Cohort characteristics

Cohort characteristics are summarized in Table 1. We recruited 175 patients from five distinct cohorts across the Netherlands, the United Kingdom and Spain who were treated with ICB for unresectable stage 3 and stage 4 cutaneous melanoma, as previously described4,5,6,9,10,11,12. A total of 117 (67%) patients received single agent treatment with an anti-programmed cell death (PD)-1 antibody (nivolumab or pembrolizumab), while 58 (33%) patients received combination therapy with anti-PD-1 and anti-cytotoxic T-lymphocyte-associated antigen (CTLA)-4 antibody (ipilimumab). We used the Response Evaluation Criteria in Solid Tumors (RECIST v.1.1) to determine tumor response (Methods). To capture patients who are alive or progression-free at late time points, we defined clinical endpoints as PFS at 12 months (PFS12) and overall survival (OS). PFS was defined as the time from the initial immunotherapy to disease progression or death, comparing patients achieving a PFS of 12 months or longer and patients with a PFS of less than 12 months. PFS12 was reached by 83 (47%) participants, and the overall median OS was 34.1 months (minimum of 0.39 months, maximum of 93.4 months; censoring date, 28 March 2023). OS was defined for a subset of patients (n = 147 patients) as the time in months from initiation of treatment to occurrence of death from any cause. Patients were followed over a maximum period of 7.3 years (median of 4.3 years) after providing the first fecal sample. Fecal samples were collected at baseline and three subsequent treatment visits over a period of 12 weeks (Methods and Extended Data Fig. 1).

Table 1 Cohort characteristics at study entry

Taxonomic profiling was performed at the level of species-level genome bins (SGBs) using MetaPhlAn4, which represent both existing and yet-to-be-characterized microbial species17. We first analyzed which SGBs’ and MetaCyc pathways’ relative abundances were differentially abundant between patients with PFS ≥12 and PFS <12 months averaging over the effect of confounders such as therapy regimen, development of ICB-induced colitis and other irAEs, concomitant use of PPIs, previous use of antibiotics, previous v-raf murine sarcoma viral oncogene homolog B1 (BRAF) or mitogen-activated protein kinase (MEK)-targeted therapy, and cancer center (Methods). Each regression parameter in our Bayesian model was represented by a marginal posterior probability distribution. We computed post hoc contrasts (see Supplementary Table 1 for the number of patient samples per contrast and study visit) for which we concluded that a microbial SGB or pathway is differentially abundant between cases and controls if 90% of its posterior distribution does not cover zero (that is, 90% Bayesian confidence level (BCL); other BCLs are reported in Supplementary Tables 2–12). At 90% BCL, we observed 62 (14.3%) and 41 (9.4%) SGBs that exhibited increasing or decreasing slopes in patients with PFS ≥12 and PFS <12 months, respectively (Supplementary Table 2), and 99 (22.8%) SGBs that were able to discriminate between patients with PFS ≥12 and PFS <12 months in at least one study visit (90% BCL; range: 342 (50% BCL)–3 (100% BCL); Supplementary Table 3). Of these 99 SGBs, 20 were differentially abundant only at baseline, 42 were differentially abundant only after the start of ICB and 5 and 4 remained at consistently higher abundances in patients with PFS ≥12 and PFS <12 months, respectively, at baseline and all subsequent study visits (Fig. 1a and Supplementary Table 4). To aid in the interpretation, Fig. 1a,b displays the longitudinal trajectories (that is, slopes) of two example SGBs and one MetaCyc pathway for patients with PFS ≥12 and PFS <12 months, respectively. A clear example is Sellimonas intestinalis (SGB4617), which is not differentially abundant between patients with PFS ≥12 and PFS <12 months at baseline (as illustrated by a gray cell at T0 in Fig. 1a). Beyond baseline, however, the expected abundance (represented in centered log ratio coordinates) increases sharply (as illustrated by a vivid red cell in Fig. 1a) in patients with PFS <12 months while decreasing slightly (as illustrated by a light blue cell in Fig. 1a) in patients with PFS ≥12 months. Thus, the average difference between these two patient groups increases (in absolute terms) across the study visits (as illustrated by the increasingly darker brown shades from T1 towards T3 in Fig. 1a). The five SGBs that had consistently higher abundances in patients with PFS ≥12 months were Agathobaculum butyriciproducens (SGB14993 group), Intestinibacter bartlettii (SGB6140), Dorea sp. AF24 7LB (SGB4571), Lactobacillus gasseri (SGB7038 group) and Lacrimispora celerecrescens (SGB4868), whereof the latter two also exhibited increasing abundances (that is, positive slopes) over the study period (Fig. 1a and Supplementary Table 4). Three of these species have recently been associated with response in two new studies utilizing MetaPhlAn4, one meta-analysis21 and one phase 1 FMT trial of ICB-naive patients22. These five species represent fiber degrading taxa capable of short chain fatty acid (SCFA) synthesis that has been linked to plant-based diets12,23,24. Consequently, we also observed higher abundances of metabolic pathways (PWY-6396: superpathway of 2,3-butanediol biosynthesis; PWY-P124: Bifidobacterium shunt; PWY-6435: 4-hydroxybenzoate biosynthesis V; and PWY-5088: l-glutamate degradation VIII (to propanoate)) involved in the synthesis of SCFAs or their precursors in patients with PFS ≥12 months across multiple study visits (Fig. 1c and Supplementary Table 5), supporting a potential benefit of microbially produced SCFAs and an adjuvant role of fiber for ICB7,25. Patients with PFS <12 months, on the other hand, were enriched across all four study visits with Ruthenibacterium lactatiformans (SGB15271), Prevotella copri clade A (SGB1626), Ruminococcaceae unclassified (SGB15265 group) and an unidentified SGB from the phylum Bacteroidetes (SGB1957; Fig. 1a and Supplementary Table 4). In previous baseline studies, P. copri has been associated with ICB response26,27. However, in the recent meta-analysis by Thomas et al.21, this particular SGB (SGB1626) was only associated with response in 5/12 cohorts and with 3/9 different statistical methods. We found that patients with PFS <12 months exhibited higher abundances of several pathways involved in menaquinol (vitamin K) synthesis at baseline and during early treatment (Fig. 1c and Supplementary Table 5). Menaquinol synthesis pathways are enriched in various chronic inflammatory and cardiovascular diseases28,29,30,31. Fecal menaquinone levels have been correlated with the abundance of Prevotella and Bacteroides species and are susceptible to microbiome-targeted diets32, suggesting that menaquinol could represent an early marker of nonresponse that is amenable to dietary intervention. In contrast, patients achieving PFS12 exhibited higher abundances of a polyamine synthesis pathway (POLYAMINSYN3-PWY: superpathway of polyamine biosynthesis II) across the three study visits after baseline, but not at baseline. Polyamines are autophagy inducers33 that are implicated in immune regulation and have been shown to improve anti-cancer immunity in mice, synergizing with anti-PD ligand 1 immunotherapy22,34. Polyamines, including spermidine, are naturally occurring in foods and can be synthesized by the gut microbiome, suggesting a potential beneficial role for spermidine-enriched diets35.

Fig. 1: High-level view of gut microbiome dynamics in patients with PFS ≥12 and PFS <12 months.
figure 1

a, For each microbial SGB listed, slopes are shown (that is, whether it is increasing or decreasing over study visits) in patients with PFS ≥12 (n = 83) and PFS <12 months (n = 92), respectively. For increased readability, SGBs differentially abundant in only one study visit have been removed (see Extended Data Fig. 2 for all SGBs). Red and blue colors indicate whether the focal SGB is increasing or decreasing in its abundance over study visits, respectively, with the strength of the colors corresponding to the steepness of the slope, with darker shades indicating steeper increases/decreases. It then shows, in the teal–brown heatmap, the average difference between the two slopes (that is, between patients with PFS ≥12 and PFS <12 months) across the different study visits. Non-gray cells in the heatmap correspond to the focal SGB’s log fold change in abundance between patients with PFS ≥12 and PFS <12 months, respectively. Teal cells correspond to study visits for which the abundance of the focal SGB is higher in patients with PFS ≥12 than with PFS <12 months, and vice versa for brown cells (at 90% BCL). Gray cells denote differences between patients with PFS ≥12 and PFS <12 months whose 90% credible interval cover zero. b, Three example features and how they increase and/or decrease in their expected abundance (represented in centered log ratio coordinates) over the study visits in patients with PFS ≥12 months (yellow slope) and in patients with PFS <12 months (purple slope). For each microbial SGB or pathway, the inset figure then displays the average difference between the two slopes at each study visit, including its 90% credible interval. These averages are the same as depicted in the teal–brown heatmap in a, and significance is deemed by evaluating whether or not the 90% credible interval covers zero. c, Microbial pathways are shown, similar to the format in a. The number (n) represents the number of patient samples at each visit for patients with PFS ≥12 and PFS <12 months.

To assess whether the five and four SGBs that had consistently higher abundances in patients with PFS ≥12 and PFS <12 months, respectively, could serve as a predictive marker for PFS12, we constructed a balance (a type of log ratio) between these SGBs and tested whether it could predict PFS12 in each study visit (Fig. 2a). We found that this balance could discriminate between patients with PFS ≥12 and PFS <12 months in all but the last study visit (two-sided Wilcoxon test: PT0 = 0.00085, PT1 = 0.0007, PT2 = 0.0005 and PT3 = 0.1; Fig. 2b) with a moderate predictive ability across visits (area under the curve (AUC) from 100 times repeated five-fold cross-validation, measured as mean AUC ± standard deviation (s.d.): AUCT0 0.659 ± 0.092, AUCT1 0.666 ± 0.091, AUCT2 0.739 ± 0.118 and AUCT3 0.655 ± 0.129; Fig. 2c). When we expanded this balance to include SGBs that were differentially abundant in all but the last study visit, its predictive ability increased across all study visits (AUCT0 0.771 ± 0.088, AUCT1 0.706 ± 0.094, AUCT2 0.783 ± 0.118 and AUCT3 0.765 ± 0.138; Extended Data Fig. 3a,b). Stratifying patients on the basis of whether they harbored higher or lower than median values of these two balances showed that patients above the median exhibited longer OS compared to patients below the median (first balance: OSHigh of 35.4 versus OSLow 28.4 months; hazard ratio (HR) of 1.669, P = 0.035; Fig. 2d; second balance: OSHigh of 37.0 versus OSLow of 26.9 months; HR of 1.792, P = 0.014; Extended Data Fig. 3c). Results did not quantitatively change when we substituted OS with continuous PFS (first balance: HR of 1.685, P = 0.022; second balance: HR = 2.25, P = 0.0004) and/or when we treated each balance as a continuous score (first balance: HROS = 0.828, POS = 0.001; second balance: HROS of 0.752, POS = 0.0002; Extended Data Fig. 4; first balance: HRPFS of 0.829, PPFS = 0.0005; second balance: HRPFS of 0.727, PPFS = 8.93 × 10−6).

Fig. 2: A longitudinal balance of microbial taxa (SGBs) predicts OS at baseline.
figure 2

a, Schematic illustration of a balance between the five SGBs that were consistently higher in patients with PFS ≥12 months (A. butyriciproducens SGB14993 group, I. bartlettii SGB6140, Dorea sp. AF24 7LB SGB4571, L. gasseri SGB7038 group and L. celerecrescens SGB4868) and the four SGBs that were found to be consistently higher in patients with PFS <12 months (R. lactatiformans SGB15271, R. unclassified SGB15265 group, P. copri clade A SGB1626 and an unidentified SGB from the phylum Bacteroidetes SGB1957). In patients with PFS ≥12 and PFS <12 months, the balance is tilted to the left and right side, respectively. b, The balance’s ability to discriminate between patients with PFS ≥12 (n = 83, n0 = 62, n1 = 77, n2 = 38 and n3 = 30) and PFS <12 months (n = 92, n0 = 74, n1 = 69, n2 = 34 and n3 = 24) months across study visits (two-sided Wilcoxon test: PT0 = 0.00085, PT1 = 0.0007, PT2 = 0.0005 and PT3 = 0.1). Boxplots represent minima, Q1, Q2, Q3 and maxima. c, The balance’s predictive ability expressed as the AUC computed from 100 times repeated five-fold cross-validation. Each line shows, for each study visit, the average across the 100 times repeated five-fold cross-validations with the shaded area representing the 95% CI (mean AUC ± s.d.: AUCT0 0.659 ± 0.092, AUCT1 0.666 ± 0.091, AUCT2 = 0.739 ± 0.118 and AUCT3 0.655 ± 0.129). The dashed diagonal line represents random chance. d, Kaplan–Meier curves and multivariable Cox regression of OS in months for 146 patients at baseline according to high (above median; teal) and low (below median; orange) values of the balance after adjusting for age, sex, BMI, previous therapy, PPI and antibiotics use.

Fig. 3: Different taxon dynamics in patients with PFS ≥12 and PFS <12 months.
figure 3

ad, Four different dynamics exemplified by different microbial SGBs with different dynamics in patients with PFS ≥12 (n0 = 62, n1 = 77, n2 = 38 and n3 = 30) and PFS <12 (n0 = 74, n1 = 69, n2 = 34 and n3 = 24) months, where the slopes of patients with PFS ≥12 months (yellow slopes) and patients with PFS <12 months (purple slopes) diverge from similar baseline abundances (a, dynamics 2a, Extended Data Fig. 7a), where the slopes of patients with PFS ≥12 and PFS <12 months are crossing (b, generating opposite abundance patterns when comparing baseline to the last study visit, dynamics 3b, Extended Data Fig. 7b), where the slope of the patients with PFS <12 months is relatively unchanged across the study visits compared to the slope of the patients with patients with PFS ≥12 months (c, dynamics 1c, Extended Data Fig. 7c); where the slope of the patients with PFS ≥12 months is relatively unchanged across the study visits compared to the slope of the patients with PFS <12 months (d, dynamics 2c, Extended Data Fig. 7c). The y axis shows the expected abundance (represented in centered log ratio coordinates) for each study visit (x axis). The corresponding inset figures show the average difference between patients with PFS ≥12 and PFS <12 months at each study visit, including its 90% credible interval. The number (n) represents the number of patient samples at each visit for patients with PFS ≥12 and PFS <12 months.

We next tested the generalizability of the balance described in Fig. 2a by computing it for patients from six independent melanoma cohorts5,7,8,9,10,12. Despite small sample sizes and large heterogeneity in terms of DNA isolation protocols and sequencing platforms (Supplementary Table 6), this analysis showed that the balance achieves a comparable AUC in several of the independent cohorts (Extended Data Fig. 5a,b). However, only in the cohort with a reasonably large number of patients (N = 112) did we find that the balance could discriminate between patients with PFS ≥12 and PFS <12 months (two-sided Wilcoxon test, P = 0.04; Extended Data Fig. 5c). While limited in sample size (N = 27), the balance also predicted OS in one of the independent cohorts (P = 0.024; Extended Data Fig. 5d).

Our analysis also revealed several SGBs only associated with PFS12 at baseline but not thereafter, many of which have not been previously reported in association with ICB, potentially owing to a lower resolution in taxonomic profiling (Extended Data Fig. 2 and Supplementary Table 4). For example, patients with PFS ≥12 months were enriched with Romboutsia timonensis (SGB6148), Limosilactobacillus fermentum (SGB7106) and Blautia schinkii (SGB4825), while patients with PFS <12 months had higher abundances of Eubacterium siraeum (SGB4198 group), Oscillibacter sp. ER4 (SGB15254) and Dysosmobacter sp. NSJ 60 (SGB15124) at baseline but not at subsequent study visits (Extended Data Fig. 2 and Supplementary Table 4). Stratifying patients on the basis of the median value of a balance between the 9 and 11 SGBs that, only at baseline, had higher abundances in patients with PFS ≥12 and PFS <12 months, respectively, we could predict OS at baseline (OSHigh of 35.5 months versus OSLow of 28.4 months; HR of 1.639, P = 0.034; Extended Data Fig. 6).

Microbial associations that emerge after ICB initiation

While microbial taxa that are able to differentiate between patients with PFS ≥12 and PFS <12 months at baseline may serve as important predictive and/or prognostic biomarkers, studying microbial taxa longitudinally could derive novel mechanistic insights in addition to becoming a new way to monitor ICB efficacy and irAEs. Therefore, we next identified SGBs that were only discriminative of patients with PFS ≥12 and PFS <12 months after ICB initiation. We found higher abundances of several SCFA producers from the Lachnospiraceae family, which included Coprococcus comes (SGB4577 group), Coprococcus catus (SGB4670), Gemmiger (SGB15295 group) and Anaerobutyricum hallii (SGB4532) in patients with PFS ≥12 months after ICB initiation (Fig. 1a and Supplementary Table 4). These species have previously been associated with increased response and OS in patients treated with immunotherapy8,12,36,37, but also with general health and a lower risk for metabolic and chronic inflammatory diseases28. Patients with PFS <12 months, on the other hand, showed an increase in Clostridium spiroforme (SGB6747), several other Lachnospiraceae (Blautia hydrogenotrophica (SGB4677), Blautia wexlerae (SGB4837 group), Ruminococcus torques (SGB4608), Sellimonas intestinalis (SGB4617) and Eisenbergiella tayi (SGB4988) and Erysipelotrichaceae (Turicibacter sanguinis (SGB6847) and Faecalibacillus faecis (SGB6750)) species only after the start of ICB (Fig. 1a and Supplementary Table 4). Recent studies have reported that Eisenbergiella sp., B. wexlerae, C. spiroforme and Erysipelotrichaceae were associated with resistance to ICB4,36 and enriched in patients with more aggressive tumors38.

Abundance patterns in patients with PFS ≥12 and <12 months during ICB

Next, we took a closer look at specific abundance patterns in patients with PFS ≥12 and PFS <12 months over the study period. Here, we assess whether microbial abundances reversed, converged or diverged from baseline in patients with PFS ≥12 and PFS <12 months over the study period. We found that 22.8% (90% BCL; range: 74.7% (50% BCL)–0.7% (100% BCL)) of the SGBs increased or decreased after treatment initiation (Supplementary Table 3). Focusing on the aforementioned 99 SGBs that could discriminate between patients with PFS ≥12 and PFS <12 months, we identified 22 SGBs for which patients with PFS ≥12 and PFS <12 months exhibited intersecting slopes (Fig. 3b,c and Extended Data Fig. 7, dynamics 3ab). In these cases, patients with PFS ≥12 and PFS <12 months had different initial abundances at baseline, with slopes crossing after the start of the treatment generating reverse abundance patterns at baseline compared to the last study visit. We found, for example, several SGBs that have been associated with various chronic and immune-mediated diseases, such as Streptococcus thermophilus (SGB8002) and T. sanguinis (SGB6847), which are dominant in the oral cavity, and B. schinkii (SGB4825), to exhibit opposite abundance patterns in patients with PFS ≥12 and PFS <12 months at baseline compared to the last study visit with patients with PFS <12 months and patients with PFS ≥12 months exhibiting positive and negative slopes, respectively. Other SGBs showed similar baseline abundances in patients with PFS ≥12 and PFS <12 months to only diverge after the start of ICB (Fig. 3a and Extended Data Fig. 7, dynamics 1ab). For example, we found increasingly separating abundances of Christensenellaceae bacterium NSJ 53 (SGB82545), E. tayi (SGB4988; Fig. 3a), Mediterraneibacter massiliensis (SGB4595), S. intestinalis (SGB4617) and Hydrogeniiclostridium mannosilyticum (SGB14890) that increased in patients with PFS <12 months and decreased in patients with PFS ≥12 months after the initiation of ICB (Extended Data Fig. 7, dynamics 2a and Supplementary Table 2).

Interestingly, we found 16 SGBs that remained relatively unchanged in patients with PFS <12 months over the study period but showed larger changes in patients with PFS ≥12 months (Extended Data Fig. 7c, dynamics 1c). For example, only patients with PFS ≥12 months exhibited increasing abundances of Lachnospiraceae bacterium OF09 6 (SGB4966) and Eubacterium siraeum (SGB4198; Fig. 3c) and decreasing abundances of F. faecis (SGB6750) and Fusicatenibacter saccharivorans (SGB4874). Recent immunotherapy studies in renal cell carcinoma reported that E. siraeum was associated with improved survival and overall response rate8,12,36,37, whereas F. saccharivorans and Erysipelotrichaceae members such as F. faecis were associated with resistance to ICB39. Lastly, we found 14 SGBs, including Bilophila wadsworthia (SGB15452; Fig. 3d) and several Clostridium SGBs, which remained relatively unchanged in patients with PFS ≥12 months across all study visits while exhibiting larger changes in patients with PFS <12 months (Extended Data Fig. 7c, dynamics 2c). While these findings support previous studies showing that the gut microbiome can discriminate between response and nonresponse at baseline, they also suggest that ICB may induce different changes in the gut microbiome of patients with PFS ≥12 and PFS <12 months, respectively. Thus, therapeutic targets that are based on baseline data only risk producing opposite or even unexpected effects.

The clinical context influences abundance patterns

Anti-PD-1 monotherapy versus anti-CTLA-4/anti-PD-1 combination therapy

We next analyzed microbial dynamics for different clinical scenarios and identified common and diverging signals of monotherapy (anti-PD-1) and combination therapy (anti-PD-1 and anti-CTLA-4). To avoid confounding by colitis and PPI use, which individually has considerable effects on the gut microbiome19,20, we compared patients with PFS ≥12 months versus patients with PFS <12 months on monotherapy (Extended Data Fig. 8 and Supplementary Table 7) or combination therapy (Extended Data Fig. 9 and Supplementary Table 8) who did not develop colitis and did not use PPIs, while also averaging over the effects of irAEs that were not colitis, previous antibiotics use, previous therapy and cancer center (Methods and Supplementary Information). We found 28 associations in common between monotherapy (27% of all associations at 90% BCL) and combination therapy (30% of all associations at 90% BCL), whereof 10 and 12 differentially abundant SGBs were shared between patients with PFS ≥12 and PFS <12 months, respectively. Interestingly, the remaining six SGBs (of the 28 shared) exhibited opposite patterns in patients with PFS ≥12 versus patients with PFS <12 months on monotherapy compared to combination therapy (Extended Data Figs. 8 and 9). These included Coprococcus eutactus (SGB5121), Butyricicoccus sp. AM29 23AC (SGB14991) and Parabacteroides merdae (SGB1949), which had opposite slopes in patients with PFS ≥12 versus patients with PFS <12 months on monotherapy compared to combination therapy (Fig. 4). Patients with PFS <12 months treated with monotherapy showed increasing abundances of several Bacteroides species (except for B. intestinalis) across most or all study visits, which were not observed for combination therapy (Extended Data Figs. 8 and 9 and Supplementary Tables 7 and 8). These results confirm previous observations of biphasic effects for the Bacteroides genus dependent on the specific treatment agent(s) used9,40,41. SGBs that exhibited higher abundances in patients with PFS ≥12 months compared to patients with PFS <12 months, regardless of therapy regimen, included Lacticaseibacillus rhamnosus (SGB7144), an unknown Firmicutes (SGB47850), three members from Lachnospiraceae (Dorea sp. AF24 7LB (SGB4571), Dorea formicigenerans (SGB4575), as reported previously12, and C. comes (SGB4577 group)) and four unidentified species from the family Ruminococcaceae (Ruminococcaceae bacterium (SGB15356), GGB9705 (SGB15224), GGB9712 (SGB15244) and GGB9677 (SGB15180); Extended Data Figs. 8 and 9 and Supplementary Tables 7 and 8).

Fig. 4: Divergent signals in monotherapy versus combination therapy.
figure 4

ac, Three examples out of the six SGBs that exhibited divergent patterns in monotherapy (PFS ≥12: n0 = 41, n1 = 49, n2 = 29 and n3 = 25; PFS <12: n0 = 49, n1 = 48, n2 = 25 and n3 = 18) compared to combination therapy (PFS ≥12: n0 = 21, n1 = 28, n2 = 9 and n3 = 5; PFS <12: n0 = 25, n1 = 21, n2 = 9 and n3 = 6): C. eutactus (SGB5121) (a), Butyricicoccus sp. AM29 23AC (SGB14991) (b) and P. merdae (SGB1949) (c). The y axis shows the expected abundance (represented in centered log ratio coordinates) for each study visit (x axis). Left: anti-PD-1 monotherapy. Right: anti-PD-1/anti-CTLA-4 combination therapy. The corresponding inset figures show the average difference between patients with PFS ≥12 and PFS <12 months at each study visit, including its 90% credible interval. The number (n) represents the number of patient samples at each visit for patients with PFS ≥12 and PFS <12 months.

ICB-induced colitis

We then aimed to identify SGBs associated with development or no development of colitis, averaging over the effects of all other predictors in our model, including PFS12 and therapy regimen (Extended Data Fig. 10 and Supplementary Table 9). We were particularly interested in colitis given the role of the gut microbiome in maintaining colonic immune homeostasis. Colitis was defined using the Common Terminology Criteria for Adverse Events (CTCAE) version 5, excluding intestinal symptoms of non-immune etiology. We found that butyrate producers, such as Roseburia inulinivorans (SGB4940) and Roseburia hominis (SGB4936), A. butyriciproducens (SGB14993 group), Eubacterium rectale (SGB4933 group), Bacteroides thetaiotaomicron (SGB1861) and two Faecalibacterium prausnitzii subspecies (SGB15342 and SGB15317) had higher abundances in patients who did not develop colitis after the start of ICB (Extended Data Fig. 10 and Supplementary Table 9). While all of these SGBs, apart from R. inulinivorans (SGB4940), exhibited negative slopes in both patients affected and patients unaffected by colitis, the decrease was larger in patients who developed colitis. It has been suggested that butyrate may be protective against ICB-induced colitis42; thus a further reduction in the abundance of butyrate producing bacteria during ICB may predispose patients with already lower baseline abundances to colitis. We found that the patient group who did not develop ICB-induced colitis exhibited a higher abundance of F. saccharivorans (SGB4874), which has been shown to induce anti-inflammatory effects in ulcerative colitis43 but has also been associated with resistance to ICB39. While Akkermansia muciniphila has been associated with response in several baseline studies4,11, we found that A. muciniphila (SGB9226) had higher baseline abundances in patients who developed colitis but decreased sharply in abundance thereafter (Extended Data Fig. 10 and Supplementary Table 9). In comparison, the group who did not develop colitis exhibited lower but somewhat increasing abundances of the same SGB (Extended Data Fig. 10 and Supplementary Table 9). While in our cohorts only this particular SGB was identified, there are four different A. muciniphila SGBs in the new MetaPhlAn4 database. Finally, monitoring microbial taxa that are associated with colitis is an important first step toward developing strategies to ameliorate its effects. As a proof of concept, we tested whether a balance between the SGBs associated with development of colitis and the SGBs associated with no development of colitis at baseline (that is, at T0 in Extended Data Fig. 10) could predict colitis development at baseline. We found that this balance could discriminate between the two groups (two-sided Wilcoxon test, PT0 = 0.00055) with an acceptable predictive ability (AUC mean ± s.d. of 0.723 ± 0.121; Fig. 5).

Fig. 5: A balance predictive of ICB-induced colitis at baseline.
figure 5

A balance between the 10 SGBs associated with the presence of colitis (red; n = 24 patients) and the 12 SGBs associated with the absence of colitis (blue; n = 112 patients) at baseline is predictive of colitis development at baseline. Left: the balance’s discriminatory ability (two-sided Wilcoxon test, PT0 = 0.00055). Boxplots represent minima, Q1, Q2, Q3 and maxima. Right: the same balance’s predictive ability expressed as the averaged AUC computed from a 100 times repeated five-fold cross-validation (AUC mean ± s.d. of 0.723 ± 0.121). The dashed diagonal line represents random chance.

In our dataset, we found a relationship between PFS12 and irAEs that were not colitis (Fisher’s exact test: P = 0.002; Supplementary Fig. 1). Compared to patients who achieved a PFS ≥12 months and developed colitis, we found that patients who achieved PFS ≥12 months but did not develop colitis exhibited higher abundances of four SGBs across the entire study period (Blautia sp. AF19 10LB (SGB4810), Lachnospiraceae bacterium (SGB4706), Gordonibacter pamelaeae (SGB14807) and Clostridium sp. AF20 17LB (SGB4714); Supplementary Fig. 2 and Supplementary Table 10). On the other hand, we found seven SGBs that exhibited higher abundances, throughout the study period, in patients with PFS ≥12 months who developed colitis, including several unclassified Clostridia species (Supplementary Fig. 2 and Supplementary Table 10). Interestingly, while patients with PFS ≥12 months without colitis showed enrichment in several F. prausnitzii SGBs (SGB15317, SGB15318 group, and SGB15342), A. butyriciproducens (SGB14993 group) and R. hominis (SGB4936), the abundance of A. muciniphila (SGB9226) was higher (but decreasing) in patients with PFS ≥12 months who developed colitis (Supplementary Fig. 2 and Supplementary Table 10). F. prausnitzii has previously been associated with the absence of colitis37; hence our findings further support approaches targeting different subspecies of F. prausnitzii to counteract colitis while maintaining ICB efficacy.

While we found a difference in the proportion of patients who develop colitis on monotherpay (0.128) compared to combination therapy (0.310) (two-sided test of equal proportions: Δ = 0.182; 95% CI: 0.036, 0.329; χ2 = 7.259; P = 0.007), we did not find a difference in the proportion of patients with PFS ≥12 months who developed colitis on monotherapy (0.051) compared to combination therapy (0.138) (two-sided test of equal proportions: Δ = 0.087; 95% CI: −0.024, 0.197; χ2 = 2.866; P = 0.09). When we compared colitis development under combination versus monotherapy, we observed higher and increasing abundances of SGBs belonging to the Streptococcus, Veillonella, Bacteroides and Eggerthella genera, an overall signature resembling the gut microbiome of patients with inflammatory bowel disease20 (Supplementary Fig. 3 and Supplementary Table 11).

PPI use

Finally, we investigated the effect of PPI use on patients with PFS ≥12 and PFS <12 months (Supplementary Fig. 4 and Supplementary Table 12). To avoid confounding by combination therapy and colitis, we focused on the group of patients who were treated with monotherapy and did not develop ICB-induced colitis. Here we found that PPI users on monotherapy shared 33 associations with nonusers on monotherapy (at 90% BCL; Supplementary Table 13). For a few SGBs, patients with PFS ≥12 months exhibited different slopes for users and nonusers. For example, S. thermophilus (SGB8002) exhibited increasing abundances in nonusers with PFS ≥12 months and decreasing abundances in users with PFS ≥12 months. Similarly, C. bacterium NSJ 53 (SGB82545) and B. caccae (SGB1877) exhibited increasing and decreasing abundances in nonusers and users, respectively, with PFS <12 months. While the Christensenellaceae family has been associated with health, B. caccae, B. stercoris and P. vulgatus have been linked to diseases such as inflammatory bowel disease and colorectal cancer44,45.

Discussion

In this study, we longitudinally profiled the gut microbiome in a multicenter cohort of 175 patients with advanced melanoma undergoing ICB. Through Bayesian regression models with higher-order interactions, we characterized microbiome changes in patients with PFS ≥12 or PFS <12 months during ICB, including in different clinical contexts such as therapy regimen, development of colitis and PPI use.

Previous studies conducted at baseline have led to an accumulating interest in SCFA producers as targets for increasing ICB efficacy, whereas species predictive of resistance to ICB have been associated with chronic immune-mediated or metabolic diseases46. However, longitudinal studies of the gut microbiome dynamics during treatment with ICB have been lacking. We show that, during ICB, a number of SGBs have contrasting dynamics to what would be expected from baseline and that the same SGB can exhibit different trajectories depending on the clinical context. While the abundance of SCFA producers remained at a higher abundance or even increased in patients with PFS ≥12 months during treatment, the abundance of SGBs considered ‘immunogenic’ exhibited larger changes from baseline, with different dynamics in different clinical contexts. Patients with PFS <12 months showed higher or increasing abundances of taxa that have been associated with inflammatory diseases, such as B. clarus, S. intestinalis and E. tayi. However, when considering different clinical contexts, we also found several taxa regarded as ‘proinflammatory’ (for example, P. merdae, Desulfovibrio piger and Streptococcus oralis) to be enriched in patients with PFS ≥12 months (Supplementary Fig. 5).

Comparing our results to two recent studies employing MetaPhlAn4, we found many common SGBs associated with ICB response at baseline, including several SGBs that also were differentially abundant during therapy and in different clinical contexts in our study. For example, Thomas et al.21 found that Eubacterium sp. AM28 29 (SGB6796 group) was associated with response in nine melanoma cohorts, four of which were not included in our study5,9,11,36. The same SGB was enriched in responders 1 month after FMT22. In our study, it was associated with PFS ≥12 months at baseline through to the second study visit, and at baseline in patients with PFS ≥12 months on combination therapy. Another SGB, L. celerecrescens (SGB4868), which is part of the balance described in Fig. 2a, was associated with response in six melanoma cohorts, five of which were not included in our study9,11,12,36,47 analyzed by ref. 21 and also enriched in all responders one month after FMT22. The replicability of our results, both the main balance and specific SGBs, shows the robustness of our longitudinal analysis (Supplementary Tables 14 and 15).

Our findings provide an important roadmap for designing and interpreting microbiome-based intervention studies. Owing to the distinct longitudinal dynamics observed in this study, therapeutic targets developed only from baseline findings may produce opposite or unexpected results. This can further vary depending on the clinical context. While we confirm a higher or increasing abundance of several species that are currently being studied as consortia therapies, including A. butyriciproducens, A. hallii, C. catus, E. rectale, Bifidobacterium adolescentis, F. prausnitzii48 and B. thetaiotaomicron49, other members of these consortia showed an increase in patients with PFS <12 months in our study, such as R. torques, Parabacteroides distasonis48 and B. clarus49, or had opposite trajectories depending on the therapy regimen (for example, increase of several Bacteroides SGBs and P. merdae in patients with PFS <12 months on anti-PD-1 monotherapy)48.

Our results could also be used to disentangle the effect of FMT from the longitudinal effect of ICB and important confounders on the gut microbiome. Recent phase 1 clinical trials suggest that FMT from responders50,51 or healthy donors22 combined with anti-PD-1 can induce response in a subset of ICB-refractory (OR 20–30% in refs. 50,51) and ICB-naive patients (OR 65% in ref. 22). Without performing FMTs, we observe similar taxa changes in patients with PFS ≥12 months (Supplementary Tables 14 and 15), suggesting that FMT synergizes with ICB to improve responses. Inter-individual variability in the response and engraftment of strains is widely described after FMT for different clinical contexts52,53 in which various treatment and host factors play a role16,22,54,55. We observed different dynamics of the shared SGBs depending on the clinical context (Supplementary Tables 14 and 15), findings that could be used to help optimize donor-recipient stratification in future trials.

To conclude, this study underlines the dynamic nature of the gut microbiome and indicates that longitudinal profiling at finer taxonomic resolution in association with host factors is critical for guiding microbiome-targeted interventions aimed at improving treatment outcomes. Limitations of this study include (but are not restricted to) simplifying microbial dynamics to linear trajectories, comparability with previous studies using different taxonomic databases and a smaller number of patient samples for some of the post hoc comparisons, which limits the generalizability of some of our results. To further validate our findings and move the clinical gut microbiome field forward from a biomarker perspective to actionable treatments, continued efforts should go into longitudinal profiling of ICB patients at larger scales, linking the gut microbiome, metabolome and immunome to treatment outcome.

Methods

Study design and cohort description

The prospective PRIMM cohorts

We prospectively recruited 128 patients with advanced melanoma who were treated with ICB between August 2015 and January 2020 in the UK studies Predicting Response to Immunotherapy for Melanona with Gut Microbiome and Metabolomics (PRIMM–UK, n = 54) and the Netherlands studies (PRIMM–NL, n = 74, made up of eligible patients from the COLIPI, POINTING and OncoLifeS studies). PRIMM–UK (NCT03643289) is sponsored by East and North Hertfordshire NHS Trust with ethical approval from King’s College London. OncoLifeS (METc number 2010/109), COLIPI (METc number 2012/085, NCT02600143) and POINTING (METc number 2018/350, NCT04193956) have all been approved by the Medical Ethical Committee (in Dutch: Medisch Ethische Toetsingsingscommissie or METc) of the University Medical Center Groningen in the Netherlands. OncoLifeS information is available on the Netherlands Trial Register56. Fecal samples were collected from these patients before initiation of ICB and longitudinally at up to four treatment (study) visits: at baseline and before each subsequent treatment cycle over a period of 12 weeks (Supplementary Fig. 1). The time between two samples was 3 or 4 weeks, depending on the treatment regimen, with ipilimumab/nivolumab combination therapy and pembrolizumab monotherapy administered three times weekly and nivolumab monotherapy administered four times weekly. Written informed consent was obtained from all patients.

Other enrolled cohorts

Patients within the PRIMM cohorts were recruited in parallel, using aligned protocols4. Additional patients, treated between March 2015 and November 2019, were enrolled from cohorts outside the setting of the PRIMM study: Leeds (n = 19), Barcelona (n = 11) and Manchester (n = 17). Fecal samples were collected at time points similar to those used in our included prospective studies. Patient samples within the Manchester cohort were collected with written full-informed patient consent under Manchester Cancer Research Centre Biobank ethics application 07/H1003/161+5 (updated in 18/NW/0092) and approval for the work under Manchester Cancer Research Centre Biobank Access Committee application 13_RIMA_01. Barcelona cohort samples were subjected to the ethical committee of Hospital Clínic of Barcelona approval (registry HCB/2015/1032). Data and samples from Leeds were collected in a study named ‘Developing a blood test of immunity in illness: a study examining the peripheral blood transcriptome in patients with cancer, autoimmune disease, immunodeficiency or iatrogenic immune suppression’ (research ethics committee reference 15/NW/0933). Informed written consent was obtained for collection of samples and data, sharing anonymized data and working with collaborators whether academic or commercial.

Inclusion criteria

Patients who fulfilled the following criteria were eligible for the analysis: (1) histologically or cytologically confirmed non-resectable advanced (stage 3 or 4) cutaneous melanoma, (2) treatment with ICB (nivolumab or pembrolizumab) or a combination of ipilimumab and nivolumab at the recommended dose as a first-line immune checkpoint inhibitor, (3) 18 years of age or older and (4) availability of baseline characteristics presented in Table 1.

Assessment of treatment outcomes

Response to ICB was classified according to RECIST v1.1 criteria. Based on radiographic response, patients were classified as responders (complete response, partial response and stable disease), or nonresponders (progressive disease).

Clinical endpoints were defined as PFS12 and OS. PFS was defined as the time from the initial immunotherapy to disease progression. OS was defined as time in months from initiation of treatment to occurrence of death from any cause. IrAEs, including colitis, were assessed using the CTCAE version 5 (19). Side effects that were clearly of non-immune etiology were excluded.

Sample and data collection

Patients received oral and written instructions regarding the stool collection procedure. Patients within PRIMM–UK and PRIMM–NL were requested to collect approximately 3–5 ml plain feces using a collection kit that could be used at home and then store the sample in their freezer directly after collection. PRIMM–NL samples were transported to the hospital in a frozen insulated cooling bag to prevent thawing. Due to the geographic disbursal of PRIMM–UK patients, samples were collected and placed in Thermo Fisher Scientific kits and sent by special post to the laboratory at King’s College London. After arrival in the hospital, the samples were directly stored at −80 °C. Plain stool samples from the Manchester cohort were either collected on site at the hospital and stored directly at −80 °C within 4–6 h of collection or collected in sample containers and sent by special post to the laboratories of CRUK Manchester Institute and stored directly at −80 °C upon arrival. Patients within the Barcelona cohort used the OMNIgene GUT collection kit (DNA Genotek). Fecal DNA was extracted from 1 to 14 days after sample collection using the PowerFecal DNA Isolation Kit (previously MoBio, currently Qiagen) and kept frozen until needed. Patients from Leeds also collected stool at home using the OMNIgene GUT collection kit (DNA Genotek), and samples were returned to the research nurse.

Baseline demographics, including sex, age, body mass index (BMI), Eastern Cooperative Oncology Group (ECOG) performance status and medication use, were collected, along with tumor staging and previous anti-cancer therapy data. Demographic data were collected as part of a screening visit up to 14 days before ICB treatment began. All baseline antibiotics or PPI use within 3 months of commencing ICI treatment was documented. Tumor staging took place up to 1 month before the start of treatment.

Radiological evaluation, consisting of a computed tomography (CT) scan of the thorax, abdomen and pelvis and magnetic resonance imaging of the brain, was performed at baseline (that is, before the first dose of immunotherapy). A small number of patients had positron emission tomography scans with a CT component. Follow-up radiological evaluation was performed every 10–14 weeks as long as the patient received systemic therapy. Additional CT and/or magnetic resonance imaging scans were performed when there was suspicion of progression. If the first radiological evaluation after the start of therapy was inconclusive, then a confirmatory scan was performed 4–12 weeks later.

Metagenomics processing

DNA extraction and sequencing

DNA was isolated for all cohorts at King’s College London using Thermo Fisher Scientific’s MagMax Core protocols for nucleic acid purification and mechanical lysis. Samples with a high-quality DNA profile (>15 ng µl−1 of DNA) were further processed. Sequencing libraries were prepared using the Illumina Nextera DNA Flex Library Prep Kit according to the manufacturer’s protocols. Libraries were multiplexed using dual indexing and sequenced for 300 bp paired-end reads using the Illumina NovaSeq6000 platform according to the manufacturer’s protocols. We obtained a total of 1,283 Gb with an average of 53,919,210 reads per sample before quality control and pre-processing.

Metagenome quality control and pre-processing

Shotgun metagenomic sequencing was performed at the NGS Core Facility at University of Trento. The quality of all sequenced metagenomes was controlled using the pre-processing pipeline implemented in ref. 57. Of all the samples collected across the five observational cohorts, we considered those that passed all the quality control steps of the metagenomic sequencing pipeline and had more than 1 Gb of sequencing data. This resulted in a total of 447 samples from 195 patients that were then subjected to strict quality control and were processed into taxonomic and predicted pathway abundances.

Microbiome taxonomic and functional potential profiling

Taxonomic and functional metagenomic profiling was performed using MetaPhlAn417 with the vJan21 SGB database release and HuMAnN358 with default parameters. Before prevalence filtering (see below), we identified a total of 2,223 microbial SGBs and 518 microbial pathways.

Selection of independent variables for the longitudinal model

We were interested in modeling study visit varying intercept and slopes for patients with PFS ≥12 and PFS <12 months, respectively, in three main clinical contexts: (1) the type of immunotherapy patients received (that is, mono versus combination therapy), (2) if patients had developed any grade of ICB-induced colitis (no versus yes) and (3) if patients received concomitant PPIs (no versus yes). Beyond these three independent variables, we also controlled for previous antibiotics use, previous BRAF or MEK-targeted therapy, time since first injection (in days), cancer center, other forms of irAEs (that is, not colitis), age, sex and BMI. We also included a patient identifier to account for the repeated measurements. In the end, the included variables represented a balance between (1) minimizing collinearity between independent variables, (2) loss of patient samples due to missingness in independent variables and (3) the number of included independent variables versus the number of modeled samples. These selection criteria resulted in 408 samples from 175 patients.

Prevalence filtering of microbiome taxonomic and functional profiles

We retained microbial features that were present in at least 20% of the baseline samples, which also had a prevalence of least 10% among the longitudinal samples. Applying this stringent filtering criterion, we retained in the 408 samples; 434 and 395 microbial SGBs and pathways, respectively. This was done using phyloseq (v.1.42.0) and tidyverse (v.2.0.0) R packages.

Independent melanoma cohorts for validation

To validate the balance described in Fig. 2a, we downloaded the raw sequences from six publicly available melanoma cohorts (three using radiographic response based on RECIST1.1 criteria, one using PFS12 and two using both RECIST and PFS12) that characterized gut microbiome composition at baseline (Supplementary Table 6). We kept the response definition used in the original publication. One of the cohorts5 also characterized gut microbiome composition within 4 months after the start of ICB. We treated these pre- and post-ICB samples from ref. 5 as two cohorts. We re-processed the raw sequences using MetaPhlAn4 (using the same database and settings as described above) and computed the balance (Fig. 2a) for all samples in each independent cohort. Not all SGBs were present in all independent cohorts. For example, we did not find taxon GGB1420 SGB1957 (SGB1957) in any of the independent cohorts after 10% prevalence filtering (see Supplementary Table 16 to see which SGBs were missing in each independent cohort). To test whether the balance could predict response anew in each independent cohort, we fit a simple logistic model [glm(response_definition ~ balance_score, family = ’binomial’)] to all samples in each cohort and computed the AUC (on the training data, as we fit all samples). We could not include any other independent variables in the models because most cohorts did not report information such as age, sex, BMI or other clinical variables.

Statistical analysis

Compositional data analysis

Metagenomic sequencing produces compositional data, which means that information can only be obtained in the form of relative abundances that are independent of the total microbial load in a given sample. As a result, an increase in one microbial feature (for example, a taxon or metabolic pathway) relative abundance necessarily requires an equivalent decrease in the relative abundance of the remaining community of features present in the same sample. If this statistical property is not accounted for, the likelihood of introducing false positives in differential abundance analysis59,60 and negative correlation biases in correlation-based analysis61,62 increases heavily. While standard statistical methodology assumes that the analyzed data are represented by variables free to vary from −∞ to ∞ within Euclidean geometry, compositional data occupy the simplex that is a restricted space where variables are strictly positive and vary from 0 to 1 or 0 to 100, if data are represented as proportions or percentages (such as relative abundances), respectively. A log ratio transformation maps the simplex to Euclidean real space (that is, the Aitchison geometry) where standard statistical methodology can be applied. There are several available log ratio transformations, each using a different reference frame (that is, the denominator). For example, the additive and centered log ratio (alr and clr, respectively) transformation is defined as

$${X}_\mathrm{alr}=\left[\mathrm{log}\left(\frac{{x}_{1}}{{x}_{D}}\right),\mathrm{log}\left(\frac{{x}_{2}}{{x}_{D}}\right),\ldots ,\mathrm{log}\left(\frac{{x}_{D-1}}{{x}_{D}}\right)\right]$$
(1)
$${X}_\mathrm{clr}=\left[\mathrm{log}\left(\frac{{x}_{1}}{g(x)}\right),\mathrm{log}\left(\frac{{x}_{2}}{g(x)}\right),\ldots ,\mathrm{log}\left(\frac{{x}_{D}}{g(x)}\right)\right]$$
(2)

where \(x=[{x}_{1},{x}_{2},{x}_{3},\ldots ,{x}_{D}]\) denotes a sample (that is a composition) containing D ‘counted’ microbial features. In the alr transformation (equation (1)), the choice of the denominator or the reference frame is arbitrary and could represent any specified feature. In the clr transformation (equation (2)), however, the denominator is defined by the geometric mean g(x) of the focal sample, or put simply, the ‘average’ feature in the focal sample.

Differential ranking

There already exist several developed methods to find changes in compositional data between cases and controls that avoid the biases caused by the compositional nature of metagenomic sequencing data (for example, ALDEx263, ANCOM64 and Gneiss65). What these methods typically have in common is that they internally use some log ratio transformation, which is conserved regardless of whether the data are relative or absolute. A recent approach called differential ranking is robust to the choice of the alr reference feature, and ranks produced from relative abundances are identical to the ranks of absolute abundances66,67. More specifically, the term ‘differential’ refers to the logarithm of the fold change in abundance of a microbial feature between cases and controls. Differential rankings can therefore be used to detect differentially abundant features knowing that the results are not affected by the compositional nature of the data. It is important to note, however, that high-ranking (positive) features have not necessarily increased in absolute terms between the cases compared to the controls but can still have decreased, although to a lesser extent than the lower-ranking features.

A logistic normal model to estimate differential rankings from proportions

Almost all of the methods developed for compositional sequencing data are intended for counts (for example, 16S rRNA gene amplicons). However, if the processed sequencing data are expressed as proportions with unknown sample totals, then these methods may require changes before being applied. The R package fido68 (1.0.4) implements a Bayesian multinomial logistic normal regression model called Pibble that can be adapted to model proportions (that is, only fitting the logistic normal model). Furthermore, the coefficients estimated by Pibble can be ranked and interpreted as differential rankings with statistical significance achieved through Bayesian inference68,69. Pibble is constructed to model any observed sequencing counts using a multinomial distribution, with the underlying microbial feature composition as random variables modeled by a logistic normal distribution. More specifically, the observed relative abundances are considered to be drawn from a multinomial distribution parameterized by a set of proportions (πj), which have an analogous representation in the alr space, with the transformed variables drawn from a multivariate normal distribution that exists in Euclidean real space68,69. While both the multinomial Dirichlet model and the multinomial logistic normal model can handle over-dispersed count data70,71, the logistic normal model also allows for both positive and negative covariation between microbial features69. In short, the Pibble model is defined as follows:

$${Y}_{j}\sim \mathrm{Multinomial}({\pi }_{j})$$
(3)
$${\pi }_{j}=\mathrm{al{r}}^{-1}({\eta }_{j})$$
(4)
$${\eta }_{j}\sim N(\varLambda {X}_{j},\varSigma )$$
(5)
$$\varLambda \sim \mathrm{M{N}}_{(D-\mathrm{1})xQ}(\varOmega ,\varSigma ,\varGamma )$$
(6)
$$\varSigma \sim {W}^{-1}(\varXi ,\nu )$$
(7)

with Y representing a D × N count matrix with the jth column representing a sample (that is composition) containing the D ‘counted’ (microbial) features (equation (3)). Equation (4) represents a transformation between the multinomial parameters (πj sum to 1) that exist on the simplex, and the transformed parameters ηj that exist in Euclidean real space. As is common for multinomial regression, Pibble uses the inverse alr transformation (also called the softmax transform in the machine learning literature) to produce a relative abundance matrix (that is, proportions varying between 0 and 1). This also implies that \({\eta }_{j}=\mathrm{alr}({\pi }_{j})\). The Q modeled covariates are included in the Q × N matrix denoted X. Importantly, equation (5) simply represents a multivariate linear model with X containing the Q modeled covariates, Λ a matrix containing the corresponding estimated regression coefficients that can be ranked to produce the differential rankings and \(\varSigma\) a D × D matrix containing the residual covariance between all log ratios. The matrix containing the estimated regression coefficients (that is, Λ) is modeled as a matrix normal distribution, which is simply a generalization of the multivariate normal distribution capable of describing the covariation between the rows (that is, features \(\varSigma\)) and between the columns (that is, samples, Γ) of Λ (equation (6)). Finally, \(\varSigma\) is modeled as a inverse Wishart distribution (W−1), which is a common distribution over covariance matrices (equation (7))68,69.

Owing to the large flexibility of the Pibble model, it is possible to directly model sequencing data expressed as proportions (that is, relative abundances) using the logistic normal model (that is, starting from equation (4)). The only drawback of this is that variation in the counts cannot be modeled, but this information is naturally lost once data are normalized (and if the information on sample totals is not kept). Importantly, once the model is fit, the results can be viewed as if any log ratio transform had been used (instead of the alr in equation (4)), including the clr. Lastly, because equation (5) simply represents a multivariate linear model, interactions between predictor variables can also be modeled. Pibble uses the collapse–uncollapse sampler, which was developed particularly for this class of models68,69. We used the same priors as suggested by refs. 68,69.

A linear model with higher-order interactions

We hypothesized that microbial abundances may change over the course of the treatment period because patients received an immunotherapy injection at each treatment visit, thus probably increasing the cumulative effect of the therapy on the gut microbiome across the study period. We further hypothesized that patients with PFS ≥12 and PFS <12 months may exhibit different patterns of change. To model this, we included higher-order interactions, thereby assuming that microbial abundances change linearly across study visits. In equation (5), we modeled the relationship between X (study visits/cumulative number of treatment injections) and Y (the log ratio value for any given microbial feature) to be contingent not only on Z whether patients achieved PFS ≥12 months, but also on the moderator variable W, which in our case represents one of three treatment characteristics of interest. Therefore, the three three-way interactions we modeled all included the same X and Z variables but with a different treatment characteristic of interest (that is, the moderator variable W1–3; see equation (8)). The different treatment characteristics for W that we modeled were: W1, the type of immunotherapy patients received (that is mono versus combination therapy); W2, if patients had developed any grade of ICB-induced colitis (no versus yes); and W3, if patients received concomitant PPIs (no versus yes). Beyond the different treatment characteristics, we also controlled for whether patients have had previous chemotherapy, time since first injection (in days), the cancer center patients were treated at, whether they experienced other forms of irAEs (that is, not colitis), age, sex and BMI. We also included a patient identifier to account for the repeated measurements. Lastly, before model fitting, all continuous variables (that is, age and BMI) were mean centered, and all ‘peripheral’ categorical variables (that is, previous therapy, center, other forms of irAEs, patient identification and sex) were coded using weighted sum contrasts (as opposed to treatment contrasts). The latter effectively mean-centers categorical variables with the result being that the intercept represents the average of all independent variables not included in the three-way interactions. To note is that all 175 patients in the main analysis have information on all of these metadata (that is, there is nothing missing/not available).

Without including any of the ‘peripheral’ independent variables, which we adjusted for (that is, center, time to/since first injection, other forms of irAEs, patient identification, age, sex and BMI), we can write our linear regression model as

$$\begin{array}{l}Y={\beta }_{0}+{\beta }_{1}X+{\beta }_{2}Z+{\beta }_{3}XZ+\mathop{\underbrace{{\beta }_{4}{W}_{1}+{\beta }_{5}X{W}_{1}+{\beta }_{6}Z{W}_{1}+{\beta }_{7}XZ{W}_{1}}}\limits_{{\rm{Combination}} \,{\rm{therapy}}}+\\ \mathop{\underbrace{{\beta }_{8}{W}_{2}+{\beta }_{9}X{W}_{2}+{\beta }_{10}Z{W}_{2}+{\beta }_{11}XZ{W}_{2}}}\limits_{{\rm{Colitis}}}+\mathop{\underbrace{{\beta }_{12}{W}_{3}+{\beta }_{13}X{W}_{3}+{\beta }_{14}Z{W}_{3}+{\beta }_{15}XZ{W}_{3}}}\limits_{{\rm{PPI}}}\end{array}$$
(8)

where Z and W1–3 are binary variables dummy coded to be either 0 or 1, always with 0 as the reference category. Thus, the β2 coefficient for Z (PFS12: 0 is PFS <12, 1 is PFS ≥12) represents the value when all treatment characteristics of interest (W1–3) are at their reference level (that is, monotherapy (W1), no colitis (W2) and no PPIs (W3)) and when the independent variable X has a value of zero (that is, baseline). We can further rewrite equation (8) to illustrate that the relationship between X and Y is conditional on Z and W1–3 as follows:

$$\begin{array}{l}Y=(\mathop{\underbrace{{\beta }_{0}+{\beta }_{2}Z+{\beta }_{4}{W}_{1}+{\beta }_{6}Z{W}_{1}+{\beta }_{8}{W}_{2}+{\beta }_{10}Z{W}_{2}+{\beta }_{12}{W}_{3} ,+{\beta }_{14}Z{W}_{3}}}\limits_{{\rm{intercepts}}})\, + \\ (\mathop{\underbrace{{\beta }_{1}+{\beta }_{3}Z+{\beta }_{5}{W}_{1}+{\beta }_{7}Z{W}_{1}+{\beta }_{9}{W}_{2}+{\beta }_{11}Z{W}_{2}+{\beta }_{13}{W}_{3}+{\beta }_{15}Z{W}_{3})}}\limits_{{\rm{slopes}}}X\end{array}$$
(9)

where the first and second parentheses represent the intercepts and the slopes graphing Y against X.

Post hoc contrasts to compute the comparisons of interest

To create the relevant comparisons between cases and controls, we constructed so-called post hoc contrasts (linear combinations of coefficients) directly from the fitted model. To compute these, we first constructed reference grids (Supplementary Information), which contain all relevant combinations of the categorical independent variables that we wanted to average over. Based on these reference grids, we computed marginal means of cases and controls, which we then could statistically compare. Because we already mean centered all ‘peripheral’ independent (continuous and categorical) variables, we only consider the coefficients associated with the treatment characteristic of interest (W1–3), which is shown in equation (8). The post hoc contrasts we computed were (1) PFS ≥12 versus PFS <12 months, (2) colitis versus no colitis, (3) PFS ≥12 months with and without colitis, (4) patients on combination versus monotherapy with colitis, (5) PFS ≥12 versus PFS <12 months on monotherapy without colitis and no PPIs, (6) PFS ≥12 versus PFS <12 months on combination therapy without colitis and no PPIs and (7) PFS ≥12 versus PFS <12 months on PPIs, monotherapy and without colitis. In Supplementary Information, we show the mathematical procedure to compute these post hoc contrasts for (1), (2) and (3), but the same logic applies when computing to the remaining contrasts.

Balance analysis

A balance is a type of log ratio defined as the ratio between the geometric means of two subsets of features72,73. Following the definition in ref. 73, mathematically a balance is defined as follows. Let X = (X1,X2,X3,…,Xk) be a sample with k features. Given two non-overlapping subsets of features in X denoted by X+ and X, indexed by I+ and I, and comprising k+ and k, the balance between X+ and X is defined as the log ratio of the geometric mean of the two subsets of features as follows:

$$B({X}_{+},{X}_{-})={\mathrm{log}}\left(\frac{\left.\left.\left(\prod _{i\in {I}_{+}}\right){X}_{i}\right)^{{1/}{k}_{+}}\right)}{\left.\left.\left(\prod _{j\in {I}_{-}}\right){X}_{j}\right)^{{1/}{k}_{-}}\right)}\right).$$
(10)

Expanding the logarithm, we can simplify the above equation as

$$B({X}_{+},{X}_{-})=\frac{1}{{k}_{+}}\sum _{i\in {I}_{+}}{\mathrm{log}}{X}_{i}-\frac{1}{{k}_{-}}\sum _{i\in {I}_{-}}{\mathrm{log}}{X}_{j}.$$
(11)

Note that we have removed the normalization constant \(\frac{1}{k}\) from the original definition as it is later shown by ref. 74 to be unnecessary. Using the relative abundances of the focal SGBs, we computed different balances using the above mathematical formula implemented in custom-written R scripts. Because each balance consists of a selection of SGBs or ‘top hits’ from the longitudinal model that already adjusts for a large number of confounders, the effect of different confounders (for example, cancer center) on each balance score, has already been averaged out.

Survival analysis

To test whether a focal balance was associated with OS at baseline, we used the multivariable Cox proportional hazard regression model as implemented in the coxph() function in the R package survival (3.5-5). We either considered the start of therapy to (1) death from any cause (OS) or (2) progression or death from any cause (PFS) as the time-to-event data. If patients were event-free (that is, alive and/or progression-free) at the last follow-up (28 March 2023), they were right censored. We used these models to estimate HRs including their 95% confidence intervals (CIs) for OS, adjusting for sex, age, BMI, PPI, antibiotics use, previous chemotherapy, colitis and other irAEs. We had n = 146 patients for which these data were complete (that is, no missings). The proportional hazard assumption was checked testing the trend of the Schoenfeld residuals with the cox.zph() function in the survival package (3.5-5). We did not observe any violations in this assumption. Finally, survival curves were estimated using the Kaplan–Meier method as implemented in the survfit2() function in the R package ggsurvfit (0.3.0).

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.