# HG changeset patch # User artbio # Date 1680822054 0 # Node ID 5150d641d5159c2a8cad83312e3683c1410ab3e3 # Parent 124f404b0fe700a2272ae48f181d4df1191bbfa8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c diff -r 124f404b0fe7 -r 5150d641d515 signature.r --- a/signature.r Sat Feb 25 09:54:28 2023 +0000 +++ b/signature.r Thu Apr 06 23:00:54 2023 +0000 @@ -22,7 +22,12 @@ make_option("--plot_method", type = "character", help = "How data should be plotted (global or lattice)"), make_option("--pdf", type = "character", help = "path to the pdf file with plots"), - make_option("--title", type = "character", help = "Graph Title") + make_option("--title", type = "character", help = "Graph Title"), + + make_option("--npairs_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Numbers-of-pairs plot"), + make_option("--npairszscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Number-of-pairs-Z−scores plot"), + make_option("--overlapprob_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities plot"), + make_option("--overlapprobzscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities-Z−scores plot") ) parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) args <- parse_args(parser) @@ -34,28 +39,64 @@ z_dataframe <- read.delim(args$z_dataframe, header = FALSE) colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score") +# graph limits parameters +if (args$npairs_ylim == 0) { + npairs_ylim <- NULL + } else { + npairs_ylim <- c(0, args$npairs_ylim) +} + +if (args$npairszscore_ylim == 0) { + npairszscore_ylim <- NULL + } else { + npairszscore_ylim <- c(0, args$npairszscore_ylim) +} + +if (args$overlapprob_ylim == 0) { + overlapprob_ylim <- NULL + } else { + overlapprob_ylim <- c(0, args$overlapprob_ylim) +} + +if (args$overlapprobzscore_ylim == 0) { + overlapprobzscore_ylim <- NULL + } else { + overlapprobzscore_ylim <- c(0, args$overlapprobzscore_ylim) +} + + # functions globalgraph <- function() { pdf(args$pdf) par(mfrow = c(2, 2), oma = c(0, 0, 3, 0)) - plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 3)], - type = "h", main = "Numbers of pairs", cex.main = 1, xlab = "overlap (nt)", - ylab = "Numbers of pairs", col = "darkslateblue", lwd = 4) - plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 4)], - type = "l", main = "Number of pairs Z-scores", cex.main = 1, xlab = "overlap (nt)", - ylab = "z-score", pch = 19, cex = 0.2, col = "darkslateblue", lwd = 2) + plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 3)], + type = "h", main = "Numbers of pairs", cex.main = 1, xlab = "overlap (nt)", + ylab = "Numbers of pairs", col = "darkslateblue", lwd = 4, + ylim = npairs_ylim + ) + + plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 4)], + type = "l", main = "Number of pairs Z-scores", cex.main = 1, xlab = "overlap (nt)", + ylab = "z-score", pch = 19, cex = 0.2, col = "darkslateblue", lwd = 2, + ylim = npairszscore_ylim + ) - plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 3)], - type = "l", main = "Overlap probabilities", cex.main = 1, - xlab = "overlap (nt)", - ylab = "Probability [%]", ylim = c(0, 50), pch = 19, - col = "darkslateblue", lwd = 2) + plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 3)], + type = "l", main = "Overlap probabilities", cex.main = 1, + xlab = "overlap (nt)", + ylab = "Probability [%]", pch = 19, + col = "darkslateblue", lwd = 2, + ylim = overlapprob_ylim + ) - plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 4)], - type = "l", main = "Overlap Probability Z-scores", cex.main = 1, - xlab = "overlap (nt)", ylab = "z-score", pch = 19, cex = 0.2, - col = "darkslateblue", lwd = 2) + plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 4)], + type = "l", main = "Overlap Probability Z-scores", cex.main = 1, + xlab = "overlap (nt)", ylab = "z-score", pch = 19, cex = 0.2, + col = "darkslateblue", lwd = 2, + ylim = overlapprobzscore_ylim + ) + mtext(args$title, outer = TRUE, cex = 1) dev.off() } diff -r 124f404b0fe7 -r 5150d641d515 signature.xml --- a/signature.xml Sat Feb 25 09:54:28 2023 +0000 +++ b/signature.xml Thu Apr 06 23:00:54 2023 +0000 @@ -1,4 +1,4 @@ - + numpy @@ -26,9 +26,15 @@ Rscript '$__tool_directory__'/signature.r --h_dataframe '$h_dataframe' --z_dataframe '$z_dataframe' - --plot_method '$plot_method' + --plot_method '$plot_options.plot_method' --pdf '$pdf' --title "Overlap Signatures of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs" + #if $plot_options.plot_method == "global": + --npairs_ylim $plot_options.npairs_ylim + --npairszscore_ylim $plot_options.npairszscore_ylim + --overlapprob_ylim $plot_options.overlapprob_ylim + --overlapprobzscore_ylim $plot_options.overlapprobzscore_ylim + #end if ]]> @@ -38,10 +44,27 @@ - - - - + + + + + + + + + + + + + @@ -65,11 +88,14 @@ - + + + + @@ -78,7 +104,30 @@ - + + + + + + + + + + + + + + + + + + + + + + + + diff -r 124f404b0fe7 -r 5150d641d515 test-data/global-limited.pdf Binary file test-data/global-limited.pdf has changed diff -r 124f404b0fe7 -r 5150d641d515 test-data/global.pdf Binary file test-data/global.pdf has changed