Learn R Programming

coreheat (version 0.2.2)

clust_cormap: Cluster a correlation matrix and return the sorted matrix for plotting.

Description

Helper function to cluster the correlation matrix and return the sorted matrix for plotting.

Usage

clust_cormap(
  cormat,
  na.frac = 0.1,
  distfn = function(cm) (1 - cm),
  method = "complete",
  cor.cluster = 1,
  cor.window = NULL,
  cor.thr = 0.8,
  cor.mar = 0.05,
  cut.thr = 0.9,
  cut.size = 5,
  list.output = FALSE,
  verbose = FALSE
)

Arguments

cormat

(numeric or list). The correlation matrix or a list containing matrices of correlation values and P-Values as generated by eset_cor. If a list then the correlation matrix is expected to be in slot 'cor' and the matrix of P-Values in slot 'pvalues'.

na.frac

(numeric). Fraction of missing values allowed per row of the input matrix. Defaults to 0.1 which means LESS than 10per centof the values in one row are allowed to be NAs.

distfn

(function). Function to calculate the dissimilarity matrix for clustering. Defaults to function(cm) (1-cm).

method

(character). The agglomeration method used for clustering. See help for hclust. Defaults to "complete".

cor.cluster

(numeric). The correlation cluster along the diagonal 'line' in the heatmap that should be zoomed into. A sliding window of size cor.window will be moved along the diagonal of the correlation matrix to find the cluster with the most corelation values meeting core.thr. Defaults to 1.

cor.window

(numeric). The size of the sliding window (see cor.cluster). Defaults to NULL. Note that this works only for positive correlations.

cor.thr

(numeric). Correlation threshold to filter the correlation matrix for plotting. Defaults to NULL meaning no filtering. See also cor.mar. This value is sign-sensitive: a negative threshold will retain rows and columns of the correlation matrix with correlation values between -1 and the threshold, a positive value will retain rows and columns with values between the threshold and 1. Zero (0) is treated as positive.

cor.mar

(numeric). Margin of the values per row of the correlation matrix the cor.thr filter needs to meet. Defaults to 0.5 meaning at least 50 per cent of the values in a row need to meet the threshold in order to keep the row.

cut.thr

(numeric). Threshold at which dendrogram branches are to be cut. Passed on to argument cutHeight in cutreeStatic. Defaults to NULL meaning no cutting.

cut.size

(numeric). Minimum number of objects on a dendrogram branch considered a cluster. Passed on to argument minSize in cutreeStatic. Defaults to 5.

list.output

(logical). Should the output be a list of different object created in the call? Depends also on input type. If FALSE only the (filtered) correlation matrix is returned.

verbose

(logical). Should verbose output be written to the console? Defaults to FALSE.

Value

A correlation matrix or a list or the matrix and other values needed for plotting.