annotate tools/mytools/Start_GenometriCorr.R @ 3:33c067c3ae34

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