explained_by_signatures {MutationalPatterns} | R Documentation

## This function has been renamed to 'cos_sim_matrix'.

### Description

This function has been renamed to 'cos_sim_matrix'.

### Usage

    explained_by_signatures(mut_matrix, signatures)

### Arguments

`mut_matrix` | 96 mutation count matrix (dimensions: 96 mutations X n samples)
`signatures` | 96 mutation count matrix (dimensions: 96 mutations X m samples)

### Value

Matrix with pairwise cosine similarities

### See Also

`cos_sim_matrix` `mut_matrix`, `fit_to_signatures`, `plot_cosine_heatmap`

### Examples

    ## You can download mutational signatures from the COSMIC database:
    # sp_url = http://cancer.sanger.ac.uk/cancergenome/assets/signatures_probabilities.txt
    # cancer_signatures = read.table(sp_url, sep = "\t", header = T)

    ## We copied the file into our package for your convenience.
    filename <- system.file("extdata/signatures_probabilities.txt",
                            package="MutationalPatterns")
    cancer_signatures <- read.table(filename, sep = "\t", header = TRUE)

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

    ## Match the order to MutationalPatterns standard of mutation matrix
    order = match(row.names(mut_mat), cancer_signatures$Somatic.Mutation.Type)
    ## Reorder cancer signatures dataframe
    cancer_signatures = cancer_signatures[order,]
    ## Use trinucletiode changes names as row.names
    ## row.names(cancer_signatures) = cancer_signatures$Somatic.Mutation.Type
    ## Keep only 96 contributions of the signatures in matrix
    cancer_signatures = as.matrix(cancer_signatures[,4:33])
    ## Rename signatures to number only
    colnames(cancer_signatures) = as.character(1:30)

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

[Package MutationalPatterns version 1.6.1 Index]