R/as.phylo.bammdata.R

Defines functions as.phylo.bammdata

##' @export
as.phylo.bammdata <- function(x, ...) {
	
	if (!inherits(x, 'bammdata')) {
		stop("Object ephy must be of class bammdata\n");
	}		
	
	newphylo <- list();
	newphylo$edge <- x$edge;
	newphylo$Nnode <- x$Nnode;
	newphylo$tip.label <- x$tip.label;
	newphylo$edge.length <- x$edge.length;
	class(newphylo) <- 'phylo';
	attributes(newphylo)$order = attributes(x)$order;
	if (attributes(newphylo)$order != "cladewise") {
		newphylo <- reorder(newphylo);
	}
	return(newphylo);
}

Try the BAMMtools package in your browser

Any scripts or data that you put into this service are public.

BAMMtools documentation built on Sept. 13, 2024, 1:10 a.m.