comparison Csize_plot.R @ 5:f3b7f86db21e draft

Uploaded
author mb2013
date Tue, 20 May 2014 03:26:04 -0400
parents
children
comparison
equal deleted inserted replaced
4:22dfb371b509 5:f3b7f86db21e
1 #The Csize tool creates a plot with a Principal Component
2 #and the centroid size (created with a procrustes analysis)
3 #MB
4
5
6 #commandline arguments
7 args <- commandArgs(TRUE)
8
9 #inputs
10 input_PCA <- args[1]
11 input_Csize <- args[2]
12 main_title <- args[3]
13 x_title <- args[4]
14 y_title <- args[5]
15 x_column <- args[6]
16 names <- args [7] #sample names in one file
17 output <- args[8]
18
19 #library geomorph
20 suppressMessages(library("geomorph"))
21 #reading of the input files
22 read <- read.csv(file <- input_PCA, header = TRUE) #principal components
23 read2 <- read.csv(file <- input_Csize, header = TRUE) #centroid size
24 read3 <- scan(file <- names, what = "", quiet = TRUE)
25 pca1 <- read[,as.integer(x_column)] #principal component
26 read2 <- read2[,1] #centroid size
27
28 #output
29 png(output)
30
31 #creating plot with pca and centroid size
32 suppressMessages(plot(pca1,read2, main = main_title, xlab = x_title, ylab = y_title, pch=20,cex=0.6))
33 #adding labels to datapoints
34 text(pca1,read2,labels = read3, pos = 3, cex = 0.6, col = 'red')
35
36 graphics.off()