reorder_clusters_hclust: reorder_clusters_hclust

View source: R/functions_clusteringKmeans.R

reorder_clusters_hclustR Documentation

reorder_clusters_hclust

Description

Applies hierarchical clustering to centroids of clusters to reorder.

Usage

reorder_clusters_hclust(
  clust_dt,
  hclust_result = NULL,
  row_ = "id",
  column_ = "x",
  fill_ = "y",
  facet_ = "sample",
  cluster_ = "cluster_id",
  reapply_cluster_names = TRUE,
  return_hclust = FALSE
)

Arguments

clust_dt

data.table output from ssvSignalClustering

hclust_result

hclust result returned by a previous call of this function with identical paramters when return_hclust = TRUE.

row_

variable name mapped to row, likely id or gene name for ngs data. Default is "id" and works with ssvFetch* output.

column_

varaible mapped to column, likely bp position for ngs data. Default is "x" and works with ssvFetch* output.

fill_

numeric variable to map to fill. Default is "y" and works with ssvFetch* output.

facet_

variable name to facet horizontally by. Default is "sample" and works with ssvFetch* output. Set to "" if data is not facetted.

cluster_

variable name to use for cluster info. Default is "cluster_id".

reapply_cluster_names

If TRUE, clusters will be renamed according to new order instead of their original names. Default is TRUE.

return_hclust

If TRUE, return the result of hclust instead of the reordered clustering data.table. Default is FALSE. Ignored if hclust_result is supplied.

Value

data.table as output from ssvSignalClustering

Examples

data(CTCF_in_10a_profiles_dt)
clust_dt = ssvSignalClustering(CTCF_in_10a_profiles_dt, nclust = 10)
new_dt = reorder_clusters_hclust(clust_dt)
cowplot::plot_grid(
    ssvSignalHeatmap(clust_dt),
    ssvSignalHeatmap(new_dt)
)

jrboyd/seqsetvis documentation built on Dec. 10, 2024, 11:23 a.m.