Previous changeset 2:d1d39c72b755 (2018-12-30) Next changeset 4:73b8cb5bddcd (2019-08-04) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/volcanoplot commit 16205b1cd782c5a4f7c08af7d4ee50dc5903418b |
modified:
volcanoplot.R volcanoplot.xml |
b |
diff -r d1d39c72b755 -r 6d532d760950 volcanoplot.R --- a/volcanoplot.R Sun Dec 30 08:03:58 2018 -0500 +++ b/volcanoplot.R Tue Feb 12 05:32:23 2019 -0500 |
[ |
@@ -27,8 +27,12 @@ "title", "T", 1, "character", "xlab", "X", 1, "character", "ylab", "Y", 1, "character", + "xmin", "m", 1, "double", + "xmax", "M", 1, "double", + "ymax", "W", 1, "double", "legend", "L", 1, "character", - "llabs", "z", 1, "character"), + "llabs", "z", 1, "character", + "boxes", "b", 0, "logical"), byrow=TRUE, ncol=4) opt <- getopt(spec) @@ -38,7 +42,7 @@ results$fdr <- results[, opt$fdr_col] results$Pvalue <- results[, opt$pval_col] results$logFC <- results[, opt$lfc_col] -results$labels <- results[, opt$label_col] +results$labels <- as.character(results[, opt$label_col]) label_down <- unlist(strsplit(opt$llabs, split=","))[1] label_notsig <- unlist(strsplit(opt$llabs, split=","))[2] label_up <- unlist(strsplit(opt$llabs, split=","))[3] @@ -47,19 +51,19 @@ results <- mutate(results, sig=ifelse((fdr<opt$signif_thresh & logFC>opt$lfc_thresh), label_up, ifelse((fdr<opt$signif_thresh & logFC < -opt$lfc_thresh),label_down, label_notsig))) results <- results[order(results$Pvalue),] if (!is.null(opt$label_file)) { - labelfile <- read.delim(opt$label_file) + labelfile <- read.delim(opt$label_file, stringsAsFactors=FALSE) # label genes specified in file - tolabel <- filter(results, labels %in% labelfile[, 1]) + results <- mutate(results, labels=ifelse(labels %in% labelfile[, 1], labels, "")) } else if (is.null(opt$top_num)) { # label all significant genes - tolabel <- filter(results, sig != label_notsig) + results <- mutate(results, labels=ifelse(sig != label_notsig, labels, "")) } else if (opt$top_num > 0) { # label only top significant genes - tolabel <- filter(results, sig != label_notsig) %>% - top_n(n=-opt$top_num, Pvalue) + top <- filter(results, sig != label_notsig) %>% top_n(n=-opt$top_num, Pvalue) + results <- mutate(results, labels=ifelse(labels %in% top$labels, labels, "")) } else if (opt$top_num == 0) { # no labels - tolabel <- NULL + results$labels <- NULL } pdf("out.pdf") @@ -81,13 +85,23 @@ if (!is.null(opt$ylab)) { p <- p + ylab(opt$ylab) } +if (!is.null(opt$xmin) & !is.null(opt$xmax)) { + p <- p + xlim(opt$xmin, opt$xmax) +} +if (!is.null(opt$ymax)) { + p <- p + ylim(0, opt$ymax) +} if (!is.null(opt$legend)) { p <- p + labs(colour=opt$legend) } else { p <- p + labs(colour="") } -if (!is.null(tolabel)) { - p <- p + geom_label_repel(data=tolabel, aes(label=labels, fill=factor(sig)), colour="white", segment.colour="black", show.legend=FALSE) +if (!is.null(results$labels)) { + if (!is.null(opt$boxes)) { + p <- p + geom_label_repel(aes(label=labels, fill=sig), segment.colour="black", colour="white", min.segment.length=0, show.legend=FALSE) + } else { + p <- p + geom_text_repel(aes(label=labels, col=sig), min.segment.length=0, box.padding=0.3, point.padding=0.3, show.legend=FALSE) + } } print(p) |
b |
diff -r d1d39c72b755 -r 6d532d760950 volcanoplot.xml --- a/volcanoplot.xml Sun Dec 30 08:03:58 2018 -0500 +++ b/volcanoplot.xml Tue Feb 12 05:32:23 2019 -0500 |
[ |
@@ -1,9 +1,9 @@ -<tool id="volcanoplot" name="Volcano Plot" version="0.0.2"> +<tool id="volcanoplot" name="Volcano Plot" version="0.0.3"> <description>create a volcano plot</description> <requirements> - <requirement type="package" version="3.0.0">r-ggplot2</requirement> + <requirement type="package" version="3.1.0">r-ggplot2</requirement> <requirement type="package" version="0.8.0">r-ggrepel</requirement> - <requirement type="package" version="0.7.6">r-dplyr</requirement> + <requirement type="package" version="0.7.8">r-dplyr</requirement> <requirement type="package" version="1.20.2">r-getopt</requirement> </requirements> <version_command><![CDATA[ @@ -29,6 +29,9 @@ #else -t 0 #end if + #if $plot_options.boxes: + -b + #end if #if $plot_options.title: -T '$plot_options.title' #end if @@ -38,6 +41,15 @@ #if $plot_options.ylab: -Y '$plot_options.ylab' #end if + #if $plot_options.xmin: + -m '$plot_options.xmin' + #end if + #if $plot_options.xmax: + -M '$plot_options.xmax' + #end if + #if $plot_options.ymax: + -W '$plot_options.ymax' + #end if #if $plot_options.legend: -L '$plot_options.legend' #end if @@ -66,9 +78,13 @@ </when> </conditional> <section name="plot_options" expanded="false" title="Plot Options"> + <param name="boxes" type="boolean" truevalue="True" falsevalue="False" checked="True" label="Label Boxes" help="If this is set to Yes, the labels for the points will be in boxes. Default: Yes"/> <param name="title" type="text" optional="True" label="Plot title"/> <param name="xlab" type="text" optional="True" label="Label for x axis"/> <param name="ylab" type="text" optional="True" label="Label for y axis"/> + <param name="xmin" type="float" optional="True" label="Minimum value for x axis" help="To customise the x axis limits, specify both minimum and maximum values. Leave empty for automatic values."/> + <param name="xmax" type="float" optional="True" label="Maximum value for x axis" help="To customise the x axis limits, specify both minimum and maximum values. Leave empty for automatic values."/> + <param name="ymax" type="float" optional="True" label="Maximum value for y axis" help="To customise the y axis upper limit, specify the maximum value, the minimum will be 0. Leave empty for automatic value."/> <param name="legend" type="text" optional="True" label="Label for Legend Title"/> <param name="legend_labs" type="text" value="Down,Not Sig,Up" label="Labels for Legend" help="Labels in the legend can be specified. Default: Down,Not Sig,Up"/> </section> |