# HG changeset patch
# User iuc
# Date 1700625457 0
# Node ID 5bf899c1397937b7b6741bfcb046a1d09f2ad0ea
# Parent 070900306913bc3f2c8520fccd24129ce72c4399
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 025a0d70be99e50ae89ad78a70cc8c51571ea1a2
diff -r 070900306913 -r 5bf899c13979 edger.R
--- a/edger.R Wed Oct 11 11:13:07 2023 +0000
+++ b/edger.R Wed Nov 22 03:57:37 2023 +0000
@@ -85,6 +85,12 @@
return(string)
}
+# Sanitise file base names coming from factors or contrasts
+sanitise_basename <- function(string) {
+ string <- gsub("[/^]", "_", string)
+ return(string)
+}
+
# Generate output folder and paths
make_out <- function(filename) {
return(paste0(out_path, "/", filename))
@@ -331,16 +337,16 @@
mds_pdf <- character() # Initialise character vector
mds_png <- character()
for (i in seq_len(ncol(factors))) {
- mds_pdf[i] <- make_out(paste0("mdsplot_", names(factors)[i], ".pdf"))
- mds_png[i] <- make_out(paste0("mdsplot_", names(factors)[i], ".png"))
+ mds_pdf[i] <- make_out(paste0("mdsplot_", sanitise_basename(names(factors)[i]), ".pdf"))
+ mds_png[i] <- make_out(paste0("mdsplot_", sanitise_basename(names(factors)[i]), ".png"))
}
md_pdf <- character()
md_png <- character()
top_out <- character()
for (i in seq_along(contrast_data)) {
- md_pdf[i] <- make_out(paste0("mdplot_", contrast_data[i], ".pdf"))
- md_png[i] <- make_out(paste0("mdplot_", contrast_data[i], ".png"))
- top_out[i] <- make_out(paste0("edgeR_", contrast_data[i], ".tsv"))
+ md_pdf[i] <- make_out(paste0("mdplot_", sanitise_basename(contrast_data[i]), ".pdf"))
+ md_png[i] <- make_out(paste0("mdplot_", sanitise_basename(contrast_data[i]), ".png"))
+ top_out[i] <- make_out(paste0("edgeR_", sanitise_basename(contrast_data[i]), ".tsv"))
} # Save output paths for each contrast as vectors
norm_out <- make_out("edgeR_normcounts.tsv")
rda_out <- make_out("edgeR_analysis.RData")
@@ -446,15 +452,15 @@
# MDS plot
png(mds_png, width = 600, height = 600)
plotMDS(data, labels = labels, col = as.numeric(factors[, 1]), cex = 0.8, main = paste("MDS Plot:", names(factors)[1]))
-img_name <- paste0("MDS Plot_", names(factors)[1], ".png")
-img_addr <- paste0("mdsplot_", names(factors)[1], ".png")
+img_name <- paste0("MDS Plot_", sanitise_basename(names(factors)[1]), ".png")
+img_addr <- paste0("mdsplot_", sanitise_basename(names(factors)[1]), ".png")
image_data[1, ] <- c(img_name, img_addr)
invisible(dev.off())
pdf(mds_pdf)
plotMDS(data, labels = labels, col = as.numeric(factors[, 1]), cex = 0.8, main = paste("MDS Plot:", names(factors)[1]))
-link_name <- paste0("MDS Plot_", names(factors)[1], ".pdf")
-link_addr <- paste0("mdsplot_", names(factors)[1], ".pdf")
+link_name <- paste0("MDS Plot_", sanitise_basename(names(factors)[1]), ".pdf")
+link_addr <- paste0("mdsplot_", sanitise_basename(names(factors)[1]), ".pdf")
link_data[1, ] <- c(link_name, link_addr)
invisible(dev.off())
@@ -463,15 +469,15 @@
for (i in 2:ncol(factors)) {
png(mds_png[i], width = 600, height = 600)
plotMDS(data, labels = labels, col = as.numeric(factors[, i]), cex = 0.8, main = paste("MDS Plot:", names(factors)[i]))
- img_name <- paste0("MDS Plot_", names(factors)[i], ".png")
- img_addr <- paste0("mdsplot_", names(factors)[i], ".png")
+ img_name <- paste0("MDS Plot_", sanitise_basename(names(factors)[i]), ".png")
+ img_addr <- paste0("mdsplot_", sanitise_basename(names(factors)[i]), ".png")
image_data <- rbind(image_data, c(img_name, img_addr))
invisible(dev.off())
pdf(mds_pdf[i])
plotMDS(data, labels = labels, col = as.numeric(factors[, i]), cex = 0.8, main = paste("MDS Plot:", names(factors)[i]))
- link_name <- paste0("MDS Plot_", names(factors)[i], ".pdf")
- link_addr <- paste0("mdsplot_", names(factors)[i], ".pdf")
+ link_name <- paste0("MDS Plot_", sanitise_basename(names(factors)[i]), ".pdf")
+ link_addr <- paste0("mdsplot_", sanitise_basename(names(factors)[i]), ".pdf")
link_data <- rbind(link_data, c(link_name, link_addr))
invisible(dev.off())
}
@@ -549,8 +555,8 @@
top <- topTags(res, adjust.method = opt$pAdjOpt, n = Inf, sort.by = "PValue")
write.table(top, file = top_out[i], row.names = FALSE, sep = "\t", quote = FALSE)
- link_name <- paste0("edgeR_", contrast_data[i], ".tsv")
- link_addr <- paste0("edgeR_", contrast_data[i], ".tsv")
+ link_name <- paste0("edgeR_", sanitise_basename(contrast_data[i]), ".tsv")
+ link_addr <- paste0("edgeR_", sanitise_basename(contrast_data[i]), ".tsv")
link_data <- rbind(link_data, c(link_name, link_addr))
# Plot MD (log ratios vs mean difference) using limma package
@@ -564,8 +570,8 @@
abline(h = 0, col = "grey", lty = 2)
- link_name <- paste0("MD Plot_", contrast_data[i], ".pdf")
- link_addr <- paste0("mdplot_", contrast_data[i], ".pdf")
+ link_name <- paste0("MD Plot_", sanitise_basename(contrast_data[i]), ".pdf")
+ link_addr <- paste0("mdplot_", sanitise_basename(contrast_data[i]), ".pdf")
link_data <- rbind(link_data, c(link_name, link_addr))
invisible(dev.off())
@@ -579,8 +585,8 @@
abline(h = 0, col = "grey", lty = 2)
- img_name <- paste0("MD Plot_", contrast_data[i], ".png")
- img_addr <- paste0("mdplot_", contrast_data[i], ".png")
+ img_name <- paste0("MD Plot_", sanitise_basename(contrast_data[i]), ".png")
+ img_addr <- paste0("mdplot_", sanitise_basename(contrast_data[i]), ".png")
image_data <- rbind(image_data, c(img_name, img_addr))
invisible(dev.off())
}
diff -r 070900306913 -r 5bf899c13979 edger.xml
--- a/edger.xml Wed Oct 11 11:13:07 2023 +0000
+++ b/edger.xml Wed Nov 22 03:57:37 2023 +0000
@@ -4,7 +4,7 @@
3.36.0
- 3
+ 4
topic_3308
@@ -694,7 +694,7 @@
-
+
@@ -706,6 +706,11 @@
+
+
+
+
+
diff -r 070900306913 -r 5bf899c13979 test-data/contrasts_file.txt
--- a/test-data/contrasts_file.txt Wed Oct 11 11:13:07 2023 +0000
+++ b/test-data/contrasts_file.txt Wed Nov 22 03:57:37 2023 +0000
@@ -1,3 +1,4 @@
Contrasts
Mut-WT
-WT-Mut
\ No newline at end of file
+WT-Mut
+(2*Mut/3*WT)-WT
\ No newline at end of file