R/quart.scores.R

Defines functions quart.scores

Documented in quart.scores

quart.scores <- function(trs){
	     # All branches require a length (even if a dummy, e.g. 1).
	     qscores <- matrix(NA, length(trs), length(trs))
	     nedges <- sapply(trs, Nedge)
	     for(i in 1:length(trs)){
	     	   for(j in i:length(trs)){
		   	 trstemp <- trs[c(i,j)][order(nedges[c(i,j)])]
			 brsavail <- get.locus.rates(trstemp[[1]], sptr = trstemp[[2]], branch.support.threshold = 0, branch.length.threshold = 0)
			 if(all(is.na(brsavail))) qscores[j,i] <- 0 else qscores[j,i] <- sum(!is.na(brsavail)) / min(nedges[c(i,j)])
		   }
	     }
	     qscores <- as.dist(qscores)
	     return(qscores)
}
duchene/ClockstaRX documentation built on Oct. 22, 2023, 10:51 a.m.