Title: | Generate Starting Trees For Combined Molecular, Morphological and Stratigraphic Data |
---|---|
Description: | Combine a list of taxa with a phylogeny to generate a starting tree for use in total evidence dating analyses. |
Authors: | April Wright [aut, cre] |
Maintainer: | April Wright <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-08-29 23:00:53 UTC |
Source: | https://github.com/ropensci/treestartr |
Add tips not on existing tree to the tree via user input, if they do not have congeners on the tree. This function will generate a tree, with nodes numbered. For each tip to be added, the user will be asked #' to enter the number of the node they would like the tip to subtend.
absent_tippr(tree, absent_list)
absent_tippr(tree, absent_list)
tree |
Starting tree; object of type phylo |
absent_list |
Vector of taxa in the total dataset that are not on the tree |
tree Phylo object containing the starting tree, and all tips that were added.
## Not run: new <- absent_tippr(tree, absent_list)
## Not run: new <- absent_tippr(tree, absent_list)
A dataset containing 18 taxa and 62 characters for bears
data(bears)
data(bears)
A collection of objects representing function inputs:
a two-column dataframe of taxon names and ages
A list of taxa in the total data set, but are not on the tree
a two-column dataframe of taxa to be placed, and a set of taxa that indicate the MRCA which they will subtend
A phylogenetic tree to which tips will be added
https://github.com/revbayes/revbayes_tutorial/tree/master/RB_TotalEvidenceDating_FBD_Tutorial/data
Detect file format of the total taxon list (molecular, morphological, and stratigraphic) and maximum age of fossil, see RevBayes total -evidence fossil file for an example of this.
dataf_parsr(dataf)
dataf_parsr(dataf)
dataf |
A data frame with one column containing the taxon name of tips in phylogenetic tree. Optionally, a second column can indicate the maximum age of the tip. If the tip is extant, use 0.0 as the age. Can be CSV or TSV. |
tax_frame Dataframe containing the total set of tips on the tree
## Not run: tax_frame <- dataf_parsr(dataf)
## Not run: tax_frame <- dataf_parsr(dataf)
Once a tip has been added to the tree, print the subtree to which the tip was added. The output of this function is printed for use as a RevBayes clade constraint object.
echo_rb(tree, mrca_list, tip)
echo_rb(tree, mrca_list, tip)
tree |
Tree to which the tip will be added; object of type phylo |
mrca_list |
Vector of taxa. The added tip will subtend the MRCA of these taxa |
tip |
Taxon which will be added to the tree. |
vector A comma-separated list of all the taxa in the subtree to which the tip was added.
mrca_list <- c("Ursus_arctos", "Ursus_spelaeus", "Ursus_americanus") clade_constraint <- echo_rb(tree, mrca_list, "Ursus_abstrusus")
mrca_list <- c("Ursus_arctos", "Ursus_spelaeus", "Ursus_americanus") clade_constraint <- echo_rb(tree, mrca_list, "Ursus_abstrusus")
Once a tip has been added to the tree, print the newick-formatted subtree to which the tip was added.
echo_subtree(tree, mrca_list, tip)
echo_subtree(tree, mrca_list, tip)
tree |
Tree to which the tip will be added; object of type phylo |
mrca_list |
Vector of taxa. The added tip will subtend the MRCA of these taxa |
tip |
Taxon which will be added to the tree. |
tree subtree to which tip was added
mrca_list <- c("Ursus_arctos", "Ursus_spelaeus", "Ursus_americanus") tree <- text_placr(tree, mrca_df) echo_sub <- echo_subtree(tree, mrca_list, "Ursus_abstrusus")
mrca_list <- c("Ursus_arctos", "Ursus_spelaeus", "Ursus_americanus") tree <- text_placr(tree, mrca_df) echo_sub <- echo_subtree(tree, mrca_list, "Ursus_abstrusus")
Utility function to check if file is a csv or tsv.
fileformat(dataf)
fileformat(dataf)
dataf |
Path to input file |
None
Test which taxa in the total set of taxa are present on the tree, and which need to be added. The tax_frame object is assumed to be a dataframe, minimally with a column labeled "taxon". If this column does not exist, the first column in the dataframe will be assumed to contain the taxon information.
genera_strippr(tree, tax_frame)
genera_strippr(tree, tax_frame)
tree |
Starting phylogeny, of type phylo |
tax_frame |
Total set of taxa on tree, as dataframe. |
absent_list of taxa that are present in the total set of trees, but not the starting tree
absent_taxa <- genera_strippr(tree, tax_frame = tax_frame)
absent_taxa <- genera_strippr(tree, tax_frame = tax_frame)
Determine which tips that are not on the tree, and checks if they have congeners on the tree.
get_found(absent_list, tree)
get_found(absent_list, tree)
absent_list |
Vector of taxa in the total dataset that are not on the tree |
tree |
Starting tree; object of type phylo |
found_df Dataframe objects expressing the tips that are not on the tree, if they have congeners on the tree
has_congeners <- treestartr:::get_found(absent_list, tree)
has_congeners <- treestartr:::get_found(absent_list, tree)
Determine which tips that are not on the tree, puts them in a dataframe if they do not have congeners on the tree
get_lost(absent_list, tree)
get_lost(absent_list, tree)
absent_list |
Vector of taxa in the total dataset that are not on the tree |
tree |
Starting tree; object of type phylo |
not_found_df Dataframe objects expressing the tips that are not on the tree, and don"t have congeners
no_congeners <- treestartr:::get_lost(absent_list, tree)
no_congeners <- treestartr:::get_lost(absent_list, tree)
Determine which tips are not on the tree, and get their genera.
make_absentdf(absent_list)
make_absentdf(absent_list)
absent_list |
Vector of taxa in the total dataset that are not on the tree |
absent_df Dataframe objects expressing which tips are in the total set but not the tree, and their genera
not_present <- treestartr:::make_absentdf(absent_list)
not_present <- treestartr:::make_absentdf(absent_list)
Determine which tips are on the tree, and get their genera.
make_treedf(tree)
make_treedf(tree)
tree |
Starting tree; object of type phylo |
tree_df Dataframe objects expressing the tips, and their genera
Add tips not on existing tree to the tree via an MRCA node, if they have congeners. This function will look to see if any tips on the tree have the same genus as the tip to be added. If there are multiple members of the genus, the tip will be added subtending the MRCA of all present congeners. If there is member of the genus, the tip will be added subtending the parent node of the congener.
present_tippr(tree, absent_list, echo_subtrees = NULL, echo_revbayes = NULL)
present_tippr(tree, absent_list, echo_subtrees = NULL, echo_revbayes = NULL)
tree |
Starting tree; object of type phylo |
absent_list |
Vector of taxa in the total dataset that are not on the tree |
echo_subtrees |
Boolean; Print newick subtree with missing taxa added to screen. Default FALSE. |
echo_revbayes |
Boolean; Print clade constraints with missing taxa added to screen, formatted for RevBayes fossilized birth-death analysis. Default FALSE. |
tree. Phylo object containing the starting tree, and all tips that were added.
genera_tree <- present_tippr(tree, absent_list)
genera_tree <- present_tippr(tree, absent_list)
Add tips not on existing tree to the tree at random, if they do not have congeners on the tree.
rand_absent_tippr(tree, absent_list, echo_subtrees = NULL, echo_revbayes = NULL)
rand_absent_tippr(tree, absent_list, echo_subtrees = NULL, echo_revbayes = NULL)
tree |
Starting tree; object of type phylo |
absent_list |
Vector of taxa in the total dataset that are not on the tree |
echo_subtrees |
Boolean; Print newick subtree with missing taxa added to screen. Default FALSE. |
echo_revbayes |
Boolean; Print clade constraints with missing taxa added to screen, formatted for RevBayes fossilized birth-death analysis. Default FALSE. |
tree Phylo object containing the starting tree, and all tips that were added.
new_tree <- rand_absent_tippr(tree, absent_list)
new_tree <- rand_absent_tippr(tree, absent_list)
Utility function to check taxon_names in parsed data file
taxon_testr(tax_frame)
taxon_testr(tax_frame)
tax_frame |
Dataframe of taxa parsed from datafile. |
None
Add tips according to csv or tsv file of taxon names and taxa that form the clade into which you"d like to insert the tip. One column should be called 'taxon', and should contain the taxon to be placed. The other column should be called 'clade' and contain the taxon with which the taxon to be placed will form a group. Each member of the clade will be placed on its own line. An example of this file can be seen in 'inst/extdat a/mrca_df.tsv'
text_placr(tree, mrca_df, echo_subtrees = NULL, echo_revbayes = NULL)
text_placr(tree, mrca_df, echo_subtrees = NULL, echo_revbayes = NULL)
tree |
Starting tree; object of type phylo |
mrca_df |
Dataframe containing a column of the taxa you'd like to place and one column with the clade into which you'd like to place it |
echo_subtrees |
Boolean; Print newick subtree with missing taxa added to screen. Default FALSE. |
echo_revbayes |
Boolean; Print clade constraints with missing taxa added to screen, formatted for RevBayes fossilized birth-death analysis. Default FALSE. |
tree Phylo object containing the starting tree, and all tips that were added.
text_placr(tree, mrca_df)
text_placr(tree, mrca_df)
treestartr provides multiple ways to add tips to a starting tree
absent_tippr, echo_rb, echo_subtree, present_tippr, rand_absent_tippr, text_placr