File: treePop.R

package info (click to toggle)
r-cran-ape 5.8-1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,676 kB
  • sloc: ansic: 7,676; cpp: 116; sh: 17; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## treePop.R (2011-10-11)

##   Tree Popping

## Copyright 2011 Andrei-Alin Popescu

## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.

treePop <- function(obj)
{
    mf <- obj$matsplit
    labels <- obj$labels
    n <- length(labels)
    imf <- as.integer(mf)
    freq <- obj$freq
    mimf <- matrix(imf, nrow(mf), ncol(mf))
    ans <- .C(C_treePop, mimf, as.double(freq), as.integer(ncol(mf)),
              as.integer(n), integer(2*n - 3), integer(2*n - 3),
              double(2*n - 3), NAOK = TRUE)
    obj <- list(edge = cbind(ans[[5]], ans[[6]]), edge.length = ans[[7]],
                tip.label = labels, Nnode = n - 2L)
    class(obj) <- "phylo"
    reorder(obj)
}