quart.scores: quart.scores

View source: R/quart.scores.R

quart.scoresR Documentation

quart.scores

Description

This function takes a list of trees and calcuates quartet scores among them, the output being a pairwise distance matrix.

Usage

quart.scores(trs)

Arguments

trs

A list of phylogenetic trees, each of class 'phylo'. The class of the list can be 'phylo' or 'multiPhylo'.

Details

The function uses the function get.locus.rates to identify the shared quartets, such that all trees should contain branch lengths.

Value

A pairwise distance matrix of class dist.

Author(s)

David Duchene

See Also

get.locus.rates

Examples

set.seed(12345)
myTrees <- lapply(1:20, function(x) rtree(20))
mytrQs <- quart.scores(myTrees)
mytrQs


## The function is currently defined as
function (trs)
{
    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.