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