File: test-plot_profile_heatmap.R

package info (click to toggle)
r-bioc-mutationalpatterns 3.8.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,336 kB
  • sloc: sh: 8; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
context("test-plot_profile_heatmap")


# Get input data
mut_mat <- readRDS(system.file("states/mut_mat_data.rds",
  package = "MutationalPatterns"
))

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


## Create heatmap of profile
output_basic <- plot_profile_heatmap(mut_mat, max = 0.1)

## Create heatmap of extended profile
output <- plot_profile_heatmap(mut_mat_extended)

## Or plot heatmap per tissue
tissue <- c(
  "colon", "colon", "colon",
  "intestine", "intestine", "intestine",
  "liver", "liver", "liver"
)

output_tissue <- plot_profile_heatmap(mut_mat_extended, by = tissue)

## Or plot the heatmap per sample.
output_sample <- plot_profile_heatmap(mut_mat_extended,
  by = colnames(mut_mat_extended),
  max = 0.05
)


test_that("Output has correct class", {
  expect_true(inherits(output_basic, c("gg")))
  expect_true(inherits(output, c("gg")))
  expect_true(inherits(output_tissue, c("gg")))
  expect_true(inherits(output_sample, c("gg")))
})