Beta diversity within a group

Hi,

Anyone knows how i can calculate Beta diversity within the same group? For example i have 2 groups, one control and one of diabetes patients and i would like to know beta diversity within each group.

Hi @annsantos,

Like, you want to extract the within-group distances? The average within-group beta diversity? A PCoA of only those samples?

I would recommend that you use your full beta diversity table and then use qiime diversity filter-distance-matrix to select your samples. (You don’t need to re-calculate). And then, you can do whatever you want to do with that.

Best,
Justine

2 Likes

Hi @jwdebelius,
Thank you for your reply. Yes, i want to know beta diversity of my control group and then of my diabetes patients . I don’t want to compare my groups, i want to look each group individually .

What do you mean with “full beta diversity table”? How do i get that?

The “full beta diversity table” (or if Im more accurate, the full distance matrix) is the distance matrix that you calculate for all your samples. It saves you computational time if you calculate this once for all your samples and then filter it using the command I described above.

Best,
Justine

2 Likes

what you’re saying is using this, for example ? “core-metrics-results/bray_curtis_distance_matrix.qza”

1 Like

There is a way to do inter- and intra- group beta-diversity in phyloseq. I think there’s been some code written on it. See this: https://github.com/joey711/phyloseq/issues/963

Ben

1 Like

Yes, that’s your distance matrix object. And then you can feed it into filter distance matrix and you’ll get the distances for your groups. Its useful if you want to run a stratified analysis - check, for example, if there’s an effect of age on community structure.

I’m still pretty firmly in the camp that within-group beta diversity doesn’t do you much without a point of comparison. So, like, is within 1 different from within another (although perhaps worth noting that there is some difference of opinion on where you can make this comparison.)

Best,
Justine

3 Likes

So, with qiime it is not possible to calculate beta diversity (within a group) without a point of comparison?

1 Like

Beta diversity, as an abstract concept, is the distance between two communities (samples). So, from the abstract standpoint, yes, QIIME calculates beta diversity agnostic to whatever sample labels we put on. Which is why you can calculate your distance matrix in core diversity and then do whatever you want with it.

My question is what your goal is with the within-group beta diversity. Do you want a PCoA? A stratified sensitivity analysis? A number to rule them all that says this is my beta diversity :gem:? Because those are really different intra-group beta diversity things and figuring out what you mean here depends on what the best approach is.

One of the problems you run into is that beta diversity does best in a frame of reference. With geographical distance (my favorite analogy), you have a sense of what 3 km means in real and concrete terms. So, if all the landmarks in the city center are all no more than 3 km away from eachother, that boundary has real meaning. One of the issues with beta diversity from that perspective is that not only do the numbers not have units, they sometimes lack context.

And so, my question is what context you want to use for your within-group comparison and what answer you want out.

5 Likes

Yes, you are right. I was confused. What i wanted to do was to see beta diversity in my groups, so my point of comparison would be groups (control x diseased) . So, i think that i have to do something like this:

qiime diversity beta-group-significance
–i-distance-matrix core-metrics-results/Braycurtis_distance_matrix.qza
–m-metadata-file metadata.tsv
–m-metadata-column group
–o-visualization core-metrics-results/Braycurtis-group-significance.qzv

Right?

Thank you

1 Like

Yeah, I would use a permanova (as you’ve shown) to test for significance.
And, figuring out this stuff and what you want test you want to show what you want to show? I spend hours trying to work through this stuff.

Best,
Justine

I am not sure if i understood what you mean but, basically, i wanted to see if my groups (control x diseased) had a different beta diversity and then, to see if the differences within goups were smaller then between groups.

I know, i am new with this stuff and sometimes i spend almost half aday to figure things out. I am so glad for this forum

2 Likes

This is your permanova:

qiime diversity beta-group-significance 
–i-distance-matrix core-metrics-results/Braycurtis_distance_matrix.qza 
–m-metadata-file metadata.tsv 
–m-metadata-column group 
–o-visualization core-metrics-results/Braycurtis-group-significance.qzv

This will be a permdisp (just add the --p-methods permdisp) flag to your command and save as a different artifact

qiime diversity beta-group-significance 
--i-distance-matrix core-metrics-results/Braycurtis_distance_matrix.qza \
--m-metadata-file metadata.tsv \
--m-metadata-column group \ 
--p-method permdisp
--o-visualization core-metrics-results/Braycurtis-group-significance-permdisp.qzv

Best,
Justine

2 Likes

Right,

But, permdisp it is only used when p value is <0.05 in permanova right? To rule out differences due to a high degree of dispersion (within-group variance) in one of the groups of interest.?

That would be a good time to run permdisp. I tend to run them together, because it makes my life easier.

Best,
Justine

1 Like

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