Mercurial > repos > artbio > small_rna_signatures
comparison signature.r @ 2:dc862983eb98 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_signatures commit 6806c0677e53d52164707faeb36947987f5c500a
| author | artbio |
|---|---|
| date | Sat, 22 Oct 2022 23:49:14 +0000 |
| parents | ca2b04cdbf4d |
| children | 2c448b9c0175 |
comparison
equal
deleted
inserted
replaced
| 1:ca2b04cdbf4d | 2:dc862983eb98 |
|---|---|
| 1 ## Setup R error handling to go to stderr | 1 ## Setup R error handling to go to stderr |
| 2 options(show.error.messages = F, | 2 options(show.error.messages = FALSE, |
| 3 error = function() { | 3 error = function() { |
| 4 cat(geterrmessage(), file = stderr()) | 4 cat(geterrmessage(), file = stderr()) |
| 5 q("no", 1, F) | 5 q("no", 1, FALSE) |
| 6 } | 6 } |
| 7 ) | 7 ) |
| 8 warnings() | 8 warnings() |
| 9 | 9 |
| 10 library(RColorBrewer) | 10 library(RColorBrewer) |
| 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 ) | 26 ) |
| 27 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) | 27 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) |
| 28 args <- parse_args(parser) | 28 args <- parse_args(parser) |
| 29 | 29 |
| 30 # data frames implementation | 30 # data frames implementation |
| 31 h_dataframe <- read.delim(args$h_dataframe, header = F) | 31 h_dataframe <- read.delim(args$h_dataframe, header = FALSE) |
| 32 colnames(h_dataframe) <- c("chrom", "overlap", "sig", "z-score") | 32 colnames(h_dataframe) <- c("chrom", "overlap", "sig", "z-score") |
| 33 h_dataframe$sig <- h_dataframe$sig * 100 # to get probs in % | 33 h_dataframe$sig <- h_dataframe$sig * 100 # to get probs in % |
| 34 z_dataframe <- read.delim(args$z_dataframe, header = F) | 34 z_dataframe <- read.delim(args$z_dataframe, header = FALSE) |
| 35 colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score") | 35 colnames(z_dataframe) <- c("chrom", "overlap", "sig", "z-score") |
| 36 | 36 |
| 37 # functions | 37 # functions |
| 38 globalgraph <- function() { | 38 globalgraph <- function() { |
| 39 pdf(args$pdf) | 39 pdf(args$pdf) |
| 75 main = args$title, | 75 main = args$title, |
| 76 par.strip.text = list(cex = .5), | 76 par.strip.text = list(cex = .5), |
| 77 pch = 19, lwd = 2, | 77 pch = 19, lwd = 2, |
| 78 as.table = TRUE, | 78 as.table = TRUE, |
| 79 layout = c(2, 12), | 79 layout = c(2, 12), |
| 80 newpage = T, | 80 newpage = TRUE, |
| 81 ...) | 81 ...) |
| 82 plot(p) | 82 plot(p) |
| 83 dev.off() | 83 dev.off() |
| 84 } | 84 } |
| 85 | 85 |
