annotate RnBeadsGalaxy.R @ 45:6b0981ab063e draft default tip

Uploaded
author pavlo-lutsik
date Thu, 14 Aug 2014 14:56:18 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
1 #msg.file<-file("RnBeads.messages.out", open="w")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
2 #sink(file=msg.file)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
3
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
4
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
5 ## add the RnBeads dependencies if we are on a cloud share-instance
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
6 if("Rsitelibrary" %in% list.files("/mnt")){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
7 .libPaths("/mnt/galaxy/Rsitelibrary")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
8 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
9
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
10 if(!'wordcloud' %in% rownames(installed.packages())){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
11 install.packages('wordcloud',repos='http://cran.us.r-project.org')
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
12 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
13
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
14 suppressWarnings(suppressPackageStartupMessages(library(RnBeads)))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
15 suppressWarnings(suppressPackageStartupMessages(library(getopt)))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
16
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
17
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
18 fname <- system.file(file.path("extdata", "options.txt"), package = "RnBeads")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
19 table.options <- read.delim(fname, quote = "", stringsAsFactors = FALSE)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
20 rownames(table.options) <- table.options[, "Name"]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
21
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
22 all.opts<-table.options$Name
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
23 #all.opts<-names(rnb.options())
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
24 #opt.class<-RnBeads:::OPTION.TYPES[-28]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
25 opt.class<-table.options$Type
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
26 names(opt.class)<-all.opts
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
27 #all.opts<-names(opt.class)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
28 #all.opts<-paste("--", all.opts, sep="")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
29 #all.opts<-gsub("\\.([a-z])", "\\U\\1", all.opts, perl=TRUE)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
30 all.opts<-gsub("\\.","-", all.opts)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
31 #opt.class<-sapply(rnb.options(), class)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
32
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
33 rnb.opt.spec<-data.frame(
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
34 Long=all.opts,
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
35 Short=as.character(1:length(all.opts)),
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
36 Mask=c(1,2)[as.integer((opt.class=="logical"))+1],
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
37 Type=opt.class)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
38
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
39 ### automated xml file preparation
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
40 #xml.strings<-apply(rnb.opt.spec,1, function(row){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
41 #
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
42 # opt.lab<-gsub("-", ".", row[1])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
43 # opt.def.val<-rnb.getOption(opt.lab)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
44 # #print(opt.def.val)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
45 # opt.name<-gsub("-([0-9a-z])", "\\U\\1", row[1], perl=TRUE)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
46 # tf.opt<-"\t\t\t<option value=\"True\">True</option>\n\t\t\t<option value=\"False\">False</option>"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
47 # opt.lab<-paste(opt.lab, gsub("\\."," ", row[4]), sep=", ")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
48 # if(row[4]=="logical"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
49 # opt.type<-'select'
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
50 # if(!is.null(opt.def.val) && opt.def.val)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
51 # opt.def.val<-"1" else
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
52 # opt.def.val<-"0"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
53 # string<-sprintf("\t\t<param name=\"%s\" type=\"%s\" label=\"%s\" value=\"%s\">\n%s\n\t\t</param>\n", opt.name, opt.type, opt.lab, opt.def.val, tf.opt)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
54 # }else{
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
55 # opt.type<-'text'
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
56 # if(length(opt.def.val)<1L){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
57 # opt.def.val<-""
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
58 # }else{
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
59 # if(!is.null(opt.def.val) && opt.def.val!="")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
60 # opt.def.val<-paste(opt.def.val, collapse=",") else
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
61 # opt.def.val<-""
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
62 # }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
63 # string<-sprintf("\t\t<param name=\"%s\" type=\"%s\" label=\"%s\" value=\"%s\"/>\n", opt.name, opt.type, opt.lab, opt.def.val)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
64 # }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
65 # string
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
66 # })
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
67 ##cat(xml.strings, sep="", file="automated.settings.xml.txt")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
68 #
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
69 #opt.def.strings<-apply(rnb.opt.spec,1, function(row){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
70 #
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
71 # opt.name<-gsub("-([0-9a-z])", "\\U\\1", row[1], perl=TRUE)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
72 # opt.long<-row[1]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
73 # opt.short<-row[2]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
74 #
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
75 # if(row[4]=="logical"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
76 # def.string<-sprintf("#if str( $options.%s ) == \"True\"\n\t--%s\n#end if\n", opt.name, opt.long)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
77 # }else{
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
78 # def.string<-sprintf("#if str( $options.%s ) != \"\"\n\t--%s=\"$options.%s\" \n#end if\n", opt.name, opt.long, opt.name)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
79 # }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
80 # def.string
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
81 #
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
82 # })
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
83 #cat(opt.def.strings, sep="", file="automated.option.assignments.txt")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
84
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
85
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
86 rnb.opt.spec$Type<-gsub("\\.vector", "", rnb.opt.spec$Type)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
87 rnb.opt.spec$Type<-gsub("numeric", "double", rnb.opt.spec$Type)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
88 rnb.opt.spec<-rbind(data.frame(
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
89 Long=c("data-type", "pheno", "idat-dir","idat-files","bed-files", "gs-report", "geo-series", "betas", "pvals","output-file", "report-dir"),
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
90 Short=c("d","s","a","i","f","g","e","b","p","r","o"),
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
91 Mask=c(1,2,2,2,2,2,2,2,2,1,1),
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
92 Type=c("character","character","character","character","character","character","character","character","character","character", "character")),
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
93 rnb.opt.spec)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
94
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
95 opts<-getopt(as.matrix(rnb.opt.spec))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
96 #opts<-getopt(as.matrix(rnb.opt.spec), opt=list("--data-type=idats","--report-dir=dir", "--idats=file1\tfile2"))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
97 print(opts)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
98
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
99 if(opts[["data-type"]]=="idatDir"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
100
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
101 data.source<-list()
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
102 data.type<-"idat.dir"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
103 data.source[["idat.dir"]]<-opts[["idat-dir"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
104 data.source[["sample.sheet"]]<-opts[["pheno"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
105
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
106 }else if(opts[["data-type"]]=="idatFiles"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
107
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
108 data.type<-"idat.dir"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
109 file.string<-gsub(" ","", opts[["idat-files"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
110 files<-strsplit(file.string, ",")[[1]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
111 files<-files[files!=""]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
112 bed.dir<-sprintf("%s_beds",opts[["report-dir"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
113 dir.create(bed.dir)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
114 file.copy(files, bed.dir)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
115 for(dat.file in list.files(bed.dir, full.names = TRUE)){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
116 file.rename(dat.file, gsub("\\.dat", ".bed", dat.file))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
117 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
118 data.source<-list()
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
119 data.source[["bed.dir"]]<-bed.dir
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
120 data.source[["sample.sheet"]]<-opts[["pheno"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
121
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
122
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
123 }else if(opts[["data-type"]]=="GS.report"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
124
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
125 data.type<-"GS.report"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
126 data.source<-opts[["gs-report"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
127
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
128 }else if(opts[["data-type"]]=="GEO"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
129
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
130 data.type<-"GEO"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
131 data.source<-opts[["geo-series"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
132
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
133 }else if(opts[["data-type"]]=="data.files"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
134
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
135 data.type<-"GEO"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
136 data.source<-opts[["geo-series"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
137
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
138 }else if(opts[["data-type"]]=="data.files"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
139
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
140 data.type<-"data.files"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
141 data.source<-c(opts[["pheno"]], opts[["betas"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
142 if(!is.null(opts[["pvals"]]))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
143 data.source<-c(data.source, opts[["pvals"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
144
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
145 }else if(opts[["data-type"]]=="bed.dir"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
146
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
147 data.type<-"bed.dir"
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
148 file.string<-gsub(" ","", opts[["bed-files"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
149 files<-strsplit(file.string, ",")[[1]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
150 files<-files[files!=""]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
151 bed.dir<-sprintf("%s_beds",opts[["report-dir"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
152 dir.create(bed.dir)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
153 file.copy(files, bed.dir)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
154 for(dat.file in list.files(bed.dir, full.names = TRUE)){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
155 file.rename(dat.file, gsub("\\.dat", ".bed", dat.file))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
156 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
157 data.source<-list()
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
158 data.source[["bed.dir"]]<-bed.dir
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
159
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
160 logger.start(fname="NA")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
161 sample.sheet<-read.sample.annotation(opts[["pheno"]])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
162 logger.close()
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
163 if(length(files) < nrow(sample.sheet))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
164 stop("Not all bed files are present")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
165
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
166 cn<-colnames(sample.sheet)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
167 dat.files<-sapply(strsplit(files, "\\/"), function(el) el[length(el)])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
168 sample.sheet<-cbind(sample.sheet, gsub("\\.dat", ".bed", dat.files))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
169 colnames(sample.sheet)<-c(cn, "BED_files")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
170 data.source[["sample.sheet"]]<-sample.sheet
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
171 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
172
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
173 if("logging" %in% names(opts)){ # TODO create a cleaner way of checking whether the full options set was supplied
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
174
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
175 dump<-sapply(names(opt.class), function(on){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
176 getoptname<-gsub("-", "\\.","-",on)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
177 if(getoptname %in% names(opts)){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
178 if(opt.class[on]=="logical"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
179 ov<-TRUE
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
180 }else if(opt.class %in% c("character","character.vector")){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
181 ov<-opts[[getoptname]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
182 ov<-gsub("\"", "", ov)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
183 if(opt.class=="character.vector"){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
184 ov<-as.character(strsplit(ov,","))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
185 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
186
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
187 }else if(opt.class %in% c("integer","numeric","integer.vector","numeric.vector")){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
188 ov<-opts[[getoptname]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
189 ov<-gsub("\"", "", ov)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
190 if(opt.class %in% c("integer.vector","numeric.vector")){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
191 ov<-as.character(strsplit(ov,","))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
192 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
193 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
194 eval(parse(text=sprintf("rnb.options(%s=ov)",on)))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
195 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
196 })
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
197
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
198 logical.opts<-names(opt.class[opt.class=="logical"])
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
199 logical.opts.false<-logical.opts[!logical.opts %in% gsub("-",".",names(opts))]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
200
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
201
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
202 dump<-sapply(logical.opts.false, function(on){
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
203 eval(parse(text=sprintf("rnb.options(%s=FALSE)",on)))
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
204 })
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
205 }
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
206
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
207 print(rnb.options())
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
208
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
209 #report.out.dir<-sprintf("%s_rnbReport", tempdir())
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
210 report.out.dir<-opts[["report-dir"]]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
211 print("Starting RnBeads with the following inputs:")
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
212 print(data.source)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
213 print(report.out.dir)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
214 print(data.type)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
215 rnb.run.analysis(data.source=data.source, dir.report=report.out.dir, data.type=data.type)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
216
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
217
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
218 #sink(file=NULL)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
219 #flush(msg.file)
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
220 #close(msg.file)