I've been working with MetaboAnalystR both on web and on my computer. Trying to replicate some data I noticed that my values obtained from a manual Kruskal-Wallis test to check missing-value patterns differed from those given by MetaboAnalyst code.
After some comparison between both scripts, mine and MetaboAnalystR, which is executed within the function SanityCheckData, I found a possible source of the problem:
if(mSetObj$dataSet$cls.type == "disc" && length(levels(cls)) > 1){
miss.msg <- "";
print(cls)
kw.p <- .test.missing.sig(int.mat, cls);
CLS object is the original unmodified factor of grouping, although int.mat is the version of original data with a reordering of samples grouped by cls. This way, after the reordering, cls is unchanged and gets incorrectly correlated to the samples within the data.
One solution could be, before this line of code, adding a reassignment of the variable, like:
cls<-cls[ord.inx]
I found this while on debug mode of .test.missing.sig function and checking if rownames(int.mat) and cls had the same order.
I've been working with MetaboAnalystR both on web and on my computer. Trying to replicate some data I noticed that my values obtained from a manual Kruskal-Wallis test to check missing-value patterns differed from those given by MetaboAnalyst code.
After some comparison between both scripts, mine and MetaboAnalystR, which is executed within the function SanityCheckData, I found a possible source of the problem:
CLS object is the original unmodified factor of grouping, although int.mat is the version of original data with a reordering of samples grouped by cls. This way, after the reordering, cls is unchanged and gets incorrectly correlated to the samples within the data.
One solution could be, before this line of code, adding a reassignment of the variable, like:
cls<-cls[ord.inx]I found this while on debug mode of .test.missing.sig function and checking if rownames(int.mat) and cls had the same order.