JHarrisonEcoEvo / CNVRG

2 stars 2 forks source link

interpretation of `diff_abund` outputs #3

Open Gian77 opened 8 months ago

Gian77 commented 8 months ago

Hi @JHarrisonEcoEvo,

Can you provide an explnation of what denotes differentially abudant features from the output of diff_abund function? I tried to follow your RPubs vignette and read the paper, but this point isn't touch anywhere. The video isn't available anymore too.

This is the result of my differential abundance below

 > str(diff_abund_test)
List of 3
 $ certainty_of_diffs    :'data.frame': 2 obs. of  375 variables:
  ..$ comparison: chr [1:2] "treatment_1_vs_treatment_2" "treatment_2_vs_treatment_1"
  ..$ ASV_1     : num [1:2] 1 0
  ..$ ASV_2     : num [1:2] 0.718 0.282
  ..$ ASV_3     : num [1:2] 1 0
  ...
  ..$ ASV_280   : num [1:2] 0.122 0.878
  ..$ ASV_284   : num [1:2] 0.246 0.754
  ..$ ASV_290   : num [1:2] 0.182 0.818
  .. [list output truncated]
 $ ppd_diffs             :List of 2
  ..$ :List of 2
  .. ..$ : NULL
  .. ..$ : num [1:500, 1:374] 0.1003 0.1046 0.0988 0.0968 0.0954 ...
  ..$ :List of 1
  .. ..$ : num [1:500, 1:374] -0.1003 -0.1046 -0.0988 -0.0968 -0.0954 ...
 $ features_that_differed:List of 2
  ..$ treatment_1_vs_treatment_2:'data.frame':  76 obs. of  3 variables:
  .. ..$ feature_that_differed    : chr [1:76] "ASV_1" "ASV_3" "ASV_4" "ASV_6" ...
  .. ..$ probability_of_difference: chr [1:76] "0" "0" "0" "0" ...
  .. ..$ effect size              : num [1:76] 0.0998 0.0455 0.04377 -0.01052 -0.00576 ...
  ..$ treatment_2_vs_treatment_1:'data.frame':  67 obs. of  3 variables:
  .. ..$ feature_that_differed    : chr [1:67] "ASV_1" "ASV_3" "ASV_4" "ASV_6" ...
  .. ..$ probability_of_difference: chr [1:67] "0" "0" "0" "0" ...
  .. ..$ effect size              : num [1:67] -0.0998 -0.0455 -0.04377 0.01052 0.00576 ...

In particular, I only have two treatments, how should I interpret the comparison? For example in ASV_1, since treatment_1_vs_treatment_2 is 1 and treatment_2_vs_treatment_1 is 0, this means that all the samples in treatment_1 have a higehr abundance that in treatment_2, is that correct?

> diff_abund_test$certainty_of_diffs[, 1:5]
                  comparison ASV_1 ASV_2 ASV_3 ASV_4
1 treatment_1_vs_treatment_2     1 0.718     1     1
2 treatment_2_vs_treatment_1     0 0.282     0     0

Additionally, regarding the diff_abund_test$features_that_differed output, what are the probability_of_difference, and effect size?

> diff_abund_test$features_that_differed
$treatment_1_vs_treatment_2
   feature_that_differed probability_of_difference   effect size
2                  ASV_1                         0  0.0997955775
3                  ASV_3                         0  0.0455009406
4                  ASV_4                         0  0.0437733464
5                  ASV_6                         0 -0.0105174712
6                  ASV_7                         0 -0.0057560404
7                  ASV_8                         0 -0.0076385011
8                  ASV_9                      0.04 -0.0017086911
9                 ASV_18                     0.016  0.0018359843
10                ASV_19                      0.01  0.0029526557
11                ASV_22                     0.004 -0.0029612584
12                ASV_29                      0.04 -0.0005824602
...

Thanks much, I think many will benefit for this clarifications.

Gian

JHarrisonEcoEvo commented 7 months ago

Hi Gian,

Yes, in the 'certainty_of_diffs' object, a 1 or 0 means all the samples had higher/lower abundance in one treatment group than the other.

Regarding the output of diff_abund_test$features_that_differed the effect size is the mean of the posterior probability distribution of the differences in parameters between the treatment groups. The probability of the difference refers to where zero is in that posterior distribution of differences. See lines 286 and onwards in converg_func.R.

Gian77 commented 7 months ago

Hi Josh, thanks for th reply. So the higher the probability_of_difference the more likely an ASV has a difference in the treatment_1_vs_treatment_2 comparison, and the effect size is the difference in relative abundance (or read counts) between the two conditions, right? Thank you, Gian