barakbri / dacomp

Non parametric differential abundance tests for microbiome data
9 stars 1 forks source link

Effect size #6

Closed kunstner closed 2 years ago

kunstner commented 2 years ago

Hi @barakbri,

thanks for your package for differential abundance analysis. I was wondering whether you could adjust the output for estimated effect sizes by adding a sign to denote the direction of the effect size and not by providing a string describing the ordering of mean ranks? This way it would be easier to integrate your method in a general workflow.

Many thanks, Axel

barakbri commented 2 years ago

Hi @kunstner , Thanks for considering DACOMP, and also for raising the above issue Currently dacomp.test does not require group labels as an input. In order to compute the sign for the effect size I will need to have the user input what is the label for the treatment group, and what is the label for the control group. Alternatively, dacomp.test could decide this arbitrarily. I am currently adding some additional tests to the package, so I will have to think on how add this in a modular manner (including also labels for covariates, multiple outcomes, strata, etc...)

For the time being I suggest using the following simple solution: DACOMP always uses <= (i.e., doesn't use >=) hence the sign can be computed using this approach:

DACOMP_EFFECT_STRING_TO_SIGN=function(STR,Group_C,Group_T){
  split_string = strsplit(STR,split = '<=')[[1]]
  sign(which(split_string == Group_T) - which(split_string == Group_C))
}

DACOMP_EFFECT_STRING_TO_SIGN( 'C<=T',Group_C = 'C',Group_T = 'T')
#OUTPUT: 1
DACOMP_EFFECT_STRING_TO_SIGN( 'T<=C',Group_C = 'C',Group_T = 'T')
#OUTPUT: -1
DACOMP_EFFECT_STRING_TO_SIGN( 'T<=FOO<=BAR<=C',Group_C = 'C',Group_T = 'T')
# OUTPUT ALSO -1, disregarding other groups..

Hope this helps, And hoping to add the requested feature soon, Barak

kunstner commented 2 years ago

Thank your for your quick reply, @barakbri. I was thinking of a similar work around.

Best, Axel