createMrBayesConstraints: Transform a Topology into a Set of Constraint Commands for...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/createMrBayesConstraints.R

Description

Takes a phylogeny in the form of an object of class phylo and outputs a set of topological constraints for MrBayes as a set of character strings, either printed in the R console or in a named text file, which can be used as commands in the MrBayes block of a NEXUS file for use with (you guessed it!) MrBayes.

Usage

1
2
createMrBayesConstraints(tree, partial = TRUE, file = NULL,
  includeIngroupConstraint = FALSE)

Arguments

tree

An object of class phylo.

partial

If TRUE (the default), then constraints will be defined as partial constraints with respect to the rest of the taxa in the input tree. If FALSE, constraints will be defined as hard clade membership constraints (i.e. no additional taxa will be allowed to belong to the nodes present in the observed tree. Depending on your analysis, partial = TRUE may require additionally defining an outgroup.

file

Filename (possibly with path) as a character string to a file which will be overwritten with the output constraint lines. If NULL, constraint lines are printed in the console.

includeIngroupConstraint

When writing the prset line, should a group named 'ingroup' be included, which presumes an ingroup constraint was defined by the user for sake or rooting the tree? This is mainly used for use with paleotree function createMrBayesTIpDatingNexus for automating the construction of tip-dating analyses, which must constrain the ingroup.

Details

partial = TRUE may be useful if the reason for using createMrBayesConstraints is to constrain a topology containing some of the taxa in an analysis, while allowing other taxa to freely vary. For example, Slater (2013) constrained an analysis so extant taxon relationships were held constant, using a molecular-based topology, while allowing fossil taxa to freely vary relative to their morphological character data.

Value

If argument file is NULL, then the constrain commands are output as a series of character strings.

Author(s)

David W. Bapst, with some inspiration from Graham Slater. This code was produced as part of a project funded by National Science Foundation grant EAR-1147537 to S. J. Carlson.

References

Slater, G. J. 2013. Phylogenetic evidence for a shift in the mode of mammalian body size evolution at the Cretaceous-Palaeogene boundary. Methods in Ecology and Evolution 4(8):734-744.

See Also

createMrBayesTipDatingNexus, createMrBayesTipCalibrations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(444)
tree<-rtree(10)
createMrBayesConstraints(tree)
createMrBayesConstraints(tree,partial=FALSE)

## Not run: 

createMrBayesConstraints(tree,file="topoConstraints.txt")


## End(Not run)

Example output

Loading required package: ape
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
 [1] "constraint node1 partial = t1 t6 : t5 t10 t9 t2 t8 t7 t3 t4;"                    
 [2] "constraint node2 partial = t5 t10 t9 t2 t8 t7 t3 t4 : t1 t6;"                    
 [3] "constraint node3 partial = t5 t10 : t1 t6 t9 t2 t8 t7 t3 t4;"                    
 [4] "constraint node4 partial = t9 t2 t8 t7 t3 t4 : t1 t6 t5 t10;"                    
 [5] "constraint node5 partial = t9 t2 : t1 t6 t5 t10 t8 t7 t3 t4;"                    
 [6] "constraint node6 partial = t8 t7 t3 t4 : t1 t6 t5 t10 t9 t2;"                    
 [7] "constraint node7 partial = t8 t7 : t1 t6 t5 t10 t9 t2 t3 t4;"                    
 [8] "constraint node8 partial = t3 t4 : t1 t6 t5 t10 t9 t2 t8 t7;"                    
 [9] ""                                                                                
[10] "prset topologypr = constraints(node1,node2,node3,node4,node5,node6,node7,node8);"
 [1] "constraint node1 = t1 t6;"                                                       
 [2] "constraint node2 = t5 t10 t9 t2 t8 t7 t3 t4;"                                    
 [3] "constraint node3 = t5 t10;"                                                      
 [4] "constraint node4 = t9 t2 t8 t7 t3 t4;"                                           
 [5] "constraint node5 = t9 t2;"                                                       
 [6] "constraint node6 = t8 t7 t3 t4;"                                                 
 [7] "constraint node7 = t8 t7;"                                                       
 [8] "constraint node8 = t3 t4;"                                                       
 [9] ""                                                                                
[10] "prset topologypr = constraints(node1,node2,node3,node4,node5,node6,node7,node8);"

paleotree documentation built on Nov. 17, 2017, 5:11 a.m.