Skip to article frontmatterSkip to article content

Assessing engraftment extent with q2-FMT

Exploring the data

Access and summarize the study metadata

To begin our work with QIIME 2 and the tutorial data we will start by downloading the metadata, generating a summary, and exploring that summary.

First, download the metadata.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
wget -O 'sample-metadata.tsv' \
  'https://q2-fmt.readthedocs.io/en/latest/data/tutorial/sample-metadata.tsv'

Next, we’ll get a view of the study metadata using QIIME 2. This will allow you to assess whether the metadata that QIIME 2 is using is as you expect. You can do this using the tabulate action in QIIME 2’s q2-metadata plugin as follows.

[View Source]
use.action(
    use.UsageAction(plugin_id='metadata', action_id='tabulate'),
    use.UsageInputs(input=sample_metadata),
    use.UsageOutputNames(visualization='metadata_summ_1')
)
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/q2-fmt/checkouts/latest/.env/lib/python3.10/site-packages/qiime2/sdk/usage.py", line 148, in __init__
    self._plugin_manager = sdk.PluginManager.reuse_existing()
  File "/home/docs/checkouts/readthedocs.org/user_builds/q2-fmt/checkouts/latest/.env/lib/python3.10/site-packages/qiime2/sdk/plugin_manager.py", line 58, in reuse_existing
    raise UninitializedPluginManagerError
