diff --git a/wisecondorX/include/plotter.R b/wisecondorX/include/plotter.R index dab12ba..f4ac798 100644 --- a/wisecondorX/include/plotter.R +++ b/wisecondorX/include/plotter.R @@ -7,6 +7,7 @@ options(warn=-1) args <- commandArgs(T) in.file <- paste0(args[which(args == "--infile")+1]) + # ----- # lib # ----- @@ -29,6 +30,7 @@ gender = input$ref_gender beta = as.numeric(input$beta) zcutoff = as.numeric(input$zscore) ylim = input$ylim +plot.title = input$plot_title if (input$cairo) options(bitmaptype='cairo') @@ -209,6 +211,12 @@ legend(x=0, cex=1.3, bty="n", pch=c(16,16), col=c(color.C, color.B, "white")) par(xpd=F) +if (!is.null(plot.title)) { + par(xpd=NA) + title(plot.title, line=1.3, adj=0.8, col.main=color.A) + par(xpd=F) +} + # plot segmentation for (ab in input$results_c){ @@ -278,7 +286,7 @@ for (c in chrs){ if (any(is.na(whis))){ next } - + png(paste0(out.dir, "/", labels[c],".png"), width=14,height=10,units="in",res=256,pointsize=18) upper.limit <- 0.6 + whis[2] @@ -289,7 +297,7 @@ for (c in chrs){ lower.limit = ylim[1] ; upper.limit = ylim[2] } par(mar=c(2.5,4,1,0), mgp=c(2.4,0.5,0)) - + plot(1, main="", axes=F, # plots nothing -- enables segments function xlab="", ylab="", cex=0, ylim=c(lower.limit,upper.limit), xlim=margins) diff --git a/wisecondorX/main.py b/wisecondorX/main.py index 4c2e99a..63e61d5 100755 --- a/wisecondorX/main.py +++ b/wisecondorX/main.py @@ -396,6 +396,9 @@ def main(): parser_test.add_argument('--cairo', action='store_true', help='Uses cairo bitmap type for plotting. Might be necessary for certain setups.') + parser_test.add_argument("--add-plot-title", + action="store_true", + help="Add the output name as plot title") parser_test.set_defaults(func=tool_test) args = parser.parse_args(sys.argv[1:]) diff --git a/wisecondorX/predict_output.py b/wisecondorX/predict_output.py index 17153de..4586966 100644 --- a/wisecondorX/predict_output.py +++ b/wisecondorX/predict_output.py @@ -28,6 +28,12 @@ def exec_write_plots(rem_input, results): 'infile': str('{}.json'.format(json_plot_dir)), 'out_dir': str('{}.plots'.format(rem_input['args'].outid)), } + + if rem_input["args"].add_plot_title: + # Strip away paths from the outid if need be + json_dict["plot_title"] = str( + os.path.basename(rem_input["args"].outid)) + exec_R(json_dict)