One of key results from signature analysis is to cluster samples into different groups. This function takes Signature object as input and return the membership in each cluster.

  method = c("consensus", "k-means", "exposure", "samples"),
  n_cluster = NULL,
  match_consensus = TRUE



a Signature object obtained either from sig_extract or sig_auto_extract. Now it can be used to relative exposure result in data.table format from sig_fit.


grouping method, more see details, could be one of the following:

  • 'consensus' - returns the cluster membership based on the hierarchical clustering of the consensus matrix, it can only be used for the result obtained by sig_extract() with multiple runs using NMF package.

  • 'k-means' - returns the clusters by k-means.

  • 'exposure' - assigns a sample into a group whose signature exposure is dominant.

  • 'samples' - returns the cluster membership based on the contribution of signature to each sample, it can only be used for the result obtained by sig_extract() using NMF package.


only used when the method is 'k-means'.


only used when the method is 'consensus'. If TRUE, the result will match order as shown in consensus map.


a data.table object


Users may find there are bigger differences between using method 'samples' and 'exposure' but they use a similar idear to find dominant signature, here goes the reason:

Method 'samples' using data directly from NMF decomposition, this means the two matrix W (basis matrix or signature matrix) and H (coefficient matrix or exposure matrix) are the results of NMF. For method 'exposure', it uses the signature exposure loading matrix. In this situation, each signture represents a number of mutations (alterations) about implementation please see source code of sig_extract() function.

See also


# \donttest{
# Load copy number prepare object
load(system.file("extdata", "toy_copynumber_tally_W.RData",
  package = "sigminer", mustWork = TRUE
# Extract copy number signatures
sig <- sig_extract(cn_tally_W$nmf_matrix, 2,
  nrun = 10

# Methods 'consensus' and 'samples' are from NMF::predict()
g1 <- get_groups(sig, method = "consensus", match_consensus = TRUE)
g2 <- get_groups(sig, method = "samples")

# Use k-means clustering
g3 <- get_groups(sig, method = "k-means")
# }