Mercurial > repos > artbio > small_rna_signatures
annotate 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 |
rev | line source |
---|---|
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
1 ## Setup R error handling to go to stderr |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
2 options(show.error.messages = FALSE, |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
3 error = function() { |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
4 cat(geterrmessage(), file = stderr()) |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
5 q("no", 1, FALSE) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
6 } |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
7 ) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
8 warnings() |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
9 |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
10 library(RColorBrewer) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
11 library(lattice) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
12 library(latticeExtra) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
13 library(grid) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
14 library(gridExtra) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
15 library(optparse) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
16 |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
17 option_list <- list( |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
18 make_option("--h_dataframe", type = "character", |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
19 help = "path to h-signature dataframe"), |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
20 make_option("--z_dataframe", type = "character", |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
21 help = "path to z-signature dataframe"), |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
22 make_option("--plot_method", type = "character", |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
23 help = "How data should be plotted (global or lattice)"), |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
24 make_option("--pdf", type = "character", help = "path to the pdf file with plots"), |
14
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
25 make_option("--title", type = "character", help = "Graph Title"), |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
26 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
27 make_option("--npairs_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Numbers-of-pairs plot"), |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
28 make_option("--npairszscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Number-of-pairs-Z−scores plot"), |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
29 make_option("--overlapprob_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities plot"), |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
30 make_option("--overlapprobzscore_ylim", type = "integer", default = 0, help = "Maximum of Y-scale of the Overlap-probabilities-Z−scores plot") |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
31 ) |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
32 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
33 args <- parse_args(parser) |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
34 |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
35 # data frames implementation |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
36 h_dataframe <- read.delim(args$h_dataframe, header = FALSE) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
37 colnames(h_dataframe) <- c("chrom", "overlap", "sig", "z-score") |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
38 h_dataframe$sig <- h_dataframe$sig * 100 # to get probs in % |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
39 z_dataframe <- read.delim(args$z_dataframe, header = FALSE) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
40 colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score") |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
41 |
14
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
42 # graph limits parameters |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
43 if (args$npairs_ylim == 0) { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
44 npairs_ylim <- NULL |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
45 } else { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
46 npairs_ylim <- c(0, args$npairs_ylim) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
47 } |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
48 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
49 if (args$npairszscore_ylim == 0) { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
50 npairszscore_ylim <- NULL |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
51 } else { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
52 npairszscore_ylim <- c(0, args$npairszscore_ylim) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
53 } |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
54 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
55 if (args$overlapprob_ylim == 0) { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
56 overlapprob_ylim <- NULL |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
57 } else { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
58 overlapprob_ylim <- c(0, args$overlapprob_ylim) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
59 } |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
60 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
61 if (args$overlapprobzscore_ylim == 0) { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
62 overlapprobzscore_ylim <- NULL |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
63 } else { |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
64 overlapprobzscore_ylim <- c(0, args$overlapprobzscore_ylim) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
65 } |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
66 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
67 |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
68 # functions |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
69 globalgraph <- function() { |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
70 pdf(args$pdf) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
71 par(mfrow = c(2, 2), oma = c(0, 0, 3, 0)) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
72 |
14
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
73 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 3)], |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
74 type = "h", main = "Numbers of pairs", cex.main = 1, xlab = "overlap (nt)", |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
75 ylab = "Numbers of pairs", col = "darkslateblue", lwd = 4, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
76 ylim = npairs_ylim |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
77 ) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
78 |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
79 plot(z_dataframe[z_dataframe$chrom == "all_chromosomes", c(2, 4)], |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
80 type = "l", main = "Number of pairs Z-scores", cex.main = 1, xlab = "overlap (nt)", |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
81 ylab = "z-score", pch = 19, cex = 0.2, col = "darkslateblue", lwd = 2, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
82 ylim = npairszscore_ylim |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
83 ) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
84 |
14
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
85 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 3)], |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
86 type = "l", main = "Overlap probabilities", cex.main = 1, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
87 xlab = "overlap (nt)", |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
88 ylab = "Probability [%]", pch = 19, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
89 col = "darkslateblue", lwd = 2, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
90 ylim = overlapprob_ylim |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
91 ) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
92 |
14
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
93 plot(h_dataframe[h_dataframe$chrom == "all_chromosomes", c(2, 4)], |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
94 type = "l", main = "Overlap Probability Z-scores", cex.main = 1, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
95 xlab = "overlap (nt)", ylab = "z-score", pch = 19, cex = 0.2, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
96 col = "darkslateblue", lwd = 2, |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
97 ylim = overlapprobzscore_ylim |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
98 ) |
5150d641d515
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit a54b915a3a245a71ca01ec9de2b5426cfb88504c
artbio
parents:
12
diff
changeset
|
99 |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
100 mtext(args$title, outer = TRUE, cex = 1) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
101 dev.off() |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
102 } |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
103 |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
104 treillisgraph <- function(df, ...) { |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
105 pdf(args$pdf, paper = "special", height = 11.69, width = 6) |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
106 p <- xyplot(sig ~ overlap | factor(method, levels = unique(method)) + chrom, |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
107 data = df, |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
108 type = "l", |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
109 col = "darkblue", |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
110 cex = 0.5, |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
111 scales = list(y = list(tick.number = 4, relation = "free", cex = 0.6, |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
112 rot = 0), |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
113 x = list(cex = 0.6, alternating = FALSE)), |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
114 xlab = "Overlap", |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
115 ylab = "signature (Nbr of pairs / Overlap prob.)", |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
116 main = args$title, |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
117 par.strip.text = list(cex = .5), |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
118 pch = 19, lwd = 2, |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
119 as.table = TRUE, |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
120 layout = c(2, 12), |
12
aa5e2c64dff8
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
artbio
parents:
11
diff
changeset
|
121 newpage = TRUE, |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
122 ...) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
123 plot(p) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
124 dev.off() |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
125 } |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
126 |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
127 # main |
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
128 |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
129 if (args$plot_method == "global") { |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
130 globalgraph() |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
131 } |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
132 |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
133 if (args$plot_method == "lattice") { |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
134 # rearrange dataframes |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
135 h_sig <- h_dataframe[, c(1, 2, 3)] |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
136 h_sig <- cbind(rep("Overlap Prob (%)", length(h_sig[, 1])), h_sig) |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
137 colnames(h_sig) <- c("method", "chrom", "overlap", "sig") |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
138 z_pairs <- z_dataframe[, c(1, 2, 3)] |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
139 z_pairs <- cbind(rep("Nbr of pairs", length(z_pairs[, 1])), z_pairs) |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
140 colnames(z_pairs) <- c("method", "chrom", "overlap", "sig") |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
141 lattice_df <- rbind(z_pairs, h_sig) |
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
142 par_settings_treillis <- list(strip.background = list( |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
143 col = c("lightblue", "lightgreen"))) |
11
8d3ca9652a5b
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 8691f2575cacd71c971338658198a1324e5f9370"
artbio
parents:
0
diff
changeset
|
144 treillisgraph(lattice_df, par.settings = par_settings_treillis) |
0
a35e6f9c1d34
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6719543c5017d581ae012b864d7c9088f0767fc8
artbio
parents:
diff
changeset
|
145 } |