Skip to content

Commit 1fc32e7

Browse files
committed
remove phangorn dependency and add upgma
1 parent 83715cd commit 1fc32e7

File tree

7 files changed

+63
-9
lines changed

7 files changed

+63
-9
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Imports:
4646
utils,
4747
vegan,
4848
ggplot2,
49-
phangorn,
5049
ape (>= 3.1-1),
5150
igraph (>= 1.0.0),
5251
methods,

NAMESPACE

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export(rrmlg)
9999
export(samp.ia)
100100
export(shufflepop)
101101
export(test_replen)
102+
export(upgma)
102103
export(visible)
103104
export(win.ia)
104105
exportClasses(MLG)
@@ -123,6 +124,8 @@ importFrom(ade4,is.euclid)
123124
importFrom(ade4,lingoes)
124125
importFrom(ade4,quasieuclid)
125126
importFrom(ape,add.scale.bar)
127+
importFrom(ape,as.phylo)
128+
importFrom(ape,as.phylo.hclust)
126129
importFrom(ape,axisPhylo)
127130
importFrom(ape,boot.phylo)
128131
importFrom(ape,is.ultrametric)
@@ -172,8 +175,6 @@ importFrom(igraph,print.igraph)
172175
importFrom(magrittr,"%>%")
173176
importFrom(pegas,as.loci)
174177
importFrom(pegas,loci2genind)
175-
importFrom(phangorn,midpoint)
176-
importFrom(phangorn,upgma)
177178
importFrom(polysat,Genotypes)
178179
importFrom(polysat,Missing)
179180
importFrom(polysat,Ploidies)
@@ -185,6 +186,7 @@ importFrom(stats,as.formula)
185186
importFrom(stats,dbinom)
186187
importFrom(stats,df)
187188
importFrom(stats,dist)
189+
importFrom(stats,hclust)
188190
importFrom(stats,median)
189191
importFrom(stats,printCoefmat)
190192
importFrom(stats,quantile)

R/bruvo.r

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ bruvo.between <- function(query, ref, replen = 1, add = TRUE, loss = TRUE, by_lo
297297
#' desired.
298298
#'
299299
#' @param tree any function that can generate a tree from a distance matrix.
300-
#' Default is \code{\link[phangorn]{upgma}}.
300+
#' Default is \code{\link{upgma}}.
301301
#'
302302
#' @param showtree \code{logical} if \code{TRUE}, a tree will be plotted with
303303
#' nodelabels.
@@ -331,7 +331,7 @@ bruvo.between <- function(query, ref, replen = 1, add = TRUE, loss = TRUE, by_lo
331331
#' replacement, recalculate the tree, and tally up the bootstrap support
332332
#' (measured in percent success). While this function can take any tree
333333
#' function, it has native support for two algorithms: \code{\link[ape]{nj}}
334-
#' and \code{\link[phangorn]{upgma}}. If you want to use any other functions,
334+
#' and \code{\link{upgma}}. If you want to use any other functions,
335335
#' you must load the package before you use them (see examples).
336336
#'
337337
#' @note \strong{Please refer to the documentation for bruvo.dist for details on
@@ -383,7 +383,6 @@ bruvo.between <- function(query, ref, replen = 1, add = TRUE, loss = TRUE, by_lo
383383
#' }
384384
#'
385385
#==============================================================================#
386-
#' @importFrom phangorn upgma midpoint
387386
#' @importFrom ape nodelabels nj boot.phylo plot.phylo axisPhylo ladderize
388387
#' @importFrom ape add.scale.bar nodelabels tiplabels is.ultrametric
389388
# / \

R/upgma.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#' UPGMA
2+
#'
3+
#' UPGMA clustering. Just a wrapper function around \code{\link[stats]{hclust}}.
4+
#'
5+
#' @param d A distance matrix.
6+
#' @return A phylogenetic tree of class \code{phylo}.
7+
#' @author Klaus Schliep \email{klaus.schliep@@gmail.com}
8+
#' @seealso \code{\link{hclust}}, \code{\link{as.phylo}}
9+
#' @importFrom ape as.phylo.hclust as.phylo
10+
#' @importFrom stats hclust as.dist
11+
#' @keywords cluster
12+
#' @examples
13+
#'
14+
#' library(ape)
15+
#' data(woodmouse)
16+
#' dm <- dist.dna(woodmouse)
17+
#' tree <- upgma(dm)
18+
#' plot(tree)
19+
#'
20+
#' @rdname upgma
21+
#' @export
22+
"upgma" <- function(d) as.phylo(hclust(as.dist(d), method = "average"))

man/bruvo.boot.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/upgma.Rd

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/mlg.Rmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ them as different. If we calculate the pairwise euclidean distances between
197197
samples, we see that "new", "mut" and, "C" are very similar to each other:
198198

199199
```{r, fig.width = 5, fig.height = 5}
200-
library("phangorn")
201200
library("ape")
202201
raw_dist <- function(x){
203202
dist(genind2df(x, usepop = FALSE))

0 commit comments

Comments
 (0)