comparison signature.r @ 14:5150d641d515 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
author artbio
date Thu, 06 Apr 2023 23:00:54 +0000
parents aa5e2c64dff8
children
comparison
equal deleted inserted replaced
13:124f404b0fe7 14:5150d641d515
20 make_option("--z_dataframe", type = "character", 20 make_option("--z_dataframe", type = "character",
21 help = "path to z-signature dataframe"), 21 help = "path to z-signature dataframe"),
22 make_option("--plot_method", type = "character", 22 make_option("--plot_method", type = "character",
23 help = "How data should be plotted (global or lattice)"), 23 help = "How data should be plotted (global or lattice)"),
24 make_option("--pdf", type = "character", help = "path to the pdf file with plots"), 24 make_option("--pdf", type = "character", help = "path to the pdf file with plots"),
25 make_option("--title", type = "character", help = "Graph Title") 25 make_option("--title", type = "character", help = "Graph Title"),
26
27 make_option("--npairs_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Numbers-of-pairs plot"),
28 make_option("--npairszscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Number-of-pairs-Z−scores plot"),
29 make_option("--overlapprob_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities plot"),
30 make_option("--overlapprobzscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities-Z−scores plot")
26 ) 31 )
27 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) 32 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list)
28 args <- parse_args(parser) 33 args <- parse_args(parser)
29 34
30 # data frames implementation 35 # data frames implementation
32 colnames(h_dataframe) <- c("chrom", "overlap", "sig", "z-score") 37 colnames(h_dataframe) <- c("chrom", "overlap", "sig", "z-score")
33 h_dataframe$sig <- h_dataframe$sig * 100 # to get probs in % 38 h_dataframe$sig <- h_dataframe$sig * 100 # to get probs in %
34 z_dataframe <- read.delim(args$z_dataframe, header = FALSE) 39 z_dataframe <- read.delim(args$z_dataframe, header = FALSE)
35 colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score") 40 colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score")
36 41
42 # graph limits parameters
43 if (args$npairs_ylim == 0) {
44 npairs_ylim <- NULL
45 } else {
46 npairs_ylim <- c(0, args$npairs_ylim)
47 }
48
49 if (args$npairszscore_ylim == 0) {
50 npairszscore_ylim <- NULL
51 } else {
52 npairszscore_ylim <- c(0, args$npairszscore_ylim)
53 }
54
55 if (args$overlapprob_ylim == 0) {
56 overlapprob_ylim <- NULL
57 } else {
58 overlapprob_ylim <- c(0, args$overlapprob_ylim)
59 }
60
61 if (args$overlapprobzscore_ylim == 0) {
62 overlapprobzscore_ylim <- NULL
63 } else {
64 overlapprobzscore_ylim <- c(0, args$overlapprobzscore_ylim)
65 }
66
67
37 # functions 68 # functions
38 globalgraph <- function() { 69 globalgraph <- function() {
39 pdf(args$pdf) 70 pdf(args$pdf)
40 par(mfrow = c(2, 2), oma = c(0, 0, 3, 0)) 71 par(mfrow = c(2, 2), oma = c(0, 0, 3, 0))
41 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 3)],
42 type = "h", main = "Numbers of pairs", cex.main = 1, xlab = "overlap (nt)",
43 ylab = "Numbers of pairs", col = "darkslateblue", lwd = 4)
44 72
45 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 4)], 73 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 3)],
46 type = "l", main = "Number of pairs Z-scores", cex.main = 1, xlab = "overlap (nt)", 74 type = "h", main = "Numbers of pairs", cex.main = 1, xlab = "overlap (nt)",
47 ylab = "z-score", pch = 19, cex = 0.2, col = "darkslateblue", lwd = 2) 75 ylab = "Numbers of pairs", col = "darkslateblue", lwd = 4,
76 ylim = npairs_ylim
77 )
48 78
49 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 3)], 79 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 4)],
50 type = "l", main = "Overlap probabilities", cex.main = 1, 80 type = "l", main = "Number of pairs Z-scores", cex.main = 1, xlab = "overlap (nt)",
51 xlab = "overlap (nt)", 81 ylab = "z-score", pch = 19, cex = 0.2, col = "darkslateblue", lwd = 2,
52 ylab = "Probability [%]", ylim = c(0, 50), pch = 19, 82 ylim = npairszscore_ylim
53 col = "darkslateblue", lwd = 2) 83 )
54 84
55 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 4)], 85 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 3)],
56 type = "l", main = "Overlap Probability Z-scores", cex.main = 1, 86 type = "l", main = "Overlap probabilities", cex.main = 1,
57 xlab = "overlap (nt)", ylab = "z-score", pch = 19, cex = 0.2, 87 xlab = "overlap (nt)",
58 col = "darkslateblue", lwd = 2) 88 ylab = "Probability [%]", pch = 19,
89 col = "darkslateblue", lwd = 2,
90 ylim = overlapprob_ylim
91 )
92
93 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 4)],
94 type = "l", main = "Overlap Probability Z-scores", cex.main = 1,
95 xlab = "overlap (nt)", ylab = "z-score", pch = 19, cex = 0.2,
96 col = "darkslateblue", lwd = 2,
97 ylim = overlapprobzscore_ylim
98 )
99
59 mtext(args$title, outer = TRUE, cex = 1) 100 mtext(args$title, outer = TRUE, cex = 1)
60 dev.off() 101 dev.off()
61 } 102 }
62 103
63 treillisgraph <- function(df, ...) { 104 treillisgraph <- function(df, ...) {