Skip to content

Commit

Permalink
Merge pull request #232 from WackerO/volcano_round
Browse files Browse the repository at this point in the history
Mention missing dots in report volcano
  • Loading branch information
WackerO committed Feb 27, 2024
2 parents 92f4cf7 + e393cdd commit e5d11f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
15 changes: 8 additions & 7 deletions assets/differentialabundance_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +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(data.frame(df[, columns], check.names = FALSE), scientific=T, digits=params$report_round_digits)
# Convert columns back to numeric
for (c in columns) {
Expand Down Expand Up @@ -833,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))
Expand Down Expand Up @@ -872,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("<i>", zero_p, " feature", ifelse(zero_p>1, "s are", " is"), " not shown because of p value = 0; please refer to the results tables.</i><br><br>"))
}
p <- do.call(plotly_scatterplot, plot_args) %>%
layout(xaxis = list(range=list(-max_fc, max_fc)))
Expand Down
1 change: 1 addition & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ params {
gene_sets_files = 'https://github.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'
}

0 comments on commit e5d11f8

Please sign in to comment.