collect.clocks: collect.clocks

View source: R/collect.clocks.R

collect.clocksR Documentation

collect.clocks

Description

collect.clocks takes locus trees with branch lengths in substitutions per site and a species tree topology. It collects the lengths of quartet branches in locus trees that are present in the species tree.

Usage

collect.clocks(loctrs, sptr, sp.time.tree = T, branch.support.threshold = 0, branch.length.threshold = 5e-6, verbose = T)

Arguments

loctrs

A list of trees of class 'multiPhylo'

sptr

A phylogenetic tree of class 'phylo'.

make.plot

A logical (T/F) indicating whether the function should make a plot summarising the branch lengths data collected (this option has not been finished).

branch.support.threshold

A numeric indicating the branch support below which branches in locus tree should be considered as absent, even if present in the species tree topology.

Details

The function plots...

Value

A list with two items:

raw.rates.matrix

A matrix of each of the loci (rows) including the lengths of branches present in the species tree (columns). The matrix might include missing data as NAs in cases where brnaches of the species tree are absent in the locus tree.

N.loci.per.branch

A vector with the number of loci that contained each of the brnaches of the species tree.

Note

Please see the references for more detailed information.

Author(s)

David Duchene

References

To be added.

See Also

Pending.

Examples

set.seed(12345)
myTree <- rtree(10)

par(mfrow = c(1, 2))
plot(myTree)
nde <- pathnode(myTree)
nde



## The function is currently defined as
function (phylo, tipsonly = T) 
{
    require(phangorn)
    di.tr <- dist.nodes(phylo)
    root.tr <- phylo$edge[, 1][!(phylo$edge[, 1] %in% phylo$edge[, 
        2])][1]
    tr.depth <- max(di.tr[as.numeric(colnames(di.tr)) == root.tr, 
        ])
    if (tipsonly == TRUE) {
        roottotippath <- di.tr[as.numeric(rownames(di.tr)) == 
            root.tr, 1:length(phylo$tip.label)]
        nodesinpath <- sapply(1:length(phylo$tip.label), function(x) length(Ancestors(phylo, 
            x)))
    }
    else {
        roottotippath <- di.tr[as.numeric(rownames(di.tr)) == 
            root.tr, ]
	nodesinpath <- sapply(1:(length(phylo$tip.label)+phylo$Nnode), function(x) length(Ancestors(phylo, x)))
    }
    plot(roottotippath, nodesinpath, xlab = "Root-to-tip path length", 
        ylab = "Number of parent nodes", pch = 20)
    return(list(roottotippath = roottotippath, nodesinpath = nodesinpath))
  }

duchene/ClockstaRX documentation built on Oct. 22, 2023, 10:51 a.m.