Mercurial > repos > mb2013 > nepenthes_3dpca
diff Procrustes.R @ 11:064592f816c6 draft
Uploaded
author | mb2013 |
---|---|
date | Tue, 20 May 2014 03:27:28 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Procrustes.R Tue May 20 03:27:28 2014 -0400 @@ -0,0 +1,29 @@ +#Procrustes tool for performing procrustes analysis on landmark data +#MB + +#commandline arguments +args <- commandArgs(TRUE) +#input +input <- args[1] +nb_landmarks <- args[2] +nb_dimension <- 3 +output <- args[3] +outputcentroid <- args[4] + +#package geomorph +suppressMessages(library("geomorph")) + +#reading input file (landmark coordinates) +read <- read.csv(file <- input,header = FALSE) + +#creating good array with arrayspecs +new_array <- arrayspecs(read,as.integer(nb_landmarks),as.integer(nb_dimension)) + +#perform procrustes with gpagen +output_procrustes <- gpagen(A=new_array, ShowPlot= FALSE) +#turn array for PCA +output_procrustes_coo <- t(two.d.array(output_procrustes$coords)) +#output procrustes coordinates +write.csv(output_procrustes_coo,output, row.names = FALSE) +#output procrustes centroid size +write.csv(output_procrustes$Csize,outputcentroid, row.names = FALSE)