q2-longitudinal for crossover design with 3 interventions

Hi everyone!

I was involved in a randomized crossover controlled trial with 3 interventions administered in a random order. As part of this trial, we collected stool samples across 6 time points: at the start and end of each of the 3 interventions. For each of our clinical outcomes (e.g. body weight), we are running a repeated measure linear mixed model adjusted for baseline levels (start of intervention 1; start of intervention 2; start of intervention 3), COVID status and randomization sequence. The output gives us the margins for each pairwise comparisons (intervention 1 vs. 2; 1 vs. 3; 2 vs 3).

I would like to analyze the microbiome similarly. I was playing around with q2-longitudinal, first-distances, feature-volatility and linear-mixed-effects plugins, but it seems like I can only specify one baseline period/state and all other states are compared to that state. However, we have 3 baseline states (as described above).

Do I need to run the longitudinal feature-volatility and first-distances separately for each of my interventions? Meaning I would run 3 analyses, each with 2 time points (start and end). Or am I missing something in the q2-longitudinal documentation?

UPDATE: I have filtered my samples to only keep 1 intervention at a time (start and end of each interventions) and tried running longitudinal linear-mixed-effects, but I cannot as described in this post. I cannot run pairwise-differences as linear-mixed-effects is more appropriate to my data and study protocol.

Thank you!!

Hi @sabrinaayoubcharette ,

Yes, I would recommend filtering to each pair of timepoints and running first-distances, or else going outside of QIIME 2 if you need a more specialized statistical test.

If you are getting that error it implies that you filtered to only have one time point, not two. You should make sure that you have two time points represented at each intervention stage, and that you are setting the appropriate "state" value to indicate time, not treatment.

If that's still not working, please share the commands that you are using and the full error message and I will see if I can spot an issue.

Good luck!


Thank you so much @Nicholas_Bokulich! I appreciate your response.

I continued playing around with the different functions of this plugin, and ended up really liking the pairwise-distances function.

What is the difference between running 3x 'first-distances' analyses each with 2 time points (as you recommended) vs. using the 'pairwise-distance' function like this:
qiime longitudinal pairwise-distances
--i-distance-matrix weighedUniFrac.qza
--m-metadata-file clinical_metadata.tsv
--p-group-column drink . #this is my intervention variable
--p-state-column start_end \ #this is my time variable
--p-state-1 0
--p-state-2 1
--p-individual-id-column BlindedID
--p-parametric True
--p-replicate-handling 'random'
--o-visualization first-distances-pairwise.qzv

I also attempted to do as you recommended: 1) filtered my samples to only keep 1 intervention at a time with 2 time points, and made sure that there were in fact 2 time points in my filtered file. 2) running first-distances:
qiime longitudinal first-distances
--i-distance-matrix weighedUniFrac.qza
--m-metadata-file clinical_metadata.tsv
--p-state-column start_end \ #time variable
--o-first-distances first-distances.qza
--p-individual-id-column BlindedID
--p-replicate-handling random

then, 3) running linear-mixed-effects on 2):
qiime longitudinal linear-mixed-effects
--m-metadata-file clinical_metadata.tsv
--m-metadata-file first-distances.qza
--p-metric Distance
--p-state-column start_end
--p-individual-id-column BlindedID
--p-group-columns sequence_num,DuringCOVID
--o-visualization first-distances-LME.qzv

And this is the error message I get:
Plugin error from longitudinal:

state_column must contain at least two unique values. Values in start_end: [1.]

Debug info has been saved to /var/folders/ls/344d89x91vn44bb6jrd1qg900000gn/T/qiime2-q2cli-err-e6fj6ifj.log

Probably because 'first-distances' computes the difference in distances between state 0 and state 1, which gives me only 1 variable (=∆ from baseline) - but please confirm if I am misinterpreting something!



Hi @sabrinaayoubcharette

Yes you are correct, these are basically equivalent though only pairwise-distance actually performs a statistical test. I meant to suggest using pairwise-distnace, not first-distance, for this reason but mis-spoke. Thanks for the correction, I have edited my suggestion above to fix this.

Yes your interpretation is correct. I meant to suggest pairwise-distances when filtering data like this, so that you look at the pairwise distances across each time interval. That action should work on the filtered data (as the time signature remains intact).