Skip to content

Commit d7964c1

Browse files
committed
avoid incorrect intersection of significant results in comparisons
1 parent 542f9f9 commit d7964c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

R/functions.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,14 @@ test_limma <- function(se, type = c("control", "all", "manual"),
592592
dplyr::mutate(variable = dplyr::recode(variable, logFC = "diff", P.Value = "p.val", adj.P.Val = "p.adj")) %>%
593593
tidyr::unite(temp, comparison, variable) %>%
594594
tidyr::spread(temp, value)
595+
596+
# avoid wrong order of similar comparison names
597+
comp_list <- sort(gsub(" - ", "_vs_", cntrst))
598+
ordered_colNames <- c("rowname" ,
599+
lapply(comp_list, function(x) colnames(table)[grep(paste0(x, "(_CI.L|_CI.R|_diff|_p.adj|_p.val)"), colnames(table))]) %>% unlist())
600+
601+
table <- table %>% select(all_of(ordered_colNames))
602+
595603
rowData(se) <- merge(rowData(se), table,
596604
by.x = "name", by.y = "rowname", all.x = TRUE)
597605
return(se)

0 commit comments

Comments
 (0)