diff cummerbund_wrapper.xml @ 8:b0d11fcbc3ac

cummerbund add MDS and PCA plots, handle errors from R
author Jim Johnson <jj@umn.edu>
date Thu, 11 Oct 2012 15:14:51 -0500
parents 9d25b0fd882b
children b6427cdbf6d4
line wrap: on
line diff
--- a/cummerbund_wrapper.xml	Wed Oct 10 11:09:15 2012 -0500
+++ b/cummerbund_wrapper.xml	Thu Oct 11 15:14:51 2012 -0500
@@ -48,11 +48,19 @@
 					<option value="cluster">Cluster</option>
 					<option value="expressionplot">Expression Plot</option>
 					<option value="expressionbarplot">Expression Bar Plot</option>
+					<option value="mds">MultiDimentional Scaling (MDS) Plot</option>
+					<option value="pca">Principal Component Analysis (PCA) Plot</option>
 				</param>
 				<when value="density">
 					<param name="log_mode" type="boolean" truevalue="T" falsevalue="F" checked="True" label="Apply log10 transformation on FPKM values?"/>
 					<param name="replicates" type="boolean" truevalue="T" falsevalue="F" checked="False" label="Replicates?"/>
 				</when>
+				<when value="mds">
+					<param name="replicates" type="boolean" truevalue="T" falsevalue="F" checked="True" label="Replicates?"/>
+				</when>
+				<when value="pca">
+					<param name="replicates" type="boolean" truevalue="T" falsevalue="F" checked="True" label="Replicates?"/>
+				</when>
 				<when value="dispersion">
 				</when>
 				<when value="fpkmSCV">
@@ -163,7 +171,9 @@
 			</conditional>
 		</repeat>
     </inputs>
-    
+    <stdio>
+        <exit_code range="1:"  level="fatal"   description="CummerBund Error" />
+    </stdio>
     <outputs>
         <data format="data" name="output_database" label="${tool.name} on ${on_string}: Database File (sqlite)">
             <filter>backend_database_source['backend_database_selector'] == "cuffdiff_output"</filter>
@@ -227,31 +237,26 @@
 #for $i, $p in enumerate($plots, start=1):
 	#set $filename = "plot%02d-%s.png" % ($i, $p.plot['type'])
 png(filename = "${filename}", width = ${p.width}, height = ${p.height})
-
+tryCatch({
     ## Density plot ##
 	#if $p.plot['type'] == "density":
 csDensity(genes(cuff),replicates=$p.plot.replicates)
-devname = dev.off()
 
     ## Dispersion plot ##
 	#elif $p.plot['type'] == "dispersion":
 dispersionPlot(genes(cuff))
-devname = dev.off()
 
     ## Squared Coefficient of Variation plot ##
 	#elif $p.plot['type'] == "fpkmSCV":
 fpkmSCVPlot(genes(cuff))
-devname = dev.off()
 
     ## Scatter Matrix ##
 	#elif $p.plot['type'] == "scatterMatrix":
 csScatterMatrix(genes(cuff))
-devname = dev.off()
 
     ## Boxplot ##
 	#elif $p.plot['type'] == "boxplot":
 csBoxplot(genes(cuff))
-devname = dev.off()
 
     ## Scatter ##
 	#elif $p.plot['type'] == "scatter":
@@ -265,7 +270,6 @@
         #else
 csScatter(genes(cuff), "${p.plot.x}", "${p.plot.y}", smooth=${p.plot.smooth})
         #end if
-devname = dev.off()
 
     ## Volcano ##
 	#elif $p.plot['type'] == "volcano":
@@ -279,7 +283,6 @@
         #else
 csVolcano(genes(cuff), "${p.plot.x}", "${p.plot.y}")
         #end if
-devname = dev.off()
 
     ## Heatmap ##
 	#elif $p.plot['type'] == "heatmap":
@@ -289,7 +292,6 @@
 		#end for
 myGenes &lt;- getGenes(cuff, myGeneIds)
 csHeatmap(get_features(myGenes, "${p.plot.features}"), clustering="${p.plot.clustering}", labCol="${p.plot.labcol}", labRow="${p.plot.labrow}", border="${p.plot.border}")
-devname = dev.off()
 
     ## Cluster ##
 	#elif $p.plot['type'] == "cluster":
@@ -299,22 +301,30 @@
 		#end for
 myGenes &lt;- getGenes(cuff, myGeneIds)
 csCluster(get_features(myGenes, "${p.plot.features}"), k=${p.plot.k}, iter.max="${p.plot.iter_max}")
-devname = dev.off()
 
     ## Expression Plot ##
 	#elif $p.plot['type'] == "expressionplot":
 myGeneId &lt;- "$p.plot.gene_id"
 myGenes &lt;- getGenes(cuff, myGeneId)
 expressionPlot(get_features(myGenes, "${p.plot.features}"), drawSummary=${p.plot.draw_summary}, iter.max="${p.plot.show_error_bars}")
-devname = dev.off()
 
     ## Expression Bar Plot ##
 	#elif $p.plot['type'] == "expressionbarplot":
 myGeneId &lt;- "$p.plot.gene_id"
 myGenes &lt;- getGenes(cuff, myGeneId)
 expressionBarplot(get_features(myGenes, "${p.plot.features}"), iter.max="${p.plot.show_error_bars}")
+
+    ## MDS plot ##
+	#elif $p.plot['type'] == "mds":
+MDSplot(genes(cuff),replicates=$p.plot.replicates)
+
+    ## PCA plot ##
+	#elif $p.plot['type'] == "pca":
+PCAplot(genes(cuff),"PC1","PC2",replicates=$p.plot.replicates)
+	#end if
+
+},error = function(e) {paste("$p.plot['type'] failed: ", e)})
 devname = dev.off()
-	#end if
 
 #end for
         </configfile>