qiime2.sdk.plugin_manager.UninitializedPluginManagerError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/q2-fmt/checkouts/latest/.env/lib/python3.10/site-packages/q2doc/transforms/transform_usage.py", line 72, in run
    exec(source, exec_driver.scope)
  File "<string>", line 2, in <module>
  File "/home/docs/checkouts/readthedocs.org/user_builds/q2-fmt/checkouts/latest/.env/lib/python3.10/site-packages/qiime2/sdk/usage.py", line 150, in __init__
    raise sdk.UninitializedPluginManagerError(
qiime2.sdk.plugin_manager.UninitializedPluginManagerError: Please create an instance of sdk.PluginManager

Access and summarize the feature table

The feature table will describe the amplicon sequence variants (ASVs) observed in each sample, and how many times each ASV was observed in each sample. The feature data in this case is the sequence that defines each ASV.

In this tutorial, we’re going to work specifically with samples that were included in the autoFMT randomized trial.

Lets generate and explore a summary of the feature table we will be using.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
wget -O 'feature-table.qza' \
  'https://q2-fmt.readthedocs.io/en/latest/data/tutorial/feature-table.qza'
[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime feature-table summarize \
  --i-table feature-table.qza \
  --m-sample-metadata-file sample-metadata.tsv \
  --o-visualization autofmt-table-summ.qzv

Selecting an Even Sampling Depth

Rarefying, rarefaction, and q2-boots

A first step in analyzing our microbiome feature table is to choose an “even sampling depth”, or the number of sequences that we should select at random from each of our samples to ensure that all samples are sequenced at equivalent depth or with equivalent effort. This processes is referred to as rarefying our feature table. Rarefying feature tables, or sampling them to a user-specified sampling depth and discarding samples with a total frequency that is less than the sampling depth, is a bit of a controversial topic because it throws away some of the data that was collected and is subject to biases as a result. Rarefaction differs in a subtle way from rarefying, in that it involves repeat sampling from the input feature table to a user-specified sampling depth. These concepts were recently discussed in Schloss (2024). In this tutorial, for the sake of time, we are going to focus our diversity analyses on rarefying (i.e., a single iteration of random sampling). To perform rarefaction-based diversity analysis with QIIME 2, refer to the q2-boots plugin Raspet et al. (2024).

Selecting an even sampling depth

To start our diversity analyses, we first need to determine what even sampling depth (or “rarefaction depth”) we want to select for computing our diversity metrics. Because most diversity metrics are sensitive to different sampling depths across different samples, it is common to randomly subsample the counts from each sample to a specific value. For example, if you define your sampling depth as 500 sequences per sample, the counts in each sample will be subsampled without replacement so that each sample in the resulting table has a total count of 500. If the total count for any sample(s) are smaller than this value, those samples will be dropped from the downstream analyses. Choosing this value is tricky. We recommend making your choice by reviewing the information presented in the feature table summary file. Choose a value that is as high as possible (so you retain more sequences per sample) while excluding as few samples as possible.

Open up the feature table summary that you previously created with either Galaxy or in your QIIME 2 container and we’ll discuss this as a group.

Alpha rarefaction plots

After choosing an even sampling depth, it’s helpful to see if your diversity metrics appear stable at that depth of coverage. You can do this for alpha diversity using an alpha rarefaction plot.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime diversity alpha-rarefaction \
  --i-table feature-table.qza \
  --p-metrics observed_features \
  --m-metadata-file sample-metadata.tsv \
  --p-max-depth 33000 \
  --o-visualization obs-features-alpha-rarefaction.qzv

Computing diversity metrics

The next step that we’ll work through is computing a series of common diversity metrics on our feature table. We’ll do this using the q2-diversity plugin’s core-metrics action. This action is a QIIME 2 Pipeline which combines over ten different actions in a single command.

Core diversity metrics

The core-metrics action requires your feature table and your sample metadata as input. It additionally requires that you provide the sampling depth that this analysis will be performed at. Determining what value to provide for this parameter is often one of the most confusing steps of an analysis. Refer to the previous chapter for details. Here we prioritize retaining samples and so we select a sampling depth of 10,000.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime diversity core-metrics \
  --i-table feature-table.qza \
  --p-sampling-depth 10000 \
  --m-metadata-file sample-metadata.tsv \
  --output-dir diversity-core-metrics
  • diversity-core-metrics/rarefied_table.qza | download | view
  • diversity-core-metrics/observed_features_vector.qza | download | view
  • diversity-core-metrics/shannon_vector.qza | download | view
  • diversity-core-metrics/evenness_vector.qza | download | view
  • diversity-core-metrics/jaccard_distance_matrix.qza | download | view
  • diversity-core-metrics/bray_curtis_distance_matrix.qza | download | view
  • diversity-core-metrics/jaccard_pcoa_results.qza | download | view
  • diversity-core-metrics/bray_curtis_pcoa_results.qza | download | view
  • diversity-core-metrics/jaccard_emperor.qzv | download | view
  • diversity-core-metrics/bray_curtis_emperor.qzv | download | view

As you can see, this command generates many outputs including both QIIME 2 artifacts and visualizations. We’ll work together on a guided exploration of these results.

Assessing engraftment extent with q2-FMT

When investigating FMTs, it is really important to understand the extent to which the recipient microbiome engrafted the donated microbiome. Without assessing engraftment extent, we can never fully understand the clinical outcomes of the study Figure 1.

Created with BioRender.

Figure 1:Created with BioRender.

Herman et al. (2024) Herman et al. (2024) defines three criteria that are important for understanding if a microbiome engrafted following FMT. These are:

  1. Chimeric Asymmetric Community Coalescence
  2. Donated Microbiome Indicator Features
  3. Temporal Stability.

q2-fmt is a QIIME 2 plugin that was designed to help you investigate all three of these criteria. For additional infomation, Here is a lecture video of Chloe Herman discussing the importance of assessing engraftment extent!

Chloe Herman at NIH presenting on assessing engraftment with q2-fmt!

In this tutorial we will be using q2-fmt to investigating all of these criteron.

Chimeric Asymmetric Community Coalescence

First, we’ll assess the distance to donor (using Jaccard distance) to see how the recipient’s distance to their donor sample changes following the FMT. Before continuing, think about what you might expect to see. Should you expect a recipient’s gut microbiome composition to become more or less similar to their donor after FMT? How quickly would you expect to see that change? What do you expect would happen a few months or years after the transplant?

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt cc \
  --i-diversity-measure diversity-core-metrics/jaccard_distance_matrix.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-distance-to donor \
  --p-compare baseline \
  --p-time-column timepoints \
  --p-reference-column DonorSampleID \
  --p-subject-column PatientID \
  --p-filter-missing-references \
  --p-against-group 0 \
  --p-p-val-approx asymptotic \
  --o-stats jaccard-raincloud-stats.qza \
  --o-raincloud-plot jaccard-raincloud-plot.qzv

In the resulting raincloud plot, we see that following cancer treatment (Timepoint 0-2) the recipients distance to donor is relatively high.This seems to be naturally resolving itself but after FMT intervention(Timepoint 3) the recipient’s microbiome looks more similar to the donated microbiome. We see some stability in this but by the last time point the recipient’s microbiome mostly looks unique from its donated microbiome.

Community Richness

While FMT research is still in its infancy, some early studies suggest that long-term, the emergence of “personalize microbiome” is common after FMT, but in some cases features of the donated microbiome are retained. Let’s investigate this idea in an exercise.

The community richness at each timepoint seems to be considerably variable and is never sigificantly higher than the baseline. It does look like after FMT intervention the community richness of the recipients is less variable but again it is not significantly higher than baseline. The last timepoint has the lowest community richness but there are only 3 subjects that were sampled that long after FMT. This makes it hard to tell if that is representative of the whole population or if those individuals where sampled that long after FMT because of complications.

Distance to Baseline

Developing a personalized microbiome following FMT intervention is expected. Although, there is no expected threshold for the length of time before personalization starts. It is important that the recipients microbiome doesn’t return to their baseline composition. qiime fmt cc can help us investigate this!

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt cc \
  --i-diversity-measure diversity-core-metrics/jaccard_distance_matrix.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-distance-to baseline \
  --p-compare baseline \
  --p-time-column timepoints \
  --p-baseline-timepoint 0 \
  --p-subject-column PatientID \
  --p-filter-missing-references \
  --p-against-group 1 \
  --p-p-val-approx asymptotic \
  --o-stats baseline-jaccard-stats.qza \
  --o-raincloud-plot baseline-jaccard-raincloud-plot.qzv

Now lets look at the distance to their baseline. This will help us identify if the microbiome that emerges after FMT intervention is a unique personalized microbiome or if it is reverting to their baseline. Looking at this raincloud plot it looks like the microbiome always looks distinct from the baseline microbiome and that pattern continues all the way to the last timepoint. This probably indicates that the recipient microbiome following FMT is unique!

Proportional Engraftment of Donor Features (PEDF)

If you are interested in how many microbes from the donor engrafted in the recipient, Proportional Engraftment of Donor Features helps capture just that.

The above metrics capture how similar the recipient and donor microbiomes are. However, We want these microbiome to coalesce asymmetrically meaning that we want the donor’s features to be more prominment in the recipeint following FMT than baseline features. This metrics investigates this asymmetric colescence and captures how many donated features engrafted.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt pedf \
  --i-table diversity-core-metrics/rarefied_table.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-time-column timepoints \
  --p-reference-column DonorSampleID \
  --p-filter-missing-references \
  --p-subject-column PatientID \
  --o-pedf-dists pedf-dist.qza

Now, we have our PEDF metrics and we want to visualize them. Lets use qiime fmt heatmap.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt heatmap \
  --i-data pedf-dist.qza \
  --o-visualization pedf-heatmap.qzv

Looking at this output, timepoint 0 seems to have very low proportional engraftment of donor strains. However, we can see that there is a a kind of bi-modal distribution at timepoint 1. Some of the samples have a relatively proportional engraftment of donor strains and some of them have a relatively low proportional engraftment of donor strains . At timepoint 3, we can see that there is less variation between recipients. This lines up pretty well with what we were seeing with the raincloud plot. This makes sense because they both are investigating Community Coalesense!

Note: you can also use qiime stats plot-rainclouds to visualize this data! This will create plots more similar to the ouput of qiime fmt cc above.

Permutation Test of PEDF

Now an important question to ask is: “Is the overlap between features due to the FMT or are the similarities between these 2 microbiome by random chance”. That’s where pedf-permutation-test comes in!

PEDF permutation testrandomizes the relationships between donors and recipients, to test whether the PEDS score between a recipient and their actual donor is significantly higher than PEDS scores between other recipients paired with random donors.

Note that we are testing this on an equal amount of pre-fmt and post FMT samples and this will likely lead to a more conservative global test results.

Alright, Lets take a look 👀.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt pedf-permutation-test \
  --i-table diversity-core-metrics/rarefied_table.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-time-column timepoints \
  --p-reference-column DonorSampleID \
  --p-filter-missing-references \
  --p-subject-column PatientID \
  --p-sampling-depth 10000 \
  --o-actual-sample-pedf actual-sample-pedf.qza \
  --o-per-subject-stats per-subject-stats.qza \
  --o-global-stats global-stats.qza

We can now re-vizualize our heatmap and include these new stats that we created.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt heatmap \
  --i-data actual-sample-pedf.qza \
  --i-per-subject-stats per-subject-stats.qza \
  --i-global-stats global-stats.qza \
  --o-visualization pedf-stats-heatmap.qzv

We can see that there are many per-subject stats that where the simulated data(randomly paired recipients and donors) have higher PEDF than the true donor recipient pair but the majority of our comparisons are significant and globally are true pairs are significantly higher than our simulated donor recipient pairs.

Thats good news!

Proportional Persistence of Recipient Features (PPRF)

Proportional Persistence of Recipient Features (PPRF) investigates if there are any features from the recipients baseline that stick around after FMT intervention.

It is a very similar investigation to using fmt cc with the distance-to parameter set to baseline. This will again help us evaluate if a uniquew personalized microbiome is emerging or if the microbiome is reverting back to baseline.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt pprf \
  --i-table diversity-core-metrics/rarefied_table.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-time-column timepoints \
  --p-baseline-timepoint 0 \
  --p-filter-missing-references \
  --p-subject-column PatientID \
  --o-pprf-dists pprf-dist.qza

This can also be viewed using fmt heatmap!

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt heatmap \
  --i-data pprf-dist.qza \
  --o-visualization pprf-heatmap.qzv

From this visualization we can see that there is a relatively low presentage of persistant recipient features. Generally that’s a good sign of engraftment!

However, It looks like FMT.0035 has many persistant recipient features by timepoint 4. For an extra challenge go through our previous visualizations and see if you can identify any other signs of low engraftment extent!

Donated Microbiome Indicator Features

Another method that researchers commonly use to assess engraftment is donated microbiome indicator features

Currently, we do this by running ANCOMBC comparing the recipient at baseline to their donor. However because ancombc can not be run on dependent samples (i.e. a patient over time), we are not able to compare the baseline recipient to their donor because in this case they are the same patient.

However, some people investigate microbes that other papers reported as imported. We will investigate if the feature was in the donated microbiome and if the recipient recieved the feature.

This review reported that the class of Clostridia is correlated with positive health outcomes.

So here we are going to use q2-longitudinal to track the relative abunadnce of Clostridia over time. This will help us identify if the donated microbiome had the previously reported feature and if the recipients recieve this feature.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
wget -O 'taxonomy.qza' \
  'https://q2-fmt.readthedocs.io/en/latest/data/tutorial/taxonomy.qza'

Lets use this Taxonomy to collapse our table at level three or Class.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime taxa collapse \
  --i-table feature-table.qza \
  --i-taxonomy taxonomy.qza \
  --p-level 3 \
  --o-collapsed-table collapsed3-table.qza.qza

Let’s transform this feature-table into relative frequency feature table. This will allow us to look at relative frequency instead of raw counts that can be misleading.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime feature-table relative-frequency \
  --i-table collapsed3-table.qza.qza \
  --o-relative-frequency-table collapsed3-table-rf.qza.qza

Now we are ready to use q2-longitudinal to track our previously identified feature

Tracking Features with q2-longitudinal

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime longitudinal linear-mixed-effects \
  --m-metadata-file sample-metadata.tsv collapsed3-table-rf.qza.qza \
  --p-state-column day-relative-to-fmt \
  --p-group-columns autoFmtGroup \
  --p-individual-id-column PatientID \
  --p-metric 'k__Bacteria;p__Firmicutes;c__Clostridia' \
  --o-visualization lme-clostridia-treatmentVScontrol.qzv

Looking at this it looks like both the control and FMT groups had Clostrida in relatively low abundances. Both Groups seems to have in increase in Clostrida over time, which is good becuase we know thats correlated with postive treament outcomes. However, there is no significant change between groups. This suggests that Clostrida is not a great donor indicator for this group of patients.

Check back soon for more updates on tracking donated microbiome indicator features using ANCOMBC2 which will allow for repeated sampling!

Feature Engraftment

Feature engraftment doesn’t “assess engraftment” of a recipient but instead investigates if there are features that engraft across all subjects. This will help researchers understand which features are sucessfully engrafting and help them decide which successfully engrafted features correlate with postive clinical outcome.

This could be utilized to help researchers decide on specified communities to donate (as opposed the black-box commmunity approach we have currently). This specified communities would be full of microbes that have successfully engraftment accross patients and are associated with postive clincal outcomes.

Since we previously looked at the Clostrida, lets continue look at how our classes engraft accross subjects.

Let’s take a look now and see if we have any features that are sucessfully engrafting accross subjects.

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt prdf \
  --i-table collapsed3-table.qza.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-time-column timepoints \
  --p-reference-column DonorSampleID \
  --p-subject-column PatientID \
  --p-filter-missing-references \
  --o-prdf-dists pfdf-dist.qza

And again, Visualize the data using qiime fmt heatmap. We are using the level-delimiter parameter here so that the taxonomic strings will only show the lowest relevant taxonomic level!

[Command Line]
[Python API]
[Galaxy]
[R API]
[View Source]
qiime fmt heatmap \
  --i-data pfdf-dist.qza \
  --p-level-delimiter ';' \
  --o-visualization feature-heatmap.qzv

Oh look! Clostridia seems to be a feature that consistantly engrafts from our donor! It seems like it doesnt engraft “better” than spontanous recover but it is a consistant engrafter. Firmicutes also seems to pretty consistently engraft but it is important to note that our N for this study is quite small. Bacilli seems to engraft sucessfully too but its also present before the FMT so its hard to tell if thats from the donor or just a common gut 🐛 bug!

Overall in this study it seems that we have Asymetric Chimeric Community Coalesense. We also have stability in our shift towards the donated microbiome as there are no signs that our subjects are reverting back to baseline. From these factors I would conclude that we have relatively high engraftment extent and clincal findings are probably due to FMT engraftment. I would love to see more donated microbiome indicator species to further support this claim!

References
  1. Schloss, P. D. (2024). Rarefaction is currently the best approach to control for uneven sequencing effort in amplicon sequence analyses. mSphere, 9(2), e0035423.
  2. Raspet, I., Gehret, E., Herman, C., Meilander, J., Manley, A., Simard, A., Bolyen, E., & Caporaso, J. G. (2024). Facilitating bootstrapped and rarefaction-based microbiome diversity analysis with q2-boots. arXiv [q-Bio.QM].
  3. Herman, C., Barker, B. M., Bartelli, T. F., Chandra, V., Krajmalnik-Brown, R., Jewell, M., Li, L., Liao, C., McAllister, F., Nirmalkar, K., Xavier, J. B., & Gregory Caporaso, J. (2024). Assessing Engraftment Following Fecal Microbiota Transplant. ArXiv, arXiv:2404.07325v1. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC11042410/