Internal node number

Some of the functions in ggtree work with clade and accept a parameter of internal node number. To get the internal node number, user can use geom_text2 to display it:

Another way to get the internal node number is using MRCA() function by providing a vector of taxa names. The function will return node number of input taxa’s most recent commond ancestor (MRCA). It works with tree and graphic object.

## [1] 17
## [1] 21
## [1] 17

view Clade

ggtree provides a function viewClade to visualize a clade of a phylogenetic tree.

group Clades

The ggtree package defined several functions to manipulate tree view. groupClade and groupOTU methods were designed for clustering clades or related OTUs. groupClade accepts an internal node or a vector of internal nodes to cluster clade/clades.

Both groupClade and groupOTU work fine with tree and graphic object.

The following command will produce the same figure.

With groupClade and groupOTU, it’s easy to highlight selected taxa and easy to select taxa to display related features.

group OTUs

groupOTU accepts a vector of OTUs (taxa name) or a list of OTUs. groupOTU will trace back from OTUs to their most recent common ancestor and cluster them together. Related OTUs are not necessarily within a clade, they can be monophyletic (clade), polyphyletic or paraphyletic.

groupOTU can also input a list of tip groups.

groupOTU also work with graphic object.

The following example use groupOTU to display taxa classification.

collapse clade

With collapse function, user can collapse a selected clade.

expand collapsed clade

The collapsed clade can be expanded via expand function.

scale clade

Collpase selected clades can save some space, another approach is to zoom out clade to a small scale.

Of course, scaleClade can accept scale larger than 1 and zoom in the selected portion.

rotate clade

A selected clade can be rotated by 180 degree using rotate function.