annotate variance_plot.R @ 19:f3d9bb18110a draft default tip

Uploaded
author mb2013
date Tue, 20 May 2014 03:30:07 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
1 #Plottool makes a graph barplot of the variance
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
2 #MB
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
3
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
4 #commands extracting of commandline
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
5 args <- commandArgs(TRUE)
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
6
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
7 #input files and options
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
8 input <- args[1]
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
9 title <- args[2]
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
10 #output file
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
11 output <- args[3]
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
12
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
13 #reading of input files
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
14 read <- read.csv(file <- input,header = TRUE)
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
15
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
16 stdev<- read[,1] #standard deviation
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
17 pov = stdev^2/sum(stdev^2) #variance
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
18
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
19 png(output) #output in png format
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
20
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
21
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
22 #creating the barplot with the variance of pca
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
23 suppressMessages(barplot(pov, main = title, names.arg = c(1:NROW(pov)), ylim = c(0,1), col = heat.colors(3)))
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
24
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
25
f3d9bb18110a Uploaded
mb2013
parents:
diff changeset
26 graphics.off()