Skip to content

Commit 6d4b729

Browse files
committed
ensure correct order of outputs
in particular for paired tests, where additional features might be excluded
1 parent 3e4f990 commit 6d4b729

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: structToolbox
22
Type: Package
33
Title: Data processing & analysis tools for Metabolomics and other omics
4-
Version: 1.5.4
4+
Version: 1.5.5
55
Authors@R: c(
66
person(
77
c("Gavin","Rhys"),

R/ttest_class.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ setMethod(f="model_apply",
165165
y=D$sample_meta[[M$factor_names]]
166166

167167
# sort the data by sample id so that theyre in the right order for paired ttest
168-
temp=D$sample_meta[order(D$sample_meta[[M$factor_names]],D$sample_meta[[M$paired_factor]]),]
168+
temp=D$sample_meta[order(D$sample_meta[[M$factor_names]],D$sample_meta[[M$paired_factor]]), ]
169169
D=D[rownames(temp),]
170170

171171
# check number per class
@@ -224,6 +224,8 @@ setMethod(f="model_apply",
224224
output=merge(temp,as.data.frame(t(output),stringsAsFactors = FALSE),by=0,all=TRUE,sort=FALSE)
225225
rownames(output)=output$Row.names
226226
output=output[,-1]
227+
# ensure outputs are in the correct order (TODO: update to data.frame with rownames)
228+
output=output[CN,]
227229
output$p.value=p.adjust(output$p.value,method = param_value(M,'mtc'))
228230
output_value(M,'t_statistic')=output$statistic.t
229231
output_value(M,'p_value')=output$p.value

R/wilcox_test_class.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ setMethod(f="model_apply",
9999
y=D$sample_meta[[M$factor_names]]
100100
L=levels(y)
101101
if (length(L)!=2) {
102-
stop('must have exactly two levels for this implmentation of t-statistic')
102+
stop('must have exactly two levels for this implementation of t-statistic')
103103
}
104104

105105
if (M$paired){
@@ -128,7 +128,7 @@ setMethod(f="model_apply",
128128
D=D[!(D$sample_meta[[M$paired_factor]] %in% out),]
129129
y=D$sample_meta[[M$factor_names]]
130130

131-
# sort the data by sample id so that theyre in the right order for paired ttest
131+
# sort the data by sample id so that they're in the right order for paired ttest
132132
temp=D$sample_meta[order(D$sample_meta[[M$factor_names]],D$sample_meta[[M$paired_factor]]),]
133133
D=D[rownames(temp),]
134134

@@ -154,6 +154,8 @@ setMethod(f="model_apply",
154154
output=merge(temp,as.data.frame(t(output),stringsAsFactors = FALSE),by=0,all=TRUE,sort=FALSE)
155155
rownames(output)=output$Row.names
156156
output=output[,-1]
157+
# ensure outputs are in the correct order (TODO: update to data.frame with rownames)
158+
output=output[CN,]
157159
output$p.value=p.adjust(output$p.value,method = param_value(M,'mtc'))
158160
if (M$paired) {
159161
output_value(M,'statistic')=output$statistic.V

0 commit comments

Comments
 (0)