get_groups: Get Sample Groups from Signature Decomposition Information

View source: R/get_groups.R

get_groupsR Documentation

Get Sample Groups from Signature Decomposition Information

Description

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.

Usage

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

Arguments

Signature

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.

method

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.

n_cluster

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

match_consensus

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

Details

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.

Value

a data.table object

See Also

NMF::predict(), show_groups.

Examples


# Load copy number prepare object
load(system.file("extdata", "toy_copynumber_tally_W.RData",
  package = "sigminer", mustWork = TRUE
))
# Extract copy number signatures
library(NMF)
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)
g1
g2 <- get_groups(sig, method = "samples")
g2

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


sigminer documentation built on May 29, 2024, 3:11 a.m.