Skip to content

Commit

Permalink
finished one tip bind fun
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbapst committed May 30, 2019
1 parent 4d6579d commit 71eb619
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions R/merging_trees_with_MRP.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ merging_trees_with_MRP <- function(

##########################
# add an artificial outgroup to both trees

new_tip_label = "placeholder_artificial_outgroup"

# this also removes any edge lengths
tree_backbone <- add_single_taxon_to_tree(tree = tree_backbone,
new_tip_label = "placeholder_artificial_outgroup")
tree_secondary <- add_single_taxon_to_tree(tree = tree_secondary,
new_tip_label = "placeholder_artificial_outgroup")



add_single_taxon_to_tree <- function(tree,
nodeID = Ntip(tree) + 1,
new_tip_label){
new_tip_label,
# default location to add tip is the root
nodeID = Ntip(tree) + 1
){
###############################
# currently only handles trees without branch lengths
# in fact the branch lengths will be removed from the input tree
Expand All @@ -38,11 +43,13 @@ merging_trees_with_MRP <- function(
class(one_tip_tree)<-"phylo"
#
tree <- bind.tree(

x = tree,
y = one_tip_tree,
where = nodeID
)
return(tree)
}

tree_backbone <- bind.tree(tree_backbone, outgroup)
tree_secondary <- bind.tree(tree_secondary, outgroup)



Expand Down

0 comments on commit 71eb619

Please sign in to comment.