0
|
1 # Start_GenometriCorr.R
|
|
2
|
|
3 ###################################################
|
|
4 # #
|
|
5 # command-line interface to GenometriCorr #
|
|
6 # functions, for use with Galaxy. #
|
|
7 # #
|
|
8 ###################################################
|
|
9
|
|
10 capture.output <- function (result, pdffile, output_options)
|
|
11 {
|
|
12 if(output_options != "stats")
|
|
13 {
|
|
14 pdf(file=pdffile, width=10, height=19, paper="special")
|
|
15
|
|
16 if (output_options != "vis") #need to do a plot
|
|
17 {
|
|
18 mymat <- matrix(ncol=3, nrow=4)
|
|
19 mymat[1,1] <- 1
|
|
20 mymat[1,2] <- 2
|
|
21 mymat[1,3] <- 3
|
|
22 mymat[2,1] <- 4
|
|
23 mymat[2,2] <- 5
|
|
24 mymat[2,3] <- 6
|
|
25 mymat[3,1] <- 7
|
|
26 mymat[3,2] <- 8
|
|
27 mymat[3,3] <- 9
|
|
28 mymat[4,1] <- 10
|
|
29 mymat[4,2] <- 11
|
|
30 mymat[4,3] <- 12
|
|
31
|
|
32 layout(mymat, heights=c(0.2,0.2,0.2,0.2))
|
|
33 plot(result, pdffile, make.new=FALSE)
|
|
34 }
|
|
35 if (output_options != "plot") #need to do the bigger graphic
|
|
36 {
|
|
37 mymat <- matrix(ncol=2, nrow=8)
|
|
38 mymat[1,1] <- 2
|
|
39 mymat[1,2] <- 3
|
|
40 mymat[2,1] <- 4
|
|
41 mymat[2,2] <- 4
|
|
42 mymat[3,1] <- 1
|
|
43 mymat[3,2] <- 1
|
|
44 mymat[4,1] <- 5
|
|
45 mymat[4,2] <- 6
|
|
46 mymat[5,1] <- 7
|
|
47 mymat[5,2] <- 7
|
|
48 mymat[6,1] <- 8
|
|
49 mymat[6,2] <- 9
|
|
50 mymat[7,1] <- 10
|
|
51 mymat[7,2] <- 10
|
|
52 mymat[8,1] <- 11
|
|
53 mymat[8,2] <- 12
|
|
54 layoutresults <- 3
|
|
55
|
|
56 layout(mymat, heights=c(0.05,0.05,0.15,0.15,0.15,0.15,0.15,0.15))
|
|
57 visualize(result, pdffile, make.new=FALSE)
|
|
58 }
|
|
59 dev.off()
|
|
60 }
|
|
61
|
|
62 if (output_options == "stats")
|
|
63 {
|
|
64 show(result)
|
|
65 }
|
|
66 }
|
|
67
|
|
68
|
|
69
|
|
70 # Reads the command line arguments
|
|
71 args <- commandArgs(trailingOnly=T)
|
|
72
|
|
73 suppressPackageStartupMessages(library('GenometriCorr', warn.conflicts=F, verbose=F))
|
|
74 suppressPackageStartupMessages(library('graphics', warn.conflicts=F, verbose=F))
|
|
75 suppressPackageStartupMessages(library('gdata', warn.conflicts=F, verbose=F))
|
|
76 suppressPackageStartupMessages(library('gplots', warn.conflicts=F, verbose=F))
|
|
77 suppressPackageStartupMessages(library('gtools', warn.conflicts=F, verbose=F))
|
|
78 suppressPackageStartupMessages(library('caTools', warn.conflicts=F, verbose=F))
|
|
79 suppressPackageStartupMessages(library('grid', warn.conflicts=F, verbose=F))
|
|
80
|
|
81
|
|
82
|
|
83 # Variables
|
|
84 query_file <- ""
|
|
85 reference_file <- ""
|
|
86 config_file <- ""
|
|
87 output_options <- ""
|
|
88
|
|
89 # Parse the command line arguments
|
|
90
|
|
91 config_file <- args[1]
|
|
92 query_file <- as.character(args[2])
|
|
93 reference_file <- as.character(args[3])
|
|
94 output_options <- args[4]
|
|
95 pdffile <- args[5]
|
|
96
|
|
97 conf<-new("GenometriCorrConfig",config_file)
|
|
98
|
|
99 print('OK')
|
|
100
|
|
101 result<-suppressWarnings(suppressPackageStartupMessages(GenometriCorr:::run.config(conf,query=query_file,reference=reference_file)))
|
|
102 print('OK2')
|
|
103
|
|
104 hideoutput <- capture.output(result, pdffile=args[5], output_options)
|
|
105
|