# HG changeset patch # User Jim Johnson # Date 1349986491 18000 # Node ID b0d11fcbc3acc5f97924ac5fdde4f2cc02fc4ec6 # Parent c2b922c9d545b2ba7e1995b8c7fb535a598e6bf4 cummerbund add MDS and PCA plots, handle errors from R diff -r c2b922c9d545 -r b0d11fcbc3ac cummerbund_wrapper.py --- a/cummerbund_wrapper.py Wed Oct 10 11:09:15 2012 -0500 +++ b/cummerbund_wrapper.py Thu Oct 11 15:14:51 2012 -0500 @@ -8,13 +8,13 @@ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) - sys.exit() + sys.exit(1) def html_report_from_directory( html_out, dir ): html_out.write( '\n\nGalaxy - cummeRbund Output\n\n\n

\n

\n\n\n' ) def __main__(): @@ -39,7 +39,7 @@ cmd = ( "Rscript --vanilla %s" % options.r_script ) # Debugging. - print cmd + # print cmd #liubo added, for test, look at the generated R script # shutil.copy2(options.r_script, '/nfs/software/galaxy/r_script') diff -r c2b922c9d545 -r b0d11fcbc3ac cummerbund_wrapper.xml --- 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 @@ + + + + + + + + @@ -163,7 +171,9 @@ - + + + backend_database_source['backend_database_selector'] == "cuffdiff_output" @@ -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 <- 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 <- 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 <- "$p.plot.gene_id" myGenes <- 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 <- "$p.plot.gene_id" myGenes <- 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