longitudinal pairwise-distances: State error

Hello,

Thank you for providing this valuable tool.

I had trouble with the longitudinal pairwise-distances command listed in
https://docs.qiime2.org/2023.9/tutorials/longitudinal/#pairwise-distance-comparisons

The example given in the tutorial work well, but I encountered an issue while working with my data generated by the following command:

qiime diversity core-metrics-phylogenetic

When I do the command below:

qiime longitudinal pairwise-distances
--i-distance-matrix core-metrics-results_14454/unweighted_unifrac_distance_matrix.qza
--m-metadata-file mapping.tsv
--p-group-column Lot
--p-state-column Time_num
--p-state-1 3
--p-state-2 10
--p-individual-id-column Animal
--o-visualization pairwise-differences_unweightedunifrac.qzv

I received the following message:

Plugin error from longitudinal:

State 3.0 is not represented by any members of 0 group in metadata. Consider using a different group_column or state value.

Strangely, I don't have problem with longitudinal pairwise-differences which takes almost the same data (except the distance matrix replaced by shannon vector):

qiime longitudinal pairwise-differences
--m-metadata-file mapping.tsv
--m-metadata-file core-metrics-results_14454/shannon_vector.qza
--p-metric shannon_entropy
--p-group-column Lot
--p-state-column Time_num
--p-state-1 3
--p-state-2 10
--p-individual-id-column Animal
--o-visualization pairwise-differences_shannon_volame3_3-10.qzv

Thank you for your assistance, and have a great day!
Jérémy Tournayre

I have conducted additional tests.
I believe I have solved my problem by keeping only the same samples between the mapping file and the distance matrix. I don't have to do that with longitudinal pairwise differences, perhaps it's normal?"

Jérémy Tournayre

Hi @JeremyTournayre,

Apologies for the delay in response on this! I'm looking into this now and will follow up with you shortly. Cheers :lizard:

2 Likes

Hi @JeremyTournayre,

So pairwise-differences is used determine whether the value of a specific metric changed significantly between pairs of paired samples (e.g., pre- and post-treatment). The values in each group need to be present across all values in the chosen state column in order for this test to be executed. To use the example data from the longitudinal tutorial, both groups from the delivery column (which was the chosen group column) need to have data across all timepoints in the chosen state column (the month column in this example).

pairwise-distances also assesses changes between paired samples from two different “states”, but instead of taking a metadata column or artifact as input, it operates on a distance matrix to assess the distance between “pre” and “post” sample pairs, and tests whether these paired differences are significantly different between different groups, as specified by the group-column parameter. So for this method, all values in the distance matrix must be present within the specified groups (again, delivery if using the tutorial example) across the timepoints specified from the state column (month from the tutorial example).

Even though your commands look very similar, you are inherently looking at different data (i.e. different metrics) in the two methods you're using above. The issue you're running into is that when examining the unweighted unifrac distance matrix, within your chosen state column (Time_num), there aren't any associated samples with a value of 0 under the Lot group at Time_num 3. This is inherently different from the data associated with your shannon vector.

So essentially, in pairwise-distances you need to have values across all timepoints but in pairwise-differences you need to have values for all pairs at all timepoints. This is why (depending on your data and chosen inputs) you can sometimes 'get away' with missing data in pairwise-differences but not in pairwise-distances.

Hope this helps! Cheers :lizard:

3 Likes

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.