]> git.donarmstrong.com Git - ape.git/blob - R/me.R
current 2.1 release
[ape.git] / R / me.R
1 ## me.R (2007-07-12)
2
3 ##      Tree Estimation Based on Minimum Evolution Algorithm
4
5 ## Copyright 2007 Vincent Lefort
6
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
9
10 fastme.bal <- function(X, nni = TRUE)
11 {
12     if (is.matrix(X)) X <- as.dist(X)
13     N <- attr(X, "Size")
14     labels <- attr(X, "Labels")
15     if (is.null(labels)) labels <- as.character(1:N)
16     ans <- .C("me_b", as.double(X), as.integer(N), as.character(labels),
17               "", as.integer(nni), PACKAGE = "ape")
18     read.tree(text = ans[[4]])
19 }
20
21 fastme.ols <- function(X, nni = TRUE)
22 {
23     if (is.matrix(X)) X <- as.dist(X)
24     N <- attr(X, "Size")
25     labels <- attr(X, "Labels")
26     if (is.null(labels)) labels <- as.character(1:N)
27     ans <- .C("me_o", as.double(X), as.integer(N), as.character(labels),
28               "", as.integer(nni), PACKAGE = "ape")
29     read.tree(text = ans[[4]])
30 }
31
32 bionj <- function(X)
33 {
34     if (is.matrix(X)) X <- as.dist(X)
35     N <- attr(X, "Size")
36     labels <- attr(X, "Labels")
37     if (is.null(labels)) labels <- as.character(1:N)
38     ans <- .C("bionj", as.double(X), as.integer(N),
39               as.character(labels), "", PACKAGE = "ape")
40     read.tree(text = ans[[4]])
41 }