Mercurial > repos > kuyt002 > vennerable_r
comparison vennerable/unused/Vennerable.R_backup_png_xml @ 0:77bbf955e8de default tip
initial commit
| author | eric |
|---|---|
| date | Thu, 06 Nov 2014 15:07:54 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:77bbf955e8de |
|---|---|
| 1 #!/usr/bin/R | |
| 2 | |
| 3 # R script to call Vennerable package from galaxy | |
| 4 # info: alex.bossers@wur.nl | |
| 5 | |
| 6 # R --slave --vanilla --file=PlotBar.R --args inputFile x_data weighting outputFile plottype resolution | |
| 7 # 1 2 3 4 5 6 7 8 9 10 11 | |
| 8 | |
| 9 #get cmd line args | |
| 10 args <- commandArgs() | |
| 11 in.file <- args[6] | |
| 12 xData <- args[7] # data labels xData of format "a, b, c" and can include spaces | |
| 13 weighting <- args[8] | |
| 14 out.file <- args[9] | |
| 15 plottype <- args[10] | |
| 16 resolution <- args[11] #in dpi | |
| 17 | |
| 18 #open lib | |
| 19 library(Vennerable) | |
| 20 | |
| 21 # for labels of bars or bar groups presume column names from data | |
| 22 if (xData != "default") { | |
| 23 # read without header input file (must be tabular) | |
| 24 annot_data <- read.table(in.file, header=F, sep="\t") | |
| 25 colnames (annot_data) <- strsplit(xData,",")[[1]] | |
| 26 Vannot <- Venn(annot_data) | |
| 27 } else { | |
| 28 # read without header input file (must be tabular) | |
| 29 annot_data <- read.table(in.file, header=T, sep="\t") | |
| 30 Vannot <- Venn(annot_data) | |
| 31 } | |
| 32 | |
| 33 #png(out.file,width = 1600, height = 1600, res = resolution) | |
| 34 png(out.file, res = resolution) | |
| 35 | |
| 36 # plot it | |
| 37 if (plottype == "ChowRuskey") { | |
| 38 plot(Vannot, type = plottype) | |
| 39 | |
| 40 } else if (plottype == "AWFE") { | |
| 41 plot(Vannot, doWeights = weighting, type = plottype) | |
| 42 | |
| 43 } else if (plottype == "circles") { | |
| 44 plot(Vannot) | |
| 45 | |
| 46 } else if (plottype == "ellipses"){ | |
| 47 plot(Vannot, type = "ellipses") | |
| 48 | |
| 49 } else if (plottype == "squares"){ | |
| 50 plot(Vannot, type = "squares") | |
| 51 | |
| 52 } | |
| 53 | |
| 54 cat ("version 1.0, info: alex.bossers@wur.nl\n") | |
| 55 dev.off() | |
| 56 |
