# HG changeset patch # User fubar # Date 1425208654 18000 # Node ID dbe3825e385cd4aebbf9b13da67d8fd4a5fa8283 # Parent 7b34711416d29e67cf7abc68fbf4bad85fdf5d14 Uploaded diff -r 7b34711416d2 -r dbe3825e385c rgToolFactory.xml --- a/rgToolFactory.xml Sun Mar 01 05:57:52 2015 -0500 +++ b/rgToolFactory.xml Sun Mar 01 06:17:34 2015 -0500 @@ -206,8 +206,8 @@ This can be handy for complex scripts creating lots of output. **Examples** + <![CDATA[ - Each of these following trivial examples can be cut and pasted into the script box for testing. Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input @@ -258,18 +258,18 @@ dev.off() } -A slight variation taking an input tabular file from which we read the first number as nreps +A slight variation taking an input tabular file from which we read the first number as nreps:: -# note this script takes a single parameter -# number of replicates -ourargs = commandArgs(TRUE) -infname = ourargs[1] -nreps = read.table(infname,head=F) -nreps = unlist(nreps)[1] -nreps = max(c(1,nreps)) -nreps = min(c(20,nreps)) -print(paste("Using nreps=",nreps)) -for (i in 1:nreps) { + # note this script takes a single parameter + # number of replicates + ourargs = commandArgs(TRUE) + infname = ourargs[1] + nreps = read.table(infname,head=F) + nreps = unlist(nreps)[1] + nreps = max(c(1,nreps)) + nreps = min(c(20,nreps)) + print(paste("Using nreps=",nreps)) + for (i in 1:nreps) { foo = runif(100) bar = rnorm(100) bar = foo + 0.2*bar @@ -281,7 +281,7 @@ pdf(paste("yet",i,"anotherheatmap.pdf",sep="_")) heatmap(bar,main="Random Heatmap") dev.off() -} + } A Python example that reverses each row of a tabular file (you'll need to remove the leading spaces for this to work if cut and pasted into the script box):: @@ -328,6 +328,7 @@ ]]> + **Citation**