reorderHeatmapClusters: manually reorder ssvHeatmap2 clusters works with any tidy...

reorderHeatmapClustersR Documentation

manually reorder ssvHeatmap2 clusters works with any tidy clustered data.table too.

Description

manually reorder ssvHeatmap2 clusters works with any tidy clustered data.table too.

Usage

reorderHeatmapClusters(
  hres,
  new_cluster_order,
  id_var = "id",
  old_cluster_id = "cluster_id",
  new_cluster_id = "cluster_reorder_id"
)

Arguments

hres

results of ssvHeatmap2

new_cluster_order

desired top to bottom cluster order

old_cluster_id

orginal attribute name for clusters, default is "cluster_id"

new_cluster_id

new attribute name for reordered clusters. default is "cluster_reorder_id". can be same as old_cluster_id if you want to replace attribute.

Value

an ssvH2 object if one supplied as hres. Otherwise a data.table if data.table hres supplied.

Examples

res = ssvHeatmap2(heatmap_demo_matrix)
print(res)
p1 = plot(res)
reorder_res = reoderHeatmapClusters(res, c(5, 4, 2, 3, 1))
p2 = plot(reorder_res)
cowplot::plot_grid(p1, p2)
#works for data.table containing cluster info
reorder_dt = reoderHeatmapClusters(h.cluster_data(res), c(5, 4, 2, 3, 1), new_cluster_id = "cluster_id")
reorder_dt

jrboyd/ssvRecipes documentation built on May 22, 2022, 7:07 a.m.