move.lineage: Move tips or clades

View source: R/move.lineage.R

move.lineageR Documentation

Move tips or clades

Description

Move a single tip or an entire clade to a different position within the tree.

Usage

move.lineage(tree,focal,sister,rescale=TRUE,rootage=NULL)

Arguments

tree

a phylogenetic tree. The tree needs not to be ultrametric and fully dichotomous.

focal

the lineage to be moved. It can be either a tip name/number or a node number. If tree$node.label is not NULL, a focal clade can be indicated as "Clade NAMEOFTHECLADE" when appropriate. Similarly, an entire genus can be indicated as "Genus NAMEOFTHEGENUS" (see examples below).

sister

the sister tip/node where the focal must be attached. It can be tip name/number or node number. If tree$node.label is not NULL, a focal clade can be indicated as "Clade NAMEOFTHECLADE" when appropriate. Similarly, an entire genus can be indicated as "Genus NAMEOFTHEGENUS" (see examples below).

rescale

logical. If the most recent common ancestor of the focal clade is older than its new ancestor (i.e. the node right above sister), the user can choose whether the height of the focal clade must be rescaled on the height of the new ancestor (rescale=TRUE), or the topology of the tree must be modified to accommodate the height of focal as it is (rescale=FALSE, in this case scaleTree is applied).

rootage

the age of the tree root to be supplied if focal must be attached to it. If rootage=NULL the total height of the tree increases by 10%.

Value

The phylogenetic tree with required topological changes.

Author(s)

Silvia Castiglione, Pasquale Raia

Examples

require(phytools)
DataCetaceans$tree->tree

### Case 1. Moving a single tip
# sister to a tip
move.lineage(tree,focal="Orcinus_orca",sister="Balaenoptera_musculus")
# sister to a clade
move.lineage(tree,focal="Orcinus_orca",sister=131)
# sister to a clade by using tree$node.label
move.lineage(tree,focal="Balaenoptera_musculus",sister="Clade Delphinida")
# sister to a specific genus
move.lineage(tree,focal="Orcinus_orca",sister="Genus Balaenoptera")
# sister to the tree root with and without rootage
move.lineage(tree,focal="Balaenoptera_musculus",sister=117)
move.lineage(tree,focal="Balaenoptera_musculus",sister=117,rootage=max(diag(vcv(tree))))

### Case 2. Moving a clade
# sister to a tip
move.lineage(tree,focal="Genus Mesoplodon",sister="Balaenoptera_musculus")
move.lineage(tree,focal="Clade Delphinida",sister="Balaenoptera_musculus")
move.lineage(tree,focal=159,sister="Balaenoptera_musculus")
# sister to a clade
move.lineage(tree,focal="Genus Mesoplodon",sister=131)
move.lineage(tree,focal="Clade Delphinida",sister=131)
move.lineage(tree,focal=159,sister=131)
# sister to a clade by using tree$node.label
move.lineage(tree,focal="Genus Mesoplodon",sister="Clade Plicogulae")
move.lineage(tree,focal="Clade Delphinida",sister="Clade Plicogulae")
move.lineage(tree,focal=159,sister="Clade Plicogulae")
# sister to a specific genus
move.lineage(tree,focal="Genus Mesoplodon",sister="Genus Balaenoptera")
move.lineage(tree,focal="Clade Delphinida",sister="Genus Balaenoptera")
move.lineage(tree,focal=159,sister="Genus Balaenoptera")
# sister to the tree root with and without rootage
move.lineage(tree,focal="Genus Mesoplodon",sister=117)
move.lineage(tree,focal="Clade Delphinida",sister=117)
move.lineage(tree,focal=159,sister=117)
move.lineage(tree,focal="Genus Mesoplodon",sister=117,rootage=max(diag(vcv(tree))))
move.lineage(tree,focal="Clade Delphinida",sister=117,rootage=max(diag(vcv(tree))))
move.lineage(tree,focal=159,sister=117,rootage=max(diag(vcv(tree))))

RRphylo documentation built on June 7, 2023, 5:49 p.m.