From ddb1d646fc79272fdaaaea55e25a561d5ee7585d Mon Sep 17 00:00:00 2001 From: paulzierep Date: Sun, 3 Nov 2024 10:51:09 +0100 Subject: [PATCH 1/3] expand to multivariable association --- tools/volcanoplot/test-data/category.tab | 11 +++ tools/volcanoplot/test-data/out.rscript | 32 ++++--- tools/volcanoplot/volcanoplot.xml | 103 +++++++++++++++++++---- 3 files changed, 115 insertions(+), 31 deletions(-) create mode 100644 tools/volcanoplot/test-data/category.tab diff --git a/tools/volcanoplot/test-data/category.tab b/tools/volcanoplot/test-data/category.tab new file mode 100644 index 00000000000..4debaebe0df --- /dev/null +++ b/tools/volcanoplot/test-data/category.tab @@ -0,0 +1,11 @@ +Gene log2FoldChange pvalue padj category +DOK6 0.51 1.861e-08 0.0003053 Category A +TBX5 -2.129 5.655e-08 0.0004191 Category B +SLC32A1 0.9003 7.664e-08 0.0004191 Category C +IFITM1 -1.687 3.735e-06 0.006809 Category A +NUP93 0.3659 3.373e-06 0.006809 Category B +EMILIN2 1.534 2.976e-06 0.006809 Category C +TPX2 -0.9974 2.097e-06 0.006809 Category A +LAMA2 -1.425 2.39e-06 0.006809 Category B +CAV2 -1.052 3.213e-06 0.006809 Category C +TNN -1.658 8.973e-06 0.01472 Category A \ No newline at end of file diff --git a/tools/volcanoplot/test-data/out.rscript b/tools/volcanoplot/test-data/out.rscript index 455df037abc..6b38f506b6f 100644 --- a/tools/volcanoplot/test-data/out.rscript +++ b/tools/volcanoplot/test-data/out.rscript @@ -20,16 +20,20 @@ suppressPackageStartupMessages({ # Import data ------------------------------------------------------------ -results <- read.delim('/private/var/folders/zn/m_qvr9zd7tq0wdtsbq255f8xypj_zg/T/tmprh4qip75/files/d/2/2/dataset_d2255b46-f0f6-4900-8b9e-bd352e34f303.dat', header = TRUE) +results <- read.delim('/tmp/tmpl4o1f_bf/files/5/2/5/dataset_52538741-d085-42da-817b-263bd4f7cf98.dat', header = TRUE) # Format data ------------------------------------------------------------ -# Create columns from the column numbers specified -results <- results %>% mutate(fdr = .[[4]], - pvalue = .[[3]], - logfc = .[[2]], - labels = .[[1]]) +# Create columns from the column numbers specified and use the existing category_symbol column for shapes +results <- results %>% mutate( + fdr = .[[4]], + pvalue = .[[3]], + logfc = .[[2]], + labels = .[[1]], +) + +# Check if shape_col is provided # Get names for legend down <- unlist(strsplit('Down,Not Sig,Up', split = ","))[1] @@ -49,7 +53,7 @@ results <- mutate(results, sig = case_when( # Specify genes to label -------------------------------------------------- # Import file with genes of interest -labelfile <- read.delim('/private/var/folders/zn/m_qvr9zd7tq0wdtsbq255f8xypj_zg/T/tmprh4qip75/files/5/e/5/dataset_5e5b8fb0-bf65-438e-9b5b-03a540d9aa5d.dat', header = TRUE) +labelfile <- read.delim('/tmp/tmpl4o1f_bf/files/5/d/4/dataset_5d401b02-f6af-4ed9-b853-992fd4a4d044.dat', header = TRUE) # Label the genes of interest in results table results <- mutate(results, labels = ifelse(labels %in% labelfile[, 1], labels, "")) @@ -61,15 +65,17 @@ results <- mutate(results, labels = ifelse(labels %in% labelfile[, 1], labels, " # Open file to save plot as PDF pdf("volcano_plot.pdf") -# Set up base plot +# Set up base plot with faceting by category_symbol instead of shapes p <- ggplot(data = results, aes(x = logfc, y = -log10(pvalue))) + - geom_point(aes(colour = sig)) + scale_color_manual(values = colours) + theme(panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - panel.background = element_blank(), - axis.line = element_line(colour = "black"), - legend.key = element_blank()) + panel.grid.minor = element_blank(), + panel.background = element_blank(), + axis.line = element_line(colour = "black"), + legend.key = element_blank()) + +# Conditional logic to use either shape or facet based on user selection +p <- p + geom_point(aes(colour = sig)) #only add color # Add gene labels p <- p + geom_text_repel(data = filter(results, labels != ""), aes(label = labels), diff --git a/tools/volcanoplot/volcanoplot.xml b/tools/volcanoplot/volcanoplot.xml index a51eac966c0..8acc10316f1 100644 --- a/tools/volcanoplot/volcanoplot.xml +++ b/tools/volcanoplot/volcanoplot.xml @@ -64,11 +64,18 @@ if (is.numeric(first_pvalue)) { # Format data ------------------------------------------------------------ -# Create columns from the column numbers specified -results <- results %>% mutate(fdr = .[[$fdr_col]], - pvalue = .[[$pval_col]], - logfc = .[[$lfc_col]], - labels = .[[$label_col]]) +# Create columns from the column numbers specified and use the existing category_symbol column for shapes +results <- results %>% mutate( + fdr = .[[$fdr_col]], + pvalue = .[[$pval_col]], + logfc = .[[$lfc_col]], + labels = .[[$label_col]], +) + +# Check if shape_col is provided +#if $shape_col: +results <- results %>% mutate(category_symbol = .[[$shape_col]]) # Use the shape column if it exists +#end if # Get names for legend down <- unlist(strsplit('$plot_options.legend_labs', split = ","))[1] @@ -120,15 +127,25 @@ results <- mutate(results, labels = ifelse(labels %in% toplabels, labels, "")) # Open file to save plot as PDF pdf("volcano_plot.pdf") -# Set up base plot +# Set up base plot with faceting by category_symbol instead of shapes p <- ggplot(data = results, aes(x = logfc, y = -log10(pvalue))) + - geom_point(aes(colour = sig)) + scale_color_manual(values = colours) + theme(panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - panel.background = element_blank(), - axis.line = element_line(colour = "black"), - legend.key = element_blank()) + panel.grid.minor = element_blank(), + panel.background = element_blank(), + axis.line = element_line(colour = "black"), + legend.key = element_blank()) + +# Conditional logic to use either shape or facet based on user selection +#if $shape_col: +if ('$shape_or_facet' == 'facet') { + p <- p + facet_wrap(~ category_symbol) # Facet the plot based on category_symbol +} else { + p <- p + geom_point(aes(colour = sig, shape = factor(category_symbol))) # Use shapes for categories +} +#else: +p <- p + geom_point(aes(colour = sig)) #only add color +#end if #if $labels.label_select != "none" # Add gene labels @@ -195,6 +212,11 @@ sessionInfo() + + + + + @@ -248,9 +270,11 @@ sessionInfo() + + @@ -283,6 +307,45 @@ sessionInfo() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.1007/978-3-319-24277-4 From f556e1bb400ee8fa924792deb08ef31dbf9fcac7 Mon Sep 17 00:00:00 2001 From: paulzierep Date: Sun, 3 Nov 2024 10:56:38 +0100 Subject: [PATCH 2/3] bump --- tools/decontam/macros.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/decontam/macros.xml b/tools/decontam/macros.xml index 1db68192871..d7b2c7df9ff 100644 --- a/tools/decontam/macros.xml +++ b/tools/decontam/macros.xml @@ -1,6 +1,6 @@ 1.22.0 - 0 + 1 22.01 From d20cf038699825de66f3c12ac7d17f6d9462db84 Mon Sep 17 00:00:00 2001 From: paulzierep Date: Mon, 9 Dec 2024 15:30:45 +0100 Subject: [PATCH 3/3] test fix --- tools/volcanoplot/volcanoplot.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/volcanoplot/volcanoplot.xml b/tools/volcanoplot/volcanoplot.xml index 8acc10316f1..6b0a2a72159 100644 --- a/tools/volcanoplot/volcanoplot.xml +++ b/tools/volcanoplot/volcanoplot.xml @@ -274,7 +274,6 @@ sessionInfo() -