Globaltest in the MetaboAnalystR package

I had a question about the implementation of Globaltest in the MetaboAnalystR package with the CalculateGlobalTestScore function.

Specifically, I’ve been trying to reproduce the output of this function using the gt function in the globaltest package. The original Metabolite Set Enrichment Analysis paper implies that the linear modeling version of the globaltest is applied for MetaboAnalyst. However I’ve found that this version of the test can’t be applied to data with binary outcomes. When I apply the logistic version of the test, I get almost every pathway returned as significant, even with multiple test correction.

Could you give any insight on how the test is performed in the package? Any help would be much appreciated.

Thanks for the question. I am not sure if I know the answer. The description of GlobalTest you refer to was based on the 2010 MSEA paper. It is possible that the globaltest package might have changed over the past 12 years.

The MetaboAnalystR is open source at the XiaLab GitHub. You should be able see all the R code underlying the CalcualteGlobalTestScore function. Please let us know if you have specific comments or suggestions

Thanks Jeff. I did try this approach but it seems that the actual globaltest function call is done via microservice using the .perform.computing function:

.perform.computing <- function(){
  dat.in <- qs::qread("dat.in.qs");
  dat.in$my.res <- dat.in$my.fun();
  qs::qsave(dat.in, file="dat.in.qs");  
}

I’m not familiar with how to follow the trail past this point. Is the microservice code publicly available somewhere?

I see. This is for our web server. You need to use the code right below.

mSetObj <- .prepare.globaltest.score(mSetObj);

Inside this function, I think these lines are related to your question:

  my.fun <- function(){
    gt.obj <- globaltest::gt(dat.in$cls, dat.in$data, subsets=dat.in$subsets);
    gt.res <- globaltest::result(gt.obj);
  ......
  }

Thank you Jeff. It does look like the logistic version of the test is the one being used when a discrete outcome is being evaluated.