I have some doubts when I perform the longitudinal pairwise-distances of my samples.
I have samples of ear microbiota (dx and sx of the same subject) from both healthy and sick animals.
I want explore if there is a beta diversity among the samples (consider DX vs SX) it is correct apply this script?
I did a test but the result was the following:
qiime longitudinal pairwise-distances
--p-state-1 Healthy --p-state-2 Affected
I’ll give a try, but I’m not strong at longitudinal analysis and I am woking on it too.
My understanding is that in the comparison you are performing, the longitudinal plug in expects all subject to have an affected ear as well as an healthy ear, so the plug in highlight the subject were subjects are healthy or ill in both ears.
There are cases that I can not explain form what you send, such as subject 7 which seems to have both but it is in the odd list too. I suppose the beta diversity distance matrix is obtained after rarefaction, are both sample related to subject 7 passing the rarefaction threshold?
Hi Luca and thaks for your consideration.
I post only a part of my metadata file with the purpose to shown in wich way I had organized my data.
The subject 7 in particular has a monolateral otitis so one healthy ear and and one sick ear, for this reason I report the metadata in this way.
make sense the way you organised the data, I would expect from that the the process would work for subject 7, that why I don’t understand it.
My main point was to subset the data to keep only subjects that has monolateral otitis like subject 7!
Since you are sampling left and right ears from each animal, you want to use Side as the state-column if you are trying to compare left vs. right ears.
group-column should be some other metadata group that you’d like to compare across subjects. I’d recommend making a new column that describes the animals as sick if at least one ear is infected, and healthy if both ears are uninfected.
Alternatively, you could use Diagnosis as the state column (that seems more biologically interesting and probably what you are after), but in that case group-column should be some metadata category that describes the animal (not the ear, since this will be exclusive to one ear or another and is causing issues with your command) and that you want to compare (presumably you are interested in doing something like comparing by age or breed, rather than which side the ear is on?)
Since you are grouping by “side” there is no pair for any sample (since replicates are not being taken), so using side as the group column is causing this error.
I hope that helps! And thank you @llenzi for helping out!
thanks Nicholas for you suggestion...
I try also this script:
qiime longitudinal pairwise-distances
Yes looks like this is working now, and the way you have set it up you are testing this question:
are DX and SX more similar in healthy or affected animals? (null hypothesis is that DX and SX are equally dissimilar in healthy and affected)
However, it is dropping any animals that have only one healthy ear (since each ear winds up in a separate group and has no pair), hence my suggestion above to make a new metadata column that defines an animal as “healthy” only if both ears have a healthy diagnosis, and affected if either ear is affected.
pairwise-distances is not a very good test for this, since it is set up to determine if one group of paired samples has greater within-subject distance than another group. So this is a good test if you want to see if affected animals have greater distance between Dx and Sx than healthy animals, but it does not determine if Dx and Sx are different in general (since distance will always be > 0, you can’t test the null hypothesis that mean distance between Dx and Sx = 0).
A paired test is certainly appropriate here, but it may be better to use pairwise-differences on the PCoA results, whether or not you set a group-column. That test will tell you whether you see a directional shift in the PCoA results (or alpha diversity, etc) between sides regardless of group membership.
Just last thing Nicholas, can you confirm me that with the graph I have produced (distance_wei) I can say that in case of illness there is a greater difference in the microbiota between DX and SX rather than in healthy subjects? Is this the right interpretation? this serves me to support the rest of the data that I have produced, for this reason I want to be sure I understand correctly.
thank you very much
I’m following this because as I said I want to understand better longitudinal analysis myself and always get confused on how to set the groups in here!
Did you used a metadata category to specify “healthy” and “affected” (as in @Nicholas_Bokulich suggestion)? If so, are you keeping as “affected” animals with otitis in both ears? If I am thinking correctly, I would expect the within-subject distance for this group smaller then the within-distance for the group with only one affected ear. Hence, would this skew your results?
I am not sure why looking at difference between DX and SX (right ear and left ear for not Italian speaking …), rather than hill vs healthy. I mean, in average the otitis should affect equally both left and right, isn’t it? What I agree is that the difference is still there, what I am not sure of, is the following:
DX(healthy) vs SX(hill) -> difference +
DX(hill) vs SX(healthy) -> difference -
When you look at the overall group, are these two going counterbalancing each other? (If the longitudinal plug in look at absolute values this should not be a problem ???)
(Unless of course you want to investigate if one side is more affected than the other I guess …)
Hope make sense and do not increase the confusion!
I tried to add the category as indicated by Nicholas but it doesn’t work, probably because of the way in which my data are organized.
However, I am interested in knowing how to interpret the data that I have produced, also because during the analysis the software automatically eliminates those subjects with unilateral disease, consequently it is not a problem if, for example, the right ear is healthy and the left one is sick.
Thanks for you interest, I’m happy if the collaboration can help us to understand better how to conduct the analysis and interpret the data.
Yes, that is correct. HOWEVER, this is only including subjects with the same diagnosis on each side. So it is interesting, e.g., it suggests that illness --> dysbiosis --> less stability and consistency between ears. But it is excluding animals that had one healthy and one affected ear.
The comparison is between the groups — affected vs. healthy — but it is comparing the distances between left and right ear. I will let @rparadiso explain the motivations for this analysis but it makes perfect sense to me in that comparison of DX vs. SX will be a measure of microbial community stability, in a sense.
if you can describe the issue, I can help you work through this (if it is of interest to you). Maybe the way to approach it is to create a new metadata column with three different values:
healthy: if both sides are healthy
affected: if both sides are affected
unilateral: if only one side is affected
with the hypothesis that unilateral disease would lead to even greater distance between DX and SX. (but maybe that’s not of interest — just posing the idea in case this is what you are trying to test, not stability in subjects excluding unilateral disease)
Yes, that's exactly the sense, and yes the script that I had use exclude automatically the animal with monolateral illness.
I added a new column as you suggest at my metadata file metadata.tsv (1.5 KB)
this is the coomand line:
qiime longitudinal pairwise-distances
Plugin error from longitudinal:
State DX is not represented by any members of DX group in metadata. Consider using a different group_column or state value.
Debug info has been saved to /var/folders/nk/qyjfz4t11vn5vnx07bkphqrw0000gn/T/qiime2-q2cli-err-6avm6944.log
Can you help me?
Thanks in advance, you have already been a great help for me, I would do this last test just to see what comes out but what we have already done could be enough.
Based on the file you sent, it looks like the issue is that the header column is not present? I've modified the sample metadata you sent before with a new "Diagnosis_Parity" column following the definitions in my previous post... does this work?