Mercurial > repos > nikos > rna_probing
comparison plot_rna.R @ 24:431aebd93843 draft default tip
Fixed a bug in k2n.R where the function k2n_calc() would result in an error for single-end read files.
author | nikos |
---|---|
date | Wed, 05 Aug 2015 09:21:02 -0400 |
parents | 33e625bef2b9 |
children |
comparison
equal
deleted
inserted
replaced
23:fb76303acf4f | 24:431aebd93843 |
---|---|
1 #Setup R error handling to go to stderr | |
2 options( show.error.messages = FALSE, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) | |
3 | |
4 # we need that to not crash galaxy with an UTF8 error on German LC settings. | |
5 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") | |
6 | |
7 suppressMessages(library('getopt')) | |
8 | |
9 #get options, using the spec as defined by the enclosed list. | |
10 #we read the options from the default: commandArgs(TRUE). | |
11 spec = matrix(c( | |
12 'help' , 'h', 0, "logical", | |
13 'input', 'i', 1, "character", | |
14 'transcript', 't', 1, "character", | |
15 'method', 'm', 2, "character", | |
16 'cutoff', 'c', 2, "double", | |
17 'type', 'p', 2, "character", | |
18 'output', 'o', 1, "character" | |
19 ), byrow=TRUE, ncol=4); | |
20 | |
21 opt = getopt(spec); | |
22 | |
23 suppressMessages(require(RNAprobR)) | |
24 | |
25 #Read and convert input to GRanges object | |
26 data <- read.table(opt$input, header = TRUE) | |
27 dataGR <- norm_df2GR(data) | |
28 | |
29 #Check if given transcript exists in input file | |
30 if ( ! opt$transcript %in% data$RNAid ) { stop("Transript not found. Check input file.") } | |
31 | |
32 pdf(opt$output) | |
33 for (method in strsplit(opt$method, ",")[[1]] ) { | |
34 | |
35 #Check if columns exists in data file | |
36 if (! method %in% colnames(data)) { next } | |
37 | |
38 plotRNA(dataGR, opt$transcript, method, stat_cutoff = opt$cutoff, type = opt$type, | |
39 main=paste(opt$transcript,": ", method, sep="")) | |
40 } | |
41 dev.off() |