R: Sample trees from an equiprobable labeled, semi-labeled or...
requiprobable
R Documentation
Sample trees from an equiprobable labeled, semi-labeled or unlabeled distribution
Description
An equiprobable distribution assumes that all tree topologies are equally likely. The degree of tip labeling affects the number of possible tree topologies.
In labeled trees all the tips are different, in unlabeled trees all the tips are the same and in semi-labeled trees the tips fall into groups in which any individual tip may or may not be the same as any other.
A character vector. The different labels for the tips of the trees.
label.counts
An integer vector of length length(labels). The number of tips using each label.
Details
To sample from labeled trees, use the default for label.counts, where every value is 1.
To sample from unlabeled trees use a labels of length 1 and set label.counts as a single integer equal to the number of tips in the tree.
To sample semilabeled trees label.counts should be the number of tips of the tree for each tip label from labels.
Value
If n=1, a tree of class “phylo”. Otherwise, multiple trees in a list of class “multiPhylo”.
Author(s)
Nathaniel Malachi Hallinan
References
For labeled trees:
G. Furnas, The generation of random, binary unordered trees, J. Classif.
1 (1984) 187-233.
For unlabeled trees:
L. Cavalli-Sforza, A. Edwards, Phylogenetic analysis: Models and esti-
mation procedures, Am. J. Hum. Genet. 19 (1967) 233-257.
For semi-labeled trees:
N. Hallinan. Null models for gene family trees, Math. Biosci. (In review).
See Also
plot.phylo, recon.score
Examples
##We are going to sample 10 labeled 10 unlabeled and 10 semi labeled 10 tip trees
labeled<-requiprobable(10,c("A1","A2","B1","B2","B3","C1","C2","C3","C4","C5"))
plot(labeled)
unlabeled<-requiprobable(10,"?",10)
plot(unlabeled)
##If you want to add tip labels to these trees
for (i in 1:10) unlabeled[[i]]$tip.label<-sample(c("A1","A2","B1","B2","B3","C1","C2","C3","C4","C5"))
semilabeled<-requiprobable(10,c("A","B","C"),c(2,3,5))
plot(semilabeled)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HyPhy)
Loading required package: ape
Loading required package: R.utils
Loading required package: R.oo
Loading required package: R.methodsS3
R.methodsS3 v1.7.1 (2016-02-15) successfully loaded. See ?R.methodsS3 for help.
R.oo v1.20.0 (2016-02-17) successfully loaded. See ?R.oo for help.
Attaching package: 'R.oo'
The following objects are masked from 'package:methods':
getClasses, getMethods
The following objects are masked from 'package:base':
attach, detach, gc, load, save
R.utils v2.3.0 (2016-04-13) successfully loaded. See ?R.utils for help.
Attaching package: 'R.utils'
The following object is masked from 'package:utils':
timestamp
The following objects are masked from 'package:base':
cat, commandArgs, getOption, inherits, isOpen, parse, warnings
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HyPhy/requiprobable.Rd_%03d_medium.png", width=480, height=480)
> ### Name: requiprobable
> ### Title: Sample trees from an equiprobable labeled, semi-labeled or
> ### unlabeled distribution
> ### Aliases: requiprobable
>
> ### ** Examples
>
> ##We are going to sample 10 labeled 10 unlabeled and 10 semi labeled 10 tip trees
> labeled<-requiprobable(10,c("A1","A2","B1","B2","B3","C1","C2","C3","C4","C5"))
> plot(labeled)
>
> unlabeled<-requiprobable(10,"?",10)
> plot(unlabeled)
> ##If you want to add tip labels to these trees
> for (i in 1:10) unlabeled[[i]]$tip.label<-sample(c("A1","A2","B1","B2","B3","C1","C2","C3","C4","C5"))
>
> semilabeled<-requiprobable(10,c("A","B","C"),c(2,3,5))
> plot(semilabeled)
>
>
>
>
>
> dev.off()
null device
1
>