[Phylobase-devl] nTips method defined where?

Ben Bolker bolker at zoology.ufl.edu
Wed May 21 21:20:17 CEST 2008


   It's in methods-phylo4.R.  There have been some
issues in the past with conflicts between an "nTips"
function in ape and the one in phylo4, but I don't think
that's what's going on here.

Our current definition for phylo4 objects is

setMethod("nTips", "phylo4", function(x, ...) {
     E <- edges(x)
     res <- sum(!E[, 2] %in% E[, 1])
     return(res)
})

   which, in words, is "number of nodes in column 2 that do
not appear in column 1".  To be honest, I don't remember
how we came up with this.  It would seem like "number
of nodes of (out)degree 0" would be a better definition --
i.e., something using the same tabulate() idiom
that you've seen already -- although
I'm having a hard time at the moment thinking of the
circumstances under which they would differ.

   What does your edge matrix look like?  Can you see
why it would be different?  Does it violate any of
the ape rules quoted earlier?

   Ben




   It's really nice to have someone else hacking on the code,
to flush out stuff like this!

Aaron Mackey wrote:
> When reading a nexml-formatted tree with reticulated nodes (i.e. a network),
> I'm getting an error while constructing the phylo4 tree that the number of
> tips doesn't match the number of tip labels.  This is stemming from
> check_phylo4, which checks that nTips(object) is equal to length(tip.label)
> -- but I can't find the code for nTips (here is a snippet of my debugging
> session within check_phylo4; there are only 5 tips, but nTips reports 6):
> 
> Browse[1]> nTips(object)
> [1] 6
> Browse[1]> object at tip.label
> [1] "Homo sapiens" "t3"           "t2"           "t5"
> "t4"
> Browse[1]> getMethod("nTips", where=object)
> Method Definition:
> 
> function (x, ...)
> {
>     .local <- function (x)
>     {
>         if (class(x) == "phylo") {
>             Ntip(x)
>         }
>         else stop(paste("no 'nTips' method available for",
> deparse(substitute(x)),
>             "(class", class(x), ")"))
>     }
>     .local(x, ...)
> }
> <environment: 0x861e04c>
> 
> Signatures:
>         x
> target  "ANY"
> defined "ANY"
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Phylobase-devl mailing list
> Phylobase-devl at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20080521/acae7e05/attachment-0001.pgp 


More information about the Phylobase-devl mailing list