[email protected] user!2015 - the dendextend package

85
Tal.Galili@gmail.c om user ! 2015 - The dendextend package

Upload: brandon-rose

Post on 22-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

user!2015 - The dendextend package

Page 2: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Talk outline• Link to this presentation + dendextend

• 1 example

• The most useful functions

• Thanks!

Page 3: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Getting this presentation

Go to: www.R-statistics.comOr: just e-mail me:

Page 4: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Getting dendextend

Page 6: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Further reading

Page 7: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Further reading

(1 example - no code)

Page 8: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The Iris dataset

Page 9: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The Iris dataset

Page 10: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The Iris dataset

Using heatmap.2 from gplots

Page 11: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Why is “complete” different?

Comparing 8 Clustering algorithms onThe Iris dataset

Using dendlist,cor.dendlist + The corrplot package

Page 12: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Why is “complete” different?

Page 13: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Back tobasics

Page 14: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Building a dendrogram

Page 15: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

hclust -> dend

Page 16: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

hclust -> dend

Page 17: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Useful functions• labels• labels_colors• cutree• color_branches• sort• tanglegram• set (!)

Page 27: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

2 useful connections

Page 30: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

https://plot.ly/~talgalili/6/y-vs-x/

Send a dendrogram to plot.ly

Page 31: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Send a dendrogram to d3heatmap

Joint work with Joe Cheng

Page 32: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Send a dendrogram to d3heatmap

http://asbcllc.com/blog/2015/june/nba_14_15_top_50_heatmap/index.html

Page 33: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

ONE more function

Page 34: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Using pipes%>%

(but first…)

Page 35: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

hclust -> dend

Page 36: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

hclust + pipes (via magrittr)

Page 37: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Changing a dendrogram

Page 38: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The set functionset(dend, what, value)

One function to rule them all!

Page 39: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The set functionset(dend, what, value)

• dend a dendrogram• what the property to update• value new values to set in the

tree

Page 40: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The set functionset(dend, what, value)

Type “what"Labels labels, labels_to_character, labels_colors,

labels_cex, labels_to_characterLeaves leaves_pch, leaves_col, leaves_cex, hang_leavesNodes nodes_pch, nodes_col, nodes_cex

Branches branches_lty, branches_col, branches_lwd, branches_k_color, by_labels_branches_lty,

by_labels_branches_col, by_labels_branches_lwd

Page 41: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

A dend exmaple

Page 42: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Modify labels

Page 47: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Modify nodes (no code)

Page 48: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Modify nodes (no code)

Page 49: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Modify branches

Page 50: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Modify branches

Page 54: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Rotate branches

Page 55: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Rotate branches

Page 56: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Prune branches

Page 57: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Prune branches

Page 58: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Add rectangles

Page 59: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Add rectangles

Page 60: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

dendextendand other packages

Page 61: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Gplots: heatmap.2

Page 62: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

dynamicTreeCut

Page 63: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

pvclust

Page 64: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Take-home messages:• hclust – is good for creating hierarchical

clustering, but limited for plotting• dendrogram object• a nested list of lists• with attributes!• should be modified step by step before

plotting• Dendrograms can be compared• Use dendextendRcpp for (“free”) speed

Page 65: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Credits!

dendextend

This work was supported in part by the European Research Council under EC–EP7 European Research Council grant PSARPS-297519, and also by the HBP project.

Page 66: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Credits!

Page 67: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The dendextend package

Thank you!for the slides:

R-statistics.com

Page 68: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Exploring a dendrogram

Page 70: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

A dendrogram is a nested list of lists

Page 73: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Depth- FirstSearch

Page 74: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Depth- FirstSearch

Page 75: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Comparing dendrograms

Page 76: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

tanglegram + untangle

Page 77: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

tanglegram + untangle

Page 78: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

“Correlation” measures

Page 79: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

“Correlation” measures

Page 80: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

dendextendin the wild

Page 81: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Visually comparing two clustering methods

Page 82: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

A plot from a recent HBP meeting in Lausanne

DendrogramUsing 2 variables

DendrogramUsing all variables

Page 83: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Visually comparing two phylogenic trees

Page 84: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

Send a dendrogram to d3heatmap

http://asbcllc.com/blog/2015/june/nba_14_15_top_50_heatmap/index.html

Page 85: Tal.Galili@gmail.com user!2015 - The dendextend package

[email protected]

The dendextend package

Thank you!for the slides:

R-statistics.com