changeset 5:f3b7f86db21e draft

Uploaded
author mb2013
date Tue, 20 May 2014 03:26:04 -0400
parents 22dfb371b509
children 7012f7336e61
files Csize_plot.R
diffstat 1 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Csize_plot.R	Tue May 20 03:26:04 2014 -0400
@@ -0,0 +1,36 @@
+#The Csize tool creates a plot with a Principal Component 
+#and the centroid size (created with a procrustes analysis)
+#MB
+
+
+#commandline arguments
+args <- commandArgs(TRUE)
+
+#inputs
+input_PCA <- args[1]
+input_Csize <- args[2]
+main_title <- args[3]
+x_title <- args[4]
+y_title <- args[5]
+x_column <- args[6]
+names <- args [7] #sample names in one file
+output <- args[8]
+
+#library geomorph
+suppressMessages(library("geomorph"))
+#reading of the input files
+read <- read.csv(file <- input_PCA, header = TRUE) #principal components
+read2 <- read.csv(file <- input_Csize, header = TRUE) #centroid size
+read3 <- scan(file <- names, what = "", quiet = TRUE)
+pca1 <- read[,as.integer(x_column)] #principal component
+read2 <- read2[,1] #centroid size
+
+#output
+png(output)
+
+#creating plot with pca and centroid size
+suppressMessages(plot(pca1,read2, main = main_title, xlab = x_title, ylab = y_title, pch=20,cex=0.6))
+#adding labels to datapoints
+text(pca1,read2,labels = read3, pos = 3, cex = 0.6, col = 'red') 
+
+graphics.off()