R/getStartStopTimes.R

Defines functions getStartStopTimes

#############################################################
#
#	getStartStopTimes(....)
#
#	adds begin and end times (absolute time) to each edge of 
#	phylogenetic tree

getStartStopTimes <- function(phy){
 	if (is.ultrametric(phy)) {
	 	bmax <- max(branching.times(phy));
		bt <- bmax - branching.times(phy);
		begin <- bt[as.character(phy$edge[,1])];
		end <- begin + phy$edge.length;
		phy$begin <- as.numeric(begin);
		phy$end <- as.numeric(end);
		return(phy);
	}
	return( NU.branching.times(phy, "begin.end"));
}

Try the BAMMtools package in your browser

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

BAMMtools documentation built on July 16, 2022, 1:05 a.m.