R/getSpanningTaxonPair.R

Defines functions getSpanningTaxonPair

#############################################################
#
#	getSpanningTaxonPair(....)
#
#	returns pair of taxa that span a given taxon set

getSpanningTaxonPair <- function(phy, taxset){
	
	if (! sum(taxset %in% phy$tip.label) > 0){
		cat('Some species in taxset that are not in tree\n');
		taxset <- taxset[taxset %in% phy$tip.label];
	}
	
	dt <- drop.tip(phy, setdiff(phy$tip.label, taxset));
	
	return(c(dt$tip.label[1], dt$tip.label[length(dt$tip.label)]));
}

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.