Repository 'toolfactory'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/toolfactory

Changeset 10:59bce2efadfe (2014-03-20)
Previous changeset 9:e4e097a41064 (2014-03-19) Next changeset 11:704ccaade924 (2014-03-20)
Commit message:
Uploaded
modified:
rgToolFactory.xml
b
diff -r e4e097a41064 -r 59bce2efadfe rgToolFactory.xml
--- a/rgToolFactory.xml Wed Mar 19 21:42:08 2014 -0400
+++ b/rgToolFactory.xml Thu Mar 20 05:03:17 2014 -0400
[
@@ -195,7 +195,7 @@
  for (i in 1:10) {
     foo = runif(100)
     bar = rnorm(100)
-    bar = foo + 0.2*bar
+    bar = foo + 0.05*bar
     pdf(paste('yet',i,"anotherplot.pdf",sep='_'))
     plot(foo,bar,main=paste("Foo by Bar plot #",i),col="maroon", pch=3,cex=0.6)
     dev.off()
@@ -206,6 +206,30 @@
     dev.off()
  }
 
+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) {
+   foo = runif(100)
+   bar = rnorm(100)
+   bar = foo + 0.2*bar
+   pdf(paste("yet",i,"anotherplot.pdf",sep="_"))
+   plot(foo,bar,main=paste("Foo by Bar plot ",i),col="maroon", pch=3,cex=0.6)
+   dev.off()
+   foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
+   bar = as.matrix(foo)
+   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)::