RE: [MORPHMET] Issues with subsetting nts array with classifiers and plotTangentSpace visualization

2018-01-05 Thread Murat Maga
Skip,
As a work around you can subset your own data. All the values you will need to 
do your own PCA scatter plot is in the
pseudoxy.PCA$pcscores.

That way, you get to do choose the coloring scheme and symbols.


From: Phillip Skipwith [mailto:pskipw...@gmail.com]
Sent: Friday, January 5, 2018 2:00 PM
To: MORPHMET 
Subject: [MORPHMET] Issues with subsetting nts array with classifiers and 
plotTangentSpace visualization

Hi,

I'm using Geomorph to analyze a 3D landmark dataset. I'm having a number of 
issues both in subsetting my array and visualizing these data after Procrustes 
analysis. I'm working with a set of 28 specimens and 61 3D landmarks. Below is 
a sample of my .dta file from Landmark Editor.


trial.coords <- readland.nts('pseudoxy_project3.dta')

1 28L 183 0 Dim=3

C_infralineatus_AMNH165799
D_quadralineatus_AMNH153343
D_quadralineatus_AMNH153345
D_quadralineatus_AMNH160061
..
-9.8451595e+000  -2.8541670e+000  -2.8408973e+000
-1.0106355e+001  -5.0837624e-001  -1.3406076e+000
-8.7275896e+000  -2.4869413e+000  -1.2266474e+000
-7.3323584e+000  -3.362e+000  -3.0307722e+000
..

I then make classifiers for later grouping and subsetting based on species 
(please see below). I can neither subset the data or properly visualize the 
resulting PCA plot. I get can error regarding the class of my array dimnames.  
Instead of a PCA plot of the designated axes organized by species, I get two 3D 
plots of PC1 (positive and negative loadings) with no labeling or legend. Below 
is some of my simple code. I'm new to Geomorph, so any help or advice would be 
greatly appreciated. If need be, I can send a reduced dataset to help with 
troubleshooting.


pseudoxy.gpa <- gpagen(trial.coords, ProcD = TRUE, Proj = TRUE, print.progress 
= TRUE)

# PCA
categories.qpa <- strsplit(dimnames(pseudoxy.gpa$coords)[[3]], "_")
# unlist into matrix format
classifiers.qpa <- matrix(unlist(categories.qpa), ncol=3, byrow=T)
# add the specimen ID to the first column of the table
classifiers.qpa <- cbind(dimnames(pseudoxy.gpa$coords)[[3]], classifiers.qpa)
# rename the column headings
colnames(classifiers.qpa) <- c("FullID", "Genus", "Species", "ID")
# converts to data frame so can index using $
classifiers.qpa <- as.data.frame(classifiers.qpa)

gp <- as.factor(paste(classifiers.qpa$Genus, classifiers.qpa$Species)) # create 
grouping variable
sub.gpa <- coords.subset(A = pseudoxy.gpa$coords, group = gp)
# I get the following error
Error in dimnames(specimens)[[3]] <- names : 'dimnames' must be a list #trying 
to coerce dimnames to a list does not help

pseudoxy.PCA <- plotTangentSpace(pseudoxy.gpa$coords, groups = gp, label = 
TRUE, legend = TRUE, axis1 = 1, axis2 = 2, warpgrids = TRUE)

# See attachment for confusing plot.

Thanks in advance,

Skip


--
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


RE: [MORPHMET] Issues with subsetting nts array with classifiers and plotTangentSpace visualization

2018-01-05 Thread Adams, Dean [EEOBS]
Skip,

It is difficult to troubleshoot this without seeing your full code and data 
file. If you send me those off-line I can try to take a look in the near future 
to identify what is going on.

Dean

Dr. Dean C. Adams
Professor
Department of Ecology, Evolution, and Organismal Biology
   Department of Statistics
Iowa State University
www.public.iastate.edu/~dcadams/
phone: 515-294-3834

From: Phillip Skipwith [mailto:pskipw...@gmail.com]
Sent: Friday, January 5, 2018 4:00 PM
To: MORPHMET 
Subject: [MORPHMET] Issues with subsetting nts array with classifiers and 
plotTangentSpace visualization

Hi,

I'm using Geomorph to analyze a 3D landmark dataset. I'm having a number of 
issues both in subsetting my array and visualizing these data after Procrustes 
analysis. I'm working with a set of 28 specimens and 61 3D landmarks. Below is 
a sample of my .dta file from Landmark Editor.


trial.coords <- readland.nts('pseudoxy_project3.dta')

1 28L 183 0 Dim=3

