changeset 1:7b7303fa20e3 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/volcanoplot commit c2b155f1fd4470ddecb5bd1c6e2c54dd46bfeaed
author iuc
date Sat, 29 Dec 2018 13:21:24 -0500
parents 59ebf2c42c0e
children d1d39c72b755
files volcanoplot.R volcanoplot.xml
diffstat 2 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/volcanoplot.R	Tue Oct 23 06:57:26 2018 -0400
+++ b/volcanoplot.R	Sat Dec 29 13:21:24 2018 -0500
@@ -48,20 +48,26 @@
 results <- results[order(results$Pvalue),]
 if (!is.null(opt$label_file)) {
     labelfile <- read.delim(opt$label_file)
+    # label genes specified in file
     tolabel <- filter(results, labels %in% labelfile[, 1])
-} else if (!is.null(opt$top_num)) {
-    tolabel <- filter(results, fdr<opt$signif_thresh) %>% top_n(opt$top_num)
-} else {
+} else if (is.null(opt$top_num)) {
+    # label all significant genes
     tolabel <- filter(results, fdr<opt$signif_thresh)
+} else if (opt$top_num > 0) {
+    # label only top significant genes
+    tolabel <- filter(results, fdr<opt$signif_thresh) %>% 
+    top_n(n=opt$top_num, Pvalue)
+} else if (opt$top_num == 0) {
+    # no labels
+    tolabel <- NULL
 }
 
 pdf("out.pdf")
 p <- ggplot(results, aes(logFC, -log10(Pvalue))) +
     geom_point(aes(col=sig)) +
-    geom_label_repel(data=tolabel, aes(label=labels, fill=factor(sig)), colour="white", segment.colour="black", show.legend=FALSE) +
     scale_color_manual(values=colours) +
     scale_fill_manual(values=colours) +
-    theme(panel.grid.major = element_blank(), 
+    theme(panel.grid.major = element_blank(),
         panel.grid.minor = element_blank(),
         panel.background = element_blank(),
         axis.line = element_line(colour = "black"),
@@ -80,6 +86,9 @@
 } 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)
+}
 
 print(p)
 dev.off()
--- a/volcanoplot.xml	Tue Oct 23 06:57:26 2018 -0400
+++ b/volcanoplot.xml	Sat Dec 29 13:21:24 2018 -0500
@@ -1,4 +1,4 @@
-<tool id="volcanoplot" name="Volcano Plot" version="0.0.1">
+<tool id="volcanoplot" name="Volcano Plot" version="0.0.2">
     <description>create a volcano plot</description>
     <requirements>
         <requirement type="package" version="3.0.0">r-ggplot2</requirement>
@@ -22,8 +22,12 @@
     -x $lfc_thresh
     #if $labels.label_select == 'file':
         -f '$labels.label_file'
-    #else if $labels.top_num:
-        -t $labels.top_num
+    #else if $labels.label_select == 'signif':
+        #if $labels.top_num:
+            -t $labels.top_num
+        #end if
+    #else
+        -t 0
     #end if
     #if $plot_options.title:
         -T '$plot_options.title'
@@ -49,12 +53,13 @@
         <param name="signif_thresh" type="float" max="1" value="0.05" label="Significance threshold" help="Default: 0.05"/>
         <param name="lfc_thresh" type="float" value="0" label="LogFC threshold to colour" help="Default: 0"/>
         <conditional name="labels">
-            <param name="label_select" type="select" label="Points to label" help="Select to label top significant points or input labels from file. All points meeting the significance threshold are labelled by default.">
-                <option value="signif" selected="True">Significant</option>
+            <param name="label_select" type="select" label="Points to label" help="Select to label significant points or input labels from file. Default: None">
+                <option value="none" selected="True">None</option>
+                <option value="signif">Significant</option>
                 <option value="file">Input from file</option>
             </param>
             <when value="signif">
-                <param name="top_num" type="integer" optional="True" label="Only label top most significant" help="Specify the top number of points to label by P value significance"/>
+                <param name="top_num" type="integer" optional="True" label="Only label top most significant" help="Specify the top number of points to label by P value significance. If no number is specified, all points that pass the FDR and Log Fold Change thresholds will be labelled."/>
             </when>
             <when value="file">
                 <param name="label_file" type="data" format="tabular" label="File of labels"/>
@@ -119,7 +124,7 @@
     * Log fold change
     * Labels (e.g. Gene symbols or IDs)
 
-All points meeting the specified significance threshold will be labelled by default with the values in the Labels columns. Users can select to only label the top significant points under **Plot Options** or only to label certain points through providing a tabular labels file. The labels file must contin a header row and have the labels in the first column. These labels must match the labels in the main input file. If no labels are desired specify 0 for "Only label top most signifcant". If a log fold change (lfc) threshold is specified, points that meet the significance threshold and lfc threshold will be coloured red if upregulated and blue if downregulated.
+All significant points, those meeting the specified FDR and Log Fold Change thresholds, will be coloured, red for upregulated, blue for downregulated. Users can choose to apply labels to the points (such as gene symbols) from the Labels column. To label all significant points, select "Significant" for the **Points to label** option, or to only label the top most significant specify a number under "Only label top most significant". Users can label any points of interest through selecting **Points to label** "Input from file" and providing a tabular labels file. The labels file must contain a header row and have the labels in the first column. These labels must match the labels in the main input file.
 
 **Outputs**