plot_contribution_heatmap {MutationalPatterns} | R Documentation

## Plot signature contribution heatmap

### Description

Plot relative contribution of signatures in a heatmap

### Usage

    plot_contribution_heatmap(contribution, sig_order, cluster_samples = TRUE,
      method = "complete", plot_values = FALSE)

### Arguments

`contribution` | Signature contribution matrix
`sig_order` | Character vector with the desired order of the signature names for plotting. Optional.
`cluster_samples` | Hierarchically cluster samples based on eucledian distance. Default = T.
`method` | The agglomeration method to be used for hierarchical clustering. This should be one of "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). Default = "complete".
`plot_values` | Plot relative contribution values in heatmap. Default = F.

### Value

Heatmap with relative contribution of each signature for each sample

### See Also

`extract_signatures`, `mut_matrix`, `plot_contribution`

### Examples

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

    ## Extracting signatures can be computationally intensive, so
    ## we use pre-computed data generated with the following command:

    # nmf_res <- extract_signatures(mut_mat, rank = 2)

    nmf_res <- readRDS(system.file("states/nmf_res_data.rds",
                        package="MutationalPatterns"))

    ## Set signature names as row names in the contribution matrix
    rownames(nmf_res$contribution) = c("Signature A", "Signature B")

    ## Define signature order for plotting
    sig_order = c("Signature B", "Signature A")

    ## Contribution heatmap with signatures in defined order
    plot_contribution_heatmap(nmf_res$contribution,
                              sig_order = c("Signature B", "Signature A"))

    ## Contribution heatmap without sample clustering
    plot_contribution_heatmap(nmf_res$contribution,
                              sig_order = c("Signature B", "Signature A"),
                              cluster_samples = FALSE, method = "complete")

[Package MutationalPatterns version 1.6.1 Index]