Roland-
It is because some of your tip labels are formatted in such a way that R
cannot find their match in the row.names of ages.

For example, you have Sinocodon_sp., which corresponds to the tip label:
"'''Sinoconodon_sp.'''" These extra quotation marks are what's getting in
your way and making it difficult for the line of data.phylo() which finds
the node ages, because R cannot find the right matches. Hence the error.

For example:
> "Sinocodon_sp."=="'Sinocodon_sp.'"
[1] FALSE

The extra quotation marks probably came from Mesquite or Treefig; I've found
that they like to add extra dashes sometimes when outputting trees, for some
reason. This caused me to have similar problems as you with other functions
being unable to match taxon names to my tip labels; my solution was to
replace all the taxon names on my trees with taxon ID numbers. (GRPT0001,
GRPT0002, etc.) Once you have done this, you will need to replace the taxon
names in the ages file too.

In the future, I'd recommend you try running the data.phylo() code itself in
Graeme's R file when you run into a problem with running the function
itself. That can help you quickly find which line of code the function is
snagging on. date.phylo() isn't a very lengthy function, thankfully.
-Dave


2011/7/29 Roland Sookias <r.sook...@gmail.com>

> Hi
>
> Having another problem with the same function now. What you suggested
> worked for one tree, but for the attached tree and file it didn't...
>
> I get:
>
> >  ttree<-date.phylo(tree, ages, rlen=10, method="equal")
> Error: subscript out of bounds
> > traceback()
> 1: date.phylo(tree, ages, rlen = 10, method = "equal")
>
>
>
> On Thu, Jul 21, 2011 at 5:12 PM, Klaus Schliep <klaus.schl...@gmail.com>
> wrote:
> > Hi Roland!
> > ages should be a matrix, with row names and the ages in the first column.
> >
> > On 7/21/11, Roland Sookias <r.sook...@gmail.com> wrote:
> >> Great! It worked. What format should the file be in then? I thought I'd
> >> followed the format specified.. Thanks very much indeed :)
> >>
> >> On Thu, Jul 21, 2011 at 4:10 PM, Klaus Schliep
> >> <klaus.schl...@gmail.com>wrote:
> >>
> >>> Hi Roland,
> >>>
> >>> as I suspected, your ages list was not in the right format (has
> >>> nothing to do with ape).
> >>> Try this:
> >>>
> >>> tmp = read.csv("agescut.csv", header=FALSE)
> >>> ages = matrix(tmp[, 2], ncol=1)
> >>> rownames(ages) = tmp[,1]
> >>> tree = read.tree("archotreeresolved6.tre")
> >>> ttree<-date.phylo(tree, ages, rlen=1, method="equal")
> >>>
> >>>
> >>> Regards,
> >>> Klaus
> >>>
> >>>
> >>>
> >>> On 7/21/11, Roland Sookias <r.sook...@gmail.com> wrote:
> >>> > Hi
> >>> >
> >>> > Thanks guys.
> >>> >
> >>> > Attached are the two files (will these work via the list?)
> >>> >
> >>> > When I type trackback() all I get is 1: date.phylo(archotreeresolved,
> >>> ages,
> >>> > rlen = 1, method = "equal").
> >>> >
> >>> > Roland
> >>> >
> >>> >
> >>> >
> >>> > On Thu, Jul 21, 2011 at 1:24 PM, Klaus Schliep
> >>> > <klaus.schl...@gmail.com>wrote:
> >>> >
> >>> >> Dear Roland,
> >>> >>
> >>> >> it would be good if you add the datasets, that one can reproduce
> your
> >>> >> results (archotreeresolved, ages). I would guess from the error
> >>> >> message that your ages list may has the wrong format.
> >>> >> Also traceback() sometimes tells you where the error happens
> exactly.
> >>> >>
> >>> >> Kind regards
> >>> >> Klaus
> >>> >>
> >>> >> On 7/21/11, Roland Sookias <r.sook...@gmail.com> wrote:
> >>> >> > Hi all
> >>> >> >
> >>> >> > I'm trying to assign lengths to branches in a tree using the Ruta
> et
> >>> al.
> >>> >> > 2008 method via Graeme Lloyd's date.phylo() function (see
> >>> >> > http://www.graemetlloyd.com/methdpf.html). I keep coming up
> against
> >>> an
> >>> >> error
> >>> >> > for some reason. Graeme himself does exactly the same thing
> seemingly
> >>> on
> >>> >> his
> >>> >> > Mac (I'm using Windows 7, R 2.13.1, Ape 2.7-2 - Graeme has Ape
> 2.7-1)
> >>> >> > and
> >>> >> it
> >>> >> > works. I've tried various permutations of the tree, with and
> without
> >>> >> > a
> >>> >> > rooted symbol [&r], and there are no special characters etc., the
> >>> names
> >>> >> in
> >>> >> > tree and ages list are the same. I still keep getting:
> >>> >> >
> >>> >> >  ttree<-date.phylo(archotreeresolved, ages, rlen=1,
> method="equal")
> >>> >> > Error in ages[tree$tip.label[find.descendants(nodes[i], tree)], 1]
> :
> >>> >> >   incorrect number of dimensions
> >>> >> >
> >>> >> > Any help, or advice what to try/look into much appreciated. Graeme
> >>> >> > thinks
> >>> >> > it's something with ape not date.phylo...
> >>> >> >
> >>> >> > Very best
> >>> >> >
> >>> >> > Roland
> >>> >> >
> >>> >> >       [[alternative HTML version deleted]]
> >>> >> >
> >>> >> > _______________________________________________
> >>> >> > R-sig-phylo mailing list
> >>> >> > R-sig-phylo@r-project.org
> >>> >> > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> >>> >> >
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Klaus Schliep
> >>> >> Université Paris 6 (Pierre et Marie Curie)
> >>> >> 9, Quai Saint-Bernard, 75005 Paris
> >>> >>
> >>> >
> >>>
> >>>
> >>> --
> >>> Klaus Schliep
> >>> Université Paris 6 (Pierre et Marie Curie)
> >>> 9, Quai Saint-Bernard, 75005 Paris
> >>>
> >>
> >
> >
> > --
> > Klaus Schliep
> > Université Paris 6 (Pierre et Marie Curie)
> > 9, Quai Saint-Bernard, 75005 Paris
> >
>
> _______________________________________________
> R-sig-phylo mailing list
> R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
>


-- 
David Bapst
Dept of Geophysical Sciences
University of Chicago
5734 S. Ellis
Chicago, IL 60637
http://home.uchicago.edu/~dwbapst/

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to