Mercurial > repos > iuc > ribowaltz_plot
annotate ribowaltz_plot.R @ 0:8e903cb3f919 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
author | iuc |
---|---|
date | Thu, 22 Sep 2022 20:30:20 +0000 |
parents | |
children | e25d81465c23 |
rev | line source |
---|---|
0
8e903cb3f919
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 |
8e903cb3f919
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() { |
8e903cb3f919
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()) |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
5 }) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
6 |
8e903cb3f919
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. |
8e903cb3f919
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") |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
9 library("getopt") |
8e903cb3f919
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) |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
12 |
8e903cb3f919
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. |
8e903cb3f919
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). |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
15 spec <- matrix(c( |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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", |
8e903cb3f919
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" |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
26 opt <- getopt(spec) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
27 |
8e903cb3f919
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 |
8e903cb3f919
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 |
8e903cb3f919
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)) { |
8e903cb3f919
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)) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
32 q(status = 1) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
33 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
34 |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
36 |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
37 library("riboWaltz") |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
38 library("jsonlite") |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
39 |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
41 |
8e903cb3f919
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)) { |
8e903cb3f919
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") |
8e903cb3f919
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) |
8e903cb3f919
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( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
46 reads_psite_list, |
8e903cb3f919
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), |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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 |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
51 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
52 print(length_dist) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
53 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
54 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
55 |
8e903cb3f919
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)) { |
8e903cb3f919
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) |
8e903cb3f919
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) |
8e903cb3f919
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)) { |
8e903cb3f919
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( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
61 reads_psite_list, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
62 annotation_dt, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
63 sample = sample_name, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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 |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
68 ) |
8e903cb3f919
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"]]) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
70 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
71 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
72 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
73 |
8e903cb3f919
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)) { |
8e903cb3f919
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)) |
8e903cb3f919
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)) |
8e903cb3f919
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"]]) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
78 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
79 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
80 |
8e903cb3f919
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)) { |
8e903cb3f919
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) |
8e903cb3f919
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) |
8e903cb3f919
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( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
85 reads_psite_list, |
8e903cb3f919
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), |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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 |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
90 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
91 frames_stratified[["plot"]] |
8e903cb3f919
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( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
93 reads_psite_list, |
8e903cb3f919
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), |
8e903cb3f919
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, |
8e903cb3f919
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 |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
97 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
98 print(frames[["plot"]]) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
99 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
100 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
101 |
8e903cb3f919
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)) { |
8e903cb3f919
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) |
8e903cb3f919
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) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
105 metaprofile <- metaprofile_psite( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
106 reads_psite_list, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
107 annotation_dt, |
8e903cb3f919
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), |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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" |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
117 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
118 print(metaprofile) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
119 sample_list <- list() |
8e903cb3f919
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)) { |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
121 sample_list[[sample_name]] <- c(sample_name) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
122 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
123 metaheatmap <- metaheatmap_psite( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
124 reads_psite_list, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
125 annotation_dt, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
126 sample = sample_list, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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, |
8e903cb3f919
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" |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
132 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
133 print(metaheatmap[["plot"]]) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
134 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
135 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
136 |
8e903cb3f919
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)) { |
8e903cb3f919
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) |
8e903cb3f919
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) |
8e903cb3f919
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)) { |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
141 cu_barplot <- codon_usage_psite( |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
142 reads_psite_list, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
143 annotation_dt, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
144 sample = sample_name, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
145 fastapath = json_codon_usage_psite$fastapath, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
146 fasta_genome = FALSE, |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
147 frequency_normalization = json_codon_usage_psite$frequency |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
148 ) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
149 print(cu_barplot[["plot"]]) |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
150 } |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
151 dev.off() |
8e903cb3f919
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit ff002df702f544829d1b500ac4b517c1e70ad14d
iuc
parents:
diff
changeset
|
152 } |