C_infralineatus_AMNH165799
D_quadralineatus_AMNH153343
D_quadralineatus_AMNH153345
D_quadralineatus_AMNH160061
..
-9.8451595e+000  -2.8541670e+000  -2.8408973e+000
-1.0106355e+001  -5.0837624e-001  -1.3406076e+000
-8.7275896e+000  -2.4869413e+000  -1.2266474e+000
-7.3323584e+000  -3.362e+000  -3.0307722e+000
..

I then make classifiers for later grouping and subsetting based on species 
(please see below). I can neither subset the data or properly visualize the 
resulting PCA plot. I get can error regarding the class of my array dimnames.  
Instead of a PCA plot of the designated axes organized by species, I get two 3D 
plots of PC1 (positive and negative loadings) with no labeling or legend. Below 
is some of my simple code. I'm new to Geomorph, so any help or advice would be 
greatly appreciated. If need be, I can send a reduced dataset to help with 
troubleshooting.


pseudoxy.gpa <- gpagen(trial.coords, ProcD = TRUE, Proj = TRUE, print.progress 
= TRUE)

# PCA
categories.qpa <- strsplit(dimnames(pseudoxy.gpa$coords)[[3]], "_")
# unlist into matrix format
classifiers.qpa <- matrix(unlist(categories.qpa), ncol=3, byrow=T)
# add the specimen ID to the first column of the table
classifiers.qpa <- cbind(dimnames(pseudoxy.gpa$coords)[[3]], classifiers.qpa)
# rename the column headings
colnames(classifiers.qpa) <- c("FullID", "Genus", "Species", "ID")
# converts to data frame so can index using $
classifiers.qpa <- as.data.frame(classifiers.qpa)

gp <- as.factor(paste(classifiers.qpa$Genus, classifiers.qpa$Species)) # create 
grouping variable
sub.gpa <- coords.subset(A = pseudoxy.gpa$coords, group = gp)
# I get the following error
Error in dimnames(specimens)[[3]] <- names : 'dimnames' must be a list #trying 
to coerce dimnames to a list does not help

pseudoxy.PCA <- plotTangentSpace(pseudoxy.gpa$coords, groups = gp, label = 
TRUE, legend = TRUE, axis1 = 1, axis2 = 2, warpgrids = TRUE)

# See attachment for confusing plot.

Thanks in advance,

Skip


--
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] Issue with digit.fixed on 3D mesh geomorph

2018-01-05 Thread Phillip Skipwith
Thanks Murat,

I actually switched to the Landmark Editor software, which is much easier 
to use.

On Wednesday, December 20, 2017 at 1:39:06 PM UTC-5, Murat Maga wrote:
>
> In my experience rgl tends to be slow with meshes with high number of 
> vertices. You may want to do your data collection outside of R using 
> programs optimized for handling high-resolution meshes, such as MeshLab or 
> 3D Slicer, save your coordinates as a text file and import them into R. 
>
>  
>
> M
>
>  
>
>  
>
> *From:* Phillip Skipwith [mailto:pski...@gmail.com ] 
> *Sent:* Friday, December 15, 2017 8:37 AM
> *To:* MORPHMET 
> *Subject:* [MORPHMET] Issue with digit.fixed on 3D mesh geomorph
>
>  
>
> Hi Everyone,
>
>  
>
> First: I apologize if this is a double posting.
>
>  
>
> I'm new to 3D geometric morphometrics, so this issue might turn out to be 
> a trivial one with an easy fix. At the moment I'm trying to place landmarks 
> on ply meshs (120 - 150k vertices) in geomorph using the digit.fixed 
> function. However, when I set a landmark on a vertex of interest, the point 
> does not attach to the correct spot. Rather, it vanishes somewhere deeper 
> in the mesh. Increasing ptsize to something well above 3 helps a little, 
> but not much. I realize that the help files use meshes below 30k vertices, 
> but I lose a lot of information when I go that low. Has anyone else had 
> this issue? Is it possible to select faces instead of vertices in geomorph 
> (seems unlikely)?
>
> I wondering if there was some special way of exporting ply files from 
> Meshlab that I'm missing. At the moment I simplify my high resolution mesh 
> with quadratic decimation, and then export the ASCII ply directly from 
> Meshlab without fiddling with the settings. Is this right?
>
>  
>
> Any help would be greatly appreciated.
>
>  
>
> Best,
>
>  
>
> Skip 
>
> -- 
> MORPHMET may be accessed via its webpage at http://www.morphometrics.org
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MORPHMET" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to morphmet+u...@morphometrics.org .
>

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.