Mercurial > repos > mb2013 > landtool
changeset 8:9524969cb0d3 draft
Uploaded
author | mb2013 |
---|---|
date | Wed, 20 Nov 2013 07:17:19 -0500 |
parents | 57b837f820e5 |
children | b9d127d6b00e |
files | Procrustes.R |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Procrustes.R Wed Nov 20 07:17:19 2013 -0500 @@ -0,0 +1,29 @@ +#Procrustes tool for performing procrustes analysis on landmark data +#developer: M.Baak + +#commandline arguments +args <- commandArgs(TRUE) +#input +input <- args[1] +nb_landmarks <- args[2] +nb_dimension <- args[3] +output <- args[4] +outputcentroid <- args[5] + +#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)