Mercurial > repos > mb2013 > landtool
comparison plotPCACsize.R @ 0:fe08e72740fe draft
Uploaded
author | mb2013 |
---|---|
date | Wed, 20 Nov 2013 05:27:55 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:fe08e72740fe |
---|---|
1 #The plotPCACsize tool creates a plot with a principle component and the centroid size created with procrustes analysis | |
2 #developer: M.Baak | |
3 #commandline arguments | |
4 args <- commandArgs(TRUE) | |
5 | |
6 #inputs | |
7 input_PCA <- args[1] | |
8 input_Csize <- args[2] | |
9 main_title <- args[3] | |
10 x_title <- args[4] | |
11 y_title <- args[5] | |
12 x_column <- args[6] | |
13 names <- args [7] #sample names in one file | |
14 output <- args[8] | |
15 | |
16 #library geomorph | |
17 suppressMessages(library("geomorph")) | |
18 #reading of the input files | |
19 read <- read.csv(file <- input_PCA, header = TRUE) #principle components | |
20 read2 <- read.csv(file <- input_Csize, header = TRUE) #centroid size | |
21 read3 <- scan(file <- names, what = "", quiet = TRUE) | |
22 pca1 <- read[,as.integer(x_column)] #principle component | |
23 read2 <- read2[,1] #centroid size | |
24 | |
25 #output | |
26 png(output) | |
27 | |
28 #creating plot with pca and centroid size | |
29 suppressMessages(plot(pca1,read2, main = main_title, xlab = x_title, ylab = y_title, pch=20,cex=0.6)) | |
30 #adding labels to datapoints | |
31 text(pca1,read2,labels = read3, pos = 3, cex = 0.6, col = 'red') | |
32 | |
33 graphics.off() |