From e698d45e856fd43ad29d04ba2288f12b903dd0db Mon Sep 17 00:00:00 2001 From: Holger Brandl Date: Wed, 18 Apr 2018 09:48:16 +0200 Subject: [PATCH] fixed output prefixing in limma workflow --- dge_workflow/limma/dge_limma.R | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dge_workflow/limma/dge_limma.R b/dge_workflow/limma/dge_limma.R index 27a2e63..6441a76 100755 --- a/dge_workflow/limma/dge_limma.R +++ b/dge_workflow/limma/dge_limma.R @@ -48,7 +48,7 @@ designFormula = opts$design assert(str_detect(designFormula, ".*condition$")) -results_prefix = if (str_length(opts$out) > 0) paste0(opts$out, ".") else "" # used by add_prefix +results_prefix = if (str_length(opts$out) > 0) opts$out else "" # used by add_prefix pcutoff = if (is.null(opts$pcutoff))NULL else as.numeric(opts$pcutoff) qcutoff = if (is.numeric(pcutoff))NULL else as.numeric(opts$qcutoff) @@ -68,14 +68,22 @@ vec_as_df(unlist(opts)) %>% #' The working directory of the analysis was: `r getwd()` ## both batches combines - -contrasts = read_tsv(contrasts_file) %T>% { print(kable(.))} expDesign = read_tsv(design_matrix_file) %T>% glimpse # countData = read_tsv(interp_from_env("../logms_inten_matrix_acc.txt")) %T>% glimpse countData = read_tsv(count_matrix_file) %T>% glimpse names(countData)[1] = "gene_id" +if (! is.null(contrasts_file)) { + contrasts = read_tsv(contrasts_file) %T>% { print(kable(.))} +}else { + contrasts = select(expDesign, condition) %>% distinct %>% + merge(., ., suffixes = c("_1", "_2"), by = NULL) %>% + filter(ac(condition_1) > ac(condition_2)) + # write_tsv(contrasts, paste(resultsBase, "contrasts.txt")) +} + + # zero-imputation is disabled here because this should be better implement per experiment # countData %<>% mutate_if(is.numeric, funs(replace(., is.na(.), 0))) -- GitLab