From ca4c9672284138d9b934f5f52d0db9a94dc929cb Mon Sep 17 00:00:00 2001 From: WackerO Date: Thu, 8 Feb 2024 09:57:36 +0100 Subject: [PATCH 1/3] Mention missing dots in volcano plot, change rounding, turn off rounding by default --- CHANGELOG.md | 2 ++ assets/differentialabundance_report.Rmd | 8 ++------ conf/test.config | 1 + nextflow.config | 2 +- nextflow_schema.json | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49736ab7..c8663f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Changed` +- [[#232](https://github.com/nf-core/differentialabundance/pull/232)] - Mention missing dots in volcano plot, change rounding, turn off rounding by default ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) + ## v1.4.0 - 2023-11-27 ### `Added` diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index d81e4515..ed0e9653 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -176,11 +176,7 @@ round_dataframe_columns <- function(df, columns = NULL, digits = -1) { if (is.null(columns)) { columns <- colnames(df)[(unlist(lapply(df, is.numeric), use.names=F))] # extract only numeric columns for rounding } - - df[,columns] <- round( - data.frame(df[, columns], check.names = FALSE), - digits = digits - ) + df[,columns] <- format(df[,columns], scientific=T, digits=params$report_round_digits) # Convert columns back to numeric @@ -772,7 +768,7 @@ foo <- lapply(informative_variables[iv_min_group_sizes > 2], function(iv){ ```{r, echo=FALSE, results='asis', eval=params$study_type %in% c('rnaseq')} # For DESeq2, add some more explanation to the report cat(paste0( -"The `DESeq2 R` package was used for differential analysis. p-values were adjusted with the ", params$deseq2_p_adjust_method, " method to reduce the number of false positives. ", ucfirst(params$features_type), "s were considered differential if, for the respective contrast, the adjusted p-value was equal to or lower than ", params$deseq2_alpha, " and the absolute log2 fold change was equal to or higher than ", params$deseq2_lfc_threshold, "." +"The `DESeq2 R` package was used for differential analysis. p-values were adjusted with the ", params$deseq2_p_adjust_method, " method to reduce the number of false positives. ", ucfirst(params$features_type), "s were considered differential if, for the respective contrast, the adjusted p-value was equal to or lower than ", params$deseq2_alpha, " and the absolute log2 fold change was equal to or higher than ", params$deseq2_lfc_threshold, ". Please note that for very small p-values, dots may not appear in the volcano plots. You can find these values in the tables instead." )) ``` diff --git a/conf/test.config b/conf/test.config index 2a7929f4..4d4e9454 100644 --- a/conf/test.config +++ b/conf/test.config @@ -50,5 +50,6 @@ params { gene_sets_files = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt' // Report options + report_round_digits = 3 report_contributors = 'Jane Doe\nDirector of Institute of Microbiology\nUniversity of Smallville;John Smith\nPhD student\nInstitute of Microbiology\nUniversity of Smallville' } diff --git a/nextflow.config b/nextflow.config index 214473cb..ec4e0e3b 100644 --- a/nextflow.config +++ b/nextflow.config @@ -31,7 +31,7 @@ params { report_contributors = null report_description = null report_scree = true - report_round_digits = 4 + report_round_digits = -1 // Sample sheet options observations_type = 'sample' diff --git a/nextflow_schema.json b/nextflow_schema.json index 9f7b3039..a60d556d 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -1062,7 +1062,7 @@ }, "report_round_digits": { "type": "integer", - "default": 4, + "default": -1, "description": "To how many digits should numeric output in different modules be rounded? If -1, will not round.", "help_text": "This affects output from the following modules (both their tabular output and their result sections in the report): proteus, gprofiler2." } From 0d1832e762b2af7809c1d21fffbcd51e8d27fcef Mon Sep 17 00:00:00 2001 From: WackerO Date: Mon, 12 Feb 2024 08:57:05 +0100 Subject: [PATCH 2/3] Changed 0 pval warning --- assets/differentialabundance_report.Rmd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index ed0e9653..1c509001 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -176,8 +176,7 @@ round_dataframe_columns <- function(df, columns = NULL, digits = -1) { if (is.null(columns)) { columns <- colnames(df)[(unlist(lapply(df, is.numeric), use.names=F))] # extract only numeric columns for rounding } - df[,columns] <- format(df[,columns], scientific=T, digits=params$report_round_digits) - + df[,columns] <- format(data.frame(df[, columns], check.names = FALSE), scientific=T, digits=params$report_round_digits) # Convert columns back to numeric for (c in columns) { @@ -768,7 +767,7 @@ foo <- lapply(informative_variables[iv_min_group_sizes > 2], function(iv){ ```{r, echo=FALSE, results='asis', eval=params$study_type %in% c('rnaseq')} # For DESeq2, add some more explanation to the report cat(paste0( -"The `DESeq2 R` package was used for differential analysis. p-values were adjusted with the ", params$deseq2_p_adjust_method, " method to reduce the number of false positives. ", ucfirst(params$features_type), "s were considered differential if, for the respective contrast, the adjusted p-value was equal to or lower than ", params$deseq2_alpha, " and the absolute log2 fold change was equal to or higher than ", params$deseq2_lfc_threshold, ". Please note that for very small p-values, dots may not appear in the volcano plots. You can find these values in the tables instead." +"The `DESeq2 R` package was used for differential analysis. p-values were adjusted with the ", params$deseq2_p_adjust_method, " method to reduce the number of false positives. ", ucfirst(params$features_type), "s were considered differential if, for the respective contrast, the adjusted p-value was equal to or lower than ", params$deseq2_alpha, " and the absolute log2 fold change was equal to or higher than ", params$deseq2_lfc_threshold, "." )) ``` @@ -829,7 +828,6 @@ for (i in 1:nrow(contrasts)){ cat("\n##### ", pvt, " p values\n") pval_column <- p_value_types[[pvt]] - de_fc <- abs(full_de[[params$differential_fc_column]]) >= log2(params$differential_min_fold_change) de_fc_label <- paste("abs(logFC) >=", log2(params$differential_min_fold_change)) @@ -868,6 +866,13 @@ for (i in 1:nrow(contrasts)){ # Let's equalize the axes max_fc <- max(abs(full_de[[params$differential_fc_column]])) * 1.1 + + # Print warning if any p values are 0 + zero_p <- length(which(full_de[[pval_column]]==0)) + if (zero_p) { + cat(paste0("", zero_p, " feature", ifelse(zero_p>1, "s are", " is"), " not shown because of p value = 0; please refer to the results tables.

")) + } + p <- do.call(plotly_scatterplot, plot_args) %>% layout(xaxis = list(range=list(-max_fc, max_fc))) From 99cdf5cde46e0f09c30102337084ed793a6404c8 Mon Sep 17 00:00:00 2001 From: WackerO Date: Wed, 21 Feb 2024 15:04:27 +0100 Subject: [PATCH 3/3] Reenabled default rounding --- nextflow.config | 2 +- nextflow_schema.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nextflow.config b/nextflow.config index ec4e0e3b..214473cb 100644 --- a/nextflow.config +++ b/nextflow.config @@ -31,7 +31,7 @@ params { report_contributors = null report_description = null report_scree = true - report_round_digits = -1 + report_round_digits = 4 // Sample sheet options observations_type = 'sample' diff --git a/nextflow_schema.json b/nextflow_schema.json index a60d556d..9f7b3039 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -1062,7 +1062,7 @@ }, "report_round_digits": { "type": "integer", - "default": -1, + "default": 4, "description": "To how many digits should numeric output in different modules be rounded? If -1, will not round.", "help_text": "This affects output from the following modules (both their tabular output and their result sections in the report): proteus, gprofiler2." }