--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/6667bdcd-7f75-4a79-aaf9-7ca900cfe251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Evan,This error can mean either a mismatch between the tip labels of you phylogeny and the row names for your data, or it can mean that you have missing taxa in one or the other. Often, an extra space at the end of taxon names causes this and is hard to see when comparing between the two.Mike
On Sep 28, 2017, at 12:18 PM, Evan Simons <evan.a...@gmail.com> wrote:
Hello All,I am attempting to perform a procD.pgls analysis, but I am getting this error message:>pgls <- procD.pgls(shape ~ range), phy = tree, data = gdf, iter =999, RRPP = TRUE)Error in x[phy$tip.label, ] : subscript out of boundsI think this is saying that the phylo tips are not matching the geomorph data frame. I tried uploading a TPS file with just genus and species names (separated by "_"), and phylogenetic analyses work just fine (e.g., plotGMPhyloMorphoSpace), but if I add any other variables to the same TPS file (also separated by "_" between each variable; the genus & species names remain the same in both files) , then they no longer work. I am using the strsplit(dimnames(crania)[[3]], "_" function to separate the variables in a classifiers data frame (as suggested here: https://github.com/geomorphR/geomorph/wiki/How-to-extract-classifiers-from-names-of-specimens) in order to make a geomorph data frame.Does anyone have any ideas on what I am doing wrong, or how to match the phylogeny to a TPS file with variables included?Thanks in advance for your help.-Evan--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
One possibility is that base-R does not like names of the latter format (though I cannot confirm this). More likely is that the names in the phylogeny (phy$tip.labels) do not match the rownames in the data matrix.
As Mike suggested this is likely a mismatch between taxa names on the phylogeny and those in the data frame. Unfortunately, we are simply not clairvoyant enough to know how to write code to account for all possible permutations of how users input their data and their phylogeny relative, and using what names. To see if you have some sort of mismatch try a simple:
match(rownames(data),phy$tip.labels)
If this shows anything other than a perfect 1:1 correspondence, then it is an input error. If there is a perfect 1:1 correspondence, then something else is amiss.
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: geomorph-...@googlegroups.com [mailto:geomorph-...@googlegroups.com]
On Behalf Of Evan Simons
Sent: Thursday, September 28, 2017 1:33 PM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: Re: [geomorph-r-package] Phylogenetic Analyses
Hello Mike,
Thanks for your quick reply! I guess I'm not understanding why it would work when there are only taxa names (e.g., if it's Macaca_mulatta it works fine, but if it's Macaca_mulatta_1_3.0456_4 it doesn't). When I try the file with just genus and species it works, but when the classifiers are copy/pasted onto the end of the genus and species I'm getting the error. The names remain the same and there are no spaces after the species names (only an "_"), so it seems that the names should still match. Any further thoughts would be greatly appreciated.
Thanks again,
Evan
On Thursday, September 28, 2017 at 11:09:41 AM UTC-7, Michael Collyer wrote:
Evan,
This error can mean either a mismatch between the tip labels of you phylogeny and the row names for your data, or it can mean that you have missing taxa in one or the other. Often, an extra space at the end of taxon names causes this and is hard to see when comparing between the two.
Mike
On Sep 28, 2017, at 12:18 PM, Evan Simons <evan.a...@gmail.com> wrote:
Hello All,
I am attempting to perform a procD.pgls analysis, but I am getting this error message:
>pgls <- procD.pgls(shape ~ range), phy = tree, data = gdf, iter =999, RRPP = TRUE)
Error in x[phy$tip.label, ] : subscript out of bounds
I think this is saying that the phylo tips are not matching the geomorph data frame. I tried uploading a TPS file with just genus and species names (separated by "_"), and phylogenetic analyses work just fine (e.g., plotGMPhyloMorphoSpace), but if I add any other variables to the same TPS file (also separated by "_" between each variable; the genus & species names remain the same in both files) , then they no longer work. I am using the strsplit(dimnames(crania)[[3]], "_" function to separate the variables in a classifiers data frame (as suggested here: https://github.com/geomorphR/geomorph/wiki/How-to-extract-classifiers-from-names-of-specimens) in order to make a geomorph data frame.
Does anyone have any ideas on what I am doing wrong, or how to match the phylogeny to a TPS file with variables included?
Thanks in advance for your help.
-Evan
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/6667bdcd-7f75-4a79-aaf9-7ca900cfe251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to
geomorph-...@googlegroups.com.
Visit this group at
https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/c9a198e2-e453-4c8b-91e2-e77eade88f90%40googlegroups.com.
Since this is an I/O error, the simplest solution is to change the names in the data matrix so that they match those in the phylogeny. This may be done either inside or outside of R.
This is often handled outside of R entirely, and in the environment where the datafiles were originally generated. In your case, changing the specimen names by hand in the NTS file to match how they are named in the phylogeny would be efficiently accomplished in a text editor (if I may guess the NTS has image names and these do not match the names in the phylogeny?).
In the future if one ensures a 1: correspondence of image/specimen names with the species names listed in the phylogeny, many downstream headaches can be avoided.
Best,
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: geomorph-...@googlegroups.com [mailto:geomorph-...@googlegroups.com]
On Behalf Of Evan Simons
Sent: Thursday, September 28, 2017 3:15 PM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: Re: [geomorph-r-package] Phylogenetic Analyses
Hello Dean,
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
geomorph-r-pack...@googlegroups.com.
To post to this group, send email to
geomorph-...@googlegroups.com.
Visit this group at
https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/eec0d338-de37-4125-a24c-a9bb40bbfe72%40googlegroups.com.
Hello,
I really appreciate your responses. I've been attempting to reenter (and reenter again) the names, copying them directly from the nexus file phylogeny, and I'm still running into the same problem. I'm hoping that if I provide more complete code (on a reduced version of the dataset, for ease), someone will be able to see where I am going astray.
When using a file with just genus and species, the procD.pgls works great:
library(geomorph)
> crania <- readland.nts(file.choose())
> categories <- strsplit(dimnames(crania)[[3]], "_")
> classifiers <- matrix(unlist(categories), ncol=2, byrow=T)
> classifiers <- cbind(dimnames(crania)[[3]], classifiers)
> colnames(classifiers) <- c("fileID", "Genus", "Species")
> classifiers <- as.data.frame(classifiers)
> classifiers
fileID Genus Species
1 Allenopithecus_nigroviridis Allenopithecus nigroviridis
2 Cercocebus_galeritus Cercocebus galeritus
3 Cercocebus_torquatus Cercocebus torquatus
4 Cercopithecus_ascanius Cercopithecus ascanius
> Y.gpa<-gpagen(crania)
> tree <- read.nexus(file.choose())
> tree
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
[1] "Allenopithecus_nigroviridis" "Cercopithecus_ascanius"
[3] "Cercocebus_galeritus" "Cercocebus_torquatus"
Rooted; includes branch lengths.
> gdf <- geomorph.data.frame(Y.gpa, classifiers, phy = tree)
> cat.pgls <- procD.pgls(coords ~ Csize, phy = phy, data = gdf, iter = 999, RRPP = TRUE)
Sums of Squares calculations: 1000 permutations.
> summary(cat.pgls)
Call:
procD.pgls(f1 = coords ~ Csize, phy = phy, iter = 999, RRPP = TRUE, data = gdf)
Type I (Sequential) Sums of Squares and Cross-products
Randomized Residual Permutation Procedure Used
1000 Permutations
ANOVA effect sizes and P-values based on empirical F distributions
Df SS MS Rsq F Z Pr(>F)
Csize 1 0.00033504 0.00033504 0.48429 1.8782 0.97528 0.2415
Residuals 2 0.00035677 0.00017839
Total 3 0.00069181
However, if I use that same file, but just add _3 (etc.) onto the end of it, without changing anything else, it no longer works.
> crania <- readland.nts(file.choose())
> categories <- strsplit(dimnames(crania)[[3]], "_")
> classifiers <- matrix(unlist(categories), ncol=3, byrow=T)
> classifiers <- cbind(dimnames(crania)[[3]], classifiers)
> colnames(classifiers) <- c("fileID", "Genus", "Species", "Age")
> classifiers <- as.data.frame(classifiers)
> classifiers
fileID Genus Species Age
1 Allenopithecus_nigroviridis_1 Allenopithecus nigroviridis 1
2 Cercocebus_galeritus_2 Cercocebus galeritus 2
3 Cercocebus_torquatus_4 Cercocebus torquatus 4
4 Cercopithecus_ascanius_3 Cercopithecus ascanius 3
> Y.gpa<-gpagen(crania)
> tree <- read.nexus(file.choose())
> tree
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
[1] "Allenopithecus_nigroviridis" "Cercopithecus_ascanius"
[3] "Cercocebus_galeritus" "Cercocebus_torquatus"
Rooted; includes branch lengths.
> gdf <- geomorph.data.frame(Y.gpa, classifiers, phy = tree)
> cat.pgls <- procD.pgls(coords ~ Csize, phy = phy, data = gdf, iter = 999, RRPP = TRUE)
Error in Pcor[rownames(Y), rownames(Y)] : subscript out of bounds
This is what I’ve been trying to explain. The names in both the phylogeny and the data matrix must match exactly. When you add ‘_3’ to the data matrix names, they are now not the same as in the phylogeny. It will never work because the 2 cannot be made to match.
It is also not obvious why one must add something to the names to begin with. If these are some sort of independent (X) variables, they may be used in the data matrix for quantitative analysis. Adding them to the names will not change the analysis at all; other than, in this case, causing it not to run.
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: geomorph-...@googlegroups.com [mailto:geomorph-...@googlegroups.com]
On Behalf Of Evan Simons
Sent: Friday, September 29, 2017 11:37 AM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: Re: [geomorph-r-package] Phylogenetic Analyses
Hello,
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
geomorph-r-pack...@googlegroups.com.
To post to this group, send email to
geomorph-...@googlegroups.com.
Visit this group at
https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/c2302484-4e8e-41c8-a899-e3ba89e17b7e%40googlegroups.com.