annotate ribowaltz_plot.R @ 1:042cab870a39 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
author iuc
date Mon, 23 Oct 2023 12:10:31 +0000
parents 6d4c94373bba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
1 # setup R error handling to go to stderr
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
2 options(show.error.messages = FALSE, error = function() {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
3 cat(geterrmessage(), file = stderr())
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
4 q("no", 1, FALSE)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
5 })
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
6
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
7 # we need that to not crash galaxy with an UTF8 error on German LC settings.
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
8 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
9 library("getopt")
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
10 options(stringAsFactors = FALSE, useFancyQuotes = FALSE)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
11 args <- commandArgs(trailingOnly = TRUE)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
12
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
13 # get options, using the spec as defined by the enclosed list.
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
14 # we read the options from the default: commandArgs(TRUE).
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
15 spec <- matrix(c(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
16 "quiet", "q", 0, "logical",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
17 "help", "h", 0, "logical",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
18 "input_rdata", "i", 1, "character",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
19 "params_rlength_distr", "r", 0, "character",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
20 "params_rends_heat", "e", 0, "character",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
21 "region_psite_plot", "R", 0, "logical",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
22 "params_trint_periodicity", "t", 0, "character",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
23 "params_metaplots", "m", 0, "character",
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
24 "params_codon_usage_psite", "u", 0, "character"
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
25 ), byrow = TRUE, ncol = 4)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
26 opt <- getopt(spec)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
27
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
28 # if help was asked for print a friendly message
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
29 # and exit with a non-zero error code
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
30 if (!is.null(opt$help)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
31 cat(getopt(spec, usage = TRUE))
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
32 q(status = 1)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
33 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
34
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
35 verbose <- is.null(opt$quiet)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
36
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
37 library("riboWaltz")
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
38 library("jsonlite")
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
39
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
40 load(opt$input_rdata)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
41
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
42 if (!is.null(opt$params_rlength_distr)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
43 pdf("read_lengths.pdf")
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
44 json_rlength_distr <- fromJSON(opt$params_rlength_distr)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
45 length_dist <- rlength_distr(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
46 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
47 sample = names(reads_psite_list),
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
48 cl = json_rlength_distr$cl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
49 multisamples = json_rlength_distr$multisamples,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
50 plot_style = json_rlength_distr$plot_style
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
51 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
52 print(length_dist)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
53 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
54 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
55
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
56 if (!is.null(opt$params_rends_heat)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
57 pdf("read_ends_heatmap.pdf", height = 5 * length(reads_psite_list), width = 15)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
58 json_rends_heat <- fromJSON(opt$params_rends_heat)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
59 for (sample_name in names(reads_psite_list)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
60 ends_heatmap <- rends_heat(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
61 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
62 annotation_dt,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
63 sample = sample_name,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
64 cl = json_rends_heat$cl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
65 utr5l = json_rends_heat$utr5l,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
66 cdsl = json_rends_heat$cdsl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
67 utr3l = json_rends_heat$utr3l
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
68 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
69 print(ends_heatmap[["plot"]])
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
70 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
71 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
72 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
73
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
74 if (!is.null(opt$region_psite_plot)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
75 pdf("psites_per_region.pdf", height = 12, width = 7 * length(reads_psite_list))
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
76 psite_region <- region_psite(reads_psite_list, annotation_dt, sample = names(reads_psite_list))
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
77 print(psite_region[["plot"]])
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
78 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
79 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
80
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
81 if (!is.null(opt$params_trint_periodicity)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
82 pdf("trinucleotide_periodicity.pdf", height = 6 * length(reads_psite_list), width = 10)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
83 json_trint_periodicity <- fromJSON(opt$params_trint_periodicity)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
84 frames_stratified <- frame_psite_length(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
85 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
86 sample = names(reads_psite_list),
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
87 cl = json_trint_periodicity$cl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
88 region = json_trint_periodicity$region,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
89 length_range = json_trint_periodicity$length_range
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
90 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
91 frames_stratified[["plot"]]
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
92 frames <- frame_psite_length(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
93 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
94 sample = names(reads_psite_list),
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
95 region = json_trint_periodicity$region,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
96 length_range = json_trint_periodicity$length_range
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
97 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
98 print(frames[["plot"]])
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
99 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
100 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
101
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
102 if (!is.null(opt$params_metaplots)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
103 pdf("metaplots.pdf", height = 5 * length(reads_psite_list), width = 24)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
104 json_metaplots <- fromJSON(opt$params_metaplots)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
105 metaprofile <- metaprofile_psite(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
106 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
107 annotation_dt,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
108 sample = names(reads_psite_list),
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
109 multisamples = json_metaplots$multisamples,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
110 plot_style = json_metaplots$plot_style,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
111 length_range = json_metaplots$length_range,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
112 frequency = json_metaplots$frequency,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
113 utr5l = json_metaplots$utr5l,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
114 cdsl = json_metaplots$cdsl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
115 utr3l = json_metaplots$utr3l,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
116 plot_title = "sample.transcript.length_range"
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
117 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
118 print(metaprofile)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
119 sample_list <- list()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
120 for (sample_name in names(reads_psite_list)) {
1
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
121 sample_list[[sample_name]] <- c(sample_name)
0
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
122 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
123 metaheatmap <- metaheatmap_psite(
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
124 reads_psite_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
125 annotation_dt,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
126 sample = sample_list,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
127 length_range = json_metaplots$length_range,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
128 utr5l = json_metaplots$utr5l,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
129 cdsl = json_metaplots$cdsl,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
130 utr3l = json_metaplots$utr3l,
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
131 plot_title = "Comparison metaheatmap"
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
132 )
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
133 print(metaheatmap[["plot"]])
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
134 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
135 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
136
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
137 if (!is.null(opt$params_codon_usage_psite)) {
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
138 pdf("codon_usage.pdf", height = 6, width = 16)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
139 json_codon_usage_psite <- fromJSON(opt$params_codon_usage_psite)
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
140 for (sample_name in names(reads_psite_list)) {
1
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
141 cu_barplot <- codon_usage_psite(
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
142 reads_psite_list,
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
143 annotation_dt,
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
144 sample = sample_name,
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
145 fastapath = json_codon_usage_psite$fastapath,
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
146 fasta_genome = FALSE,
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
147 frequency_normalization = json_codon_usage_psite$frequency
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
148 )
042cab870a39 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
iuc
parents: 0
diff changeset
149 print(cu_barplot[["plot"]])
0
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
150 }
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
151 dev.off()
6d4c94373bba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff changeset
152 }