From 1887890f002b90cc28fa5cb7b47ff8618ab79780 Mon Sep 17 00:00:00 2001 From: WackerO Date: Wed, 8 Nov 2023 14:29:14 +0100 Subject: [PATCH 1/4] Add DESeq2 designs to report --- assets/differentialabundance_report.Rmd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index 34521ad2..737a3c24 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -437,6 +437,11 @@ Comparisons were made between `r params$observations_type` groups defined using ```{r, echo=FALSE, results='asis'} contrasts_to_print <- contrasts colnames(contrasts_to_print) <- prettifyVariablename(colnames(contrasts_to_print)) + +# If DESeq2 was run instead of Limma, add designs to report +if (params$study_type %in% c('rnaseq')) { + contrasts_to_print[["DESeq2 models"]] <- paste('~ 0 + ', ifelse(contrasts_to_print$Blocking != '', make.names(contrasts_to_print$Blocking), ''), '+ ', make.names(contrasts_to_print$Variable)) +} print( htmltools::tagList(datatable(contrasts_to_print, caption = paste0("Table of contrasts"), rownames = FALSE, options = list(dom = 't')) )) ``` @@ -902,4 +907,4 @@ print( htmltools::tagList(datatable(versions_table, caption = "Software versions ```{r, echo=FALSE, results='asis'} htmltools::includeMarkdown(params$citations) -``` +``` \ No newline at end of file From ea326aec02031de1b2e98e28ee42ea4671c0513e Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 21 Nov 2023 13:22:21 +0100 Subject: [PATCH 2/4] Model is now added to report from the model output files --- assets/differentialabundance_report.Rmd | 16 ++++++++++++---- .../deseq2/differential/templates/deseq_de.R | 2 +- workflows/differentialabundance.nf | 4 +++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index 2d8deda0..828ebe03 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -439,10 +439,18 @@ Comparisons were made between `r params$observations_type` groups defined using contrasts_to_print <- contrasts colnames(contrasts_to_print) <- prettifyVariablename(colnames(contrasts_to_print)) -# If DESeq2 was run instead of Limma, add designs to report -if (params$study_type %in% c('rnaseq')) { - contrasts_to_print[["DESeq2 models"]] <- paste('~ 0 + ', ifelse(contrasts_to_print$Blocking != '', make.names(contrasts_to_print$Blocking), ''), '+ ', make.names(contrasts_to_print$Variable)) -} +# Add design/model formulae to report +de_tool <- ifelse(params$study_type %in% c('rnaseq'), "deseq2", "limma") +contrasts_to_print$model <- sapply(contrasts_to_print$Id, function(id) { + model_file <- paste0(id, ".", de_tool, ".model.txt") + if (file.exists(model_file)) { + first_line <- readLines(model_file, n = 1) + return(first_line) + } else { + return(NA) + } +}) + print( htmltools::tagList(datatable(contrasts_to_print, caption = paste0("Table of contrasts"), rownames = FALSE, options = list(dom = 't')) )) ``` diff --git a/modules/nf-core/deseq2/differential/templates/deseq_de.R b/modules/nf-core/deseq2/differential/templates/deseq_de.R index d744654b..06b5d0ea 100755 --- a/modules/nf-core/deseq2/differential/templates/deseq_de.R +++ b/modules/nf-core/deseq2/differential/templates/deseq_de.R @@ -499,4 +499,4 @@ writeLines( ################################################ ################################################ ################################################ -################################################ +################################################ \ No newline at end of file diff --git a/workflows/differentialabundance.nf b/workflows/differentialabundance.nf index 381c8085..4f63c339 100644 --- a/workflows/differentialabundance.nf +++ b/workflows/differentialabundance.nf @@ -342,6 +342,7 @@ workflow DIFFERENTIALABUNDANCE { ch_samples_and_matrix ) ch_differential = LIMMA_DIFFERENTIAL.out.results + ch_model = LIMMA_DIFFERENTIAL.out.model ch_versions = ch_versions .mix(LIMMA_DIFFERENTIAL.out.versions) @@ -376,6 +377,7 @@ workflow DIFFERENTIALABUNDANCE { ch_norm = DESEQ2_NORM.out.normalised_counts ch_differential = DESEQ2_DIFFERENTIAL.out.results + ch_model = DESEQ2_DIFFERENTIAL.out.model ch_versions = ch_versions .mix(DESEQ2_DIFFERENTIAL.out.versions) @@ -517,6 +519,7 @@ workflow DIFFERENTIALABUNDANCE { .combine(ch_css_file) .combine(ch_citations_file) .combine(ch_differential.map{it[1]}.toList()) + .combine(ch_model.map{it[1]}.toList()) if (params.gsea_run){ ch_report_input_files = ch_report_input_files @@ -574,7 +577,6 @@ workflow DIFFERENTIALABUNDANCE { } // Render the final report - RMARKDOWNNOTEBOOK( ch_report_file, ch_report_params, From b86fbdc0f8e0e8c5f381a7fbf65731b85c3153d0 Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 21 Nov 2023 15:38:11 +0100 Subject: [PATCH 3/4] Made deseq script like the one in dev --- modules/nf-core/deseq2/differential/templates/deseq_de.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/deseq2/differential/templates/deseq_de.R b/modules/nf-core/deseq2/differential/templates/deseq_de.R index 06b5d0ea..d744654b 100755 --- a/modules/nf-core/deseq2/differential/templates/deseq_de.R +++ b/modules/nf-core/deseq2/differential/templates/deseq_de.R @@ -499,4 +499,4 @@ writeLines( ################################################ ################################################ ################################################ -################################################ \ No newline at end of file +################################################ From 8d5ea35d24af86f69e6aec50746de456e77c8047 Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 21 Nov 2023 16:43:19 +0100 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a67f0a7..d89882f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [[#193](https://github.com/nf-core/differentialabundance/pull/193)] - Add DESeq2 text to report ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) - [[#192](https://github.com/nf-core/differentialabundance/pull/192)] - Add scree plot in report ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) +- [[#189](https://github.com/nf-core/differentialabundance/pull/189)] - Add DE models to report ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) - [[#188](https://github.com/nf-core/differentialabundance/pull/188)] - Add option to cluster all features ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) - [[#198](https://github.com/nf-core/differentialabundance/pull/200)] - Document correct RNAseq matrix usage ([@pinin4fjords](https://github.com/pinin4fjords), review by [@WackerO](https://github.com/WackerO))