comparison rgToolFactory.xml @ 46:dbe3825e385c draft

Uploaded
author fubar
date Sun, 01 Mar 2015 06:17:34 -0500
parents 7b34711416d2
children e9ebb410930d
comparison
equal deleted inserted replaced
45:7b34711416d2 46:dbe3825e385c
204 output file or None if none is wanted, as the first and second command line parameters. The script must deal appropriately with these - see Rscript examples below. 204 output file or None if none is wanted, as the first and second command line parameters. The script must deal appropriately with these - see Rscript examples below.
205 Note that if an optional HTML output is selected, all the output files created by the script will be nicely presented as links, with pdf images linked as thumbnails in that output. 205 Note that if an optional HTML output is selected, all the output files created by the script will be nicely presented as links, with pdf images linked as thumbnails in that output.
206 This can be handy for complex scripts creating lots of output. 206 This can be handy for complex scripts creating lots of output.
207 207
208 **Examples** 208 **Examples**
209
209 <![CDATA[ 210 <![CDATA[
210
211 Each of these following trivial examples can be cut and pasted into the script box for testing. 211 Each of these following trivial examples can be cut and pasted into the script box for testing.
212 Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input 212 Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input
213 213
214 A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and 214 A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and
215 writes the results to a new tabular file. Note the use of colClasses to ensure that no fiddling takes place with numeric values by treating everything 215 writes the results to a new tabular file. Note the use of colClasses to ensure that no fiddling takes place with numeric values by treating everything
256 pdf(paste('yet',i,"anotherheatmap.pdf",sep='_')) 256 pdf(paste('yet',i,"anotherheatmap.pdf",sep='_'))
257 heatmap(bar,main='Random Heatmap') 257 heatmap(bar,main='Random Heatmap')
258 dev.off() 258 dev.off()
259 } 259 }
260 260
261 A slight variation taking an input tabular file from which we read the first number as nreps 261 A slight variation taking an input tabular file from which we read the first number as nreps::
262 262
263 # note this script takes a single parameter 263 # note this script takes a single parameter
264 # number of replicates 264 # number of replicates
265 ourargs = commandArgs(TRUE) 265 ourargs = commandArgs(TRUE)
266 infname = ourargs[1] 266 infname = ourargs[1]
267 nreps = read.table(infname,head=F) 267 nreps = read.table(infname,head=F)
268 nreps = unlist(nreps)[1] 268 nreps = unlist(nreps)[1]
269 nreps = max(c(1,nreps)) 269 nreps = max(c(1,nreps))
270 nreps = min(c(20,nreps)) 270 nreps = min(c(20,nreps))
271 print(paste("Using nreps=",nreps)) 271 print(paste("Using nreps=",nreps))
272 for (i in 1:nreps) { 272 for (i in 1:nreps) {
273 foo = runif(100) 273 foo = runif(100)
274 bar = rnorm(100) 274 bar = rnorm(100)
275 bar = foo + 0.2*bar 275 bar = foo + 0.2*bar
276 pdf(paste("yet",i,"anotherplot.pdf",sep="_")) 276 pdf(paste("yet",i,"anotherplot.pdf",sep="_"))
277 plot(foo,bar,main=paste("Foo by Bar plot ",i),col="maroon", pch=3,cex=0.6) 277 plot(foo,bar,main=paste("Foo by Bar plot ",i),col="maroon", pch=3,cex=0.6)
279 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100)) 279 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
280 bar = as.matrix(foo) 280 bar = as.matrix(foo)
281 pdf(paste("yet",i,"anotherheatmap.pdf",sep="_")) 281 pdf(paste("yet",i,"anotherheatmap.pdf",sep="_"))
282 heatmap(bar,main="Random Heatmap") 282 heatmap(bar,main="Random Heatmap")
283 dev.off() 283 dev.off()
284 } 284 }
285 285
286 A Python example that reverses each row of a tabular file (you'll need to remove the leading spaces 286 A Python example that reverses each row of a tabular file (you'll need to remove the leading spaces
287 for this to work if cut and pasted into the script box):: 287 for this to work if cut and pasted into the script box)::
288 288
289 # reverse order of columns in a tabular file 289 # reverse order of columns in a tabular file
326 close(OF); 326 close(OF);
327 close(NF); 327 close(NF);
328 328
329 ]]> 329 ]]>
330 330
331
331 **Citation** 332 **Citation**
332 333
333 334
334 Paper_ : 335 Paper_ :
335 336