View source: R/ParallelTableCpp.R
quartetTableParallel | R Documentation |
Compiles table of quartet count concordance factors (qcCFs) for topological quartets displayed on a
collection of trees. Gives the same output as quartetTable
, but operates in parallel.
quartetTableParallel(trees, taxonnames = NULL, epsilon = 0, numCores)
trees |
multiphylo object containing un/rooted metric/topological trees |
taxonnames |
vector of |
epsilon |
minimum for branch lengths to be treated as non-zero |
numCores |
number of cores to use for parallel calls |
The number of available cores can be determined by parallel::detectCores()
.
With overhead, tabulating quartets for a large data set (many taxa and/or many gene trees) on a 4-core
computer using numCores=4
may require less than half the elapsed time of the sequential quartetTable
.
The names in taxonnames
may be any subset of those on the trees.
Branch lengths of non-negative size less than or equal to epsilon
are treated as zero, giving polytomies.
In the returned table, columns are labeled by taxon names and quartet names ("12|34", etc.). 1s and 0s in taxon columns indicate the taxa in a quartet. Quartet 12|34 means the first and second indicated taxa form a cherry, 13|24 means the first and third form a cherry, 14|23 means the first and fourth form a cherry, and 1234 means the quartet is unresolved.
An error occurs if any branch length is negative.
Warnings are given if some of taxonnames
are missing on some trees, or
if some 4-taxon set is not on any tree.
If random
>0, then for efficiency random
should be much smaller then
the number of possible 4 taxon subsets.
If the quartet counts are to be used for NANUQ, or any other routines requiring resolved quartet counts,
quartetTableResolved
must be run following quartetTableParallel
. See example below.
an (n
choose 4)x(n
+4) matrix (or (random
)x(n
+4) matrix) encoding
4 taxon subsets of taxonnames
and counts of each of the
quartets 12|34, 13|24, 14|23, 1234 across the trees
quartetTable
, quartetTableResolved
, quartetTableDominant
, taxonNames
gtrees=read.tree(file=system.file("extdata","dataHeliconiusMartin",package="MSCquartets"))
QT=quartetTableParallel(gtrees,numCores=2)
RQT=quartetTableResolved(QT)
pTable=NANUQ(RQT,alpha=1e-40, beta=1e-30, outfile = file.path(tempdir(), "NANUQdist"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.