cos_sim_matrix: Compute all pairwise cosine similarities between mutational...

Description Usage Arguments Value See Also Examples

View source: R/cos_sim_matrix.R

Description

Computes all pairwise cosine similarities between the mutational profiles provided in the two mutation count matrices. The cosine similarity is a value between 0 (distinct) and 1 (identical) and indicates how much two vectors are alike.

Usage

1
cos_sim_matrix(mut_matrix1, mut_matrix2)

Arguments

mut_matrix1

96 mutation count matrix (dimensions: 96 mutations X n samples)

mut_matrix2

96 mutation count matrix (dimensions: 96 mutations X m samples)

Value

Matrix with pairwise cosine similarities (dimensions: n mutational profiles X m mutational profiles)

See Also

mut_matrix, fit_to_signatures, plot_cosine_heatmap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Get signatures
signatures <- get_known_signatures()

## See the 'mut_matrix()' example for how we obtained the mutation matrix:
mut_mat <- readRDS(system.file("states/mut_mat_data.rds",
  package = "MutationalPatterns"
))


## Calculate the cosine similarity between each COSMIC signature and each 96 mutational profile
cos_sim_matrix(mut_mat, signatures)

MutationalPatterns documentation built on Nov. 14, 2020, 2:03 a.m.