File: test-plot_lesion_segregation.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 (37 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (2)
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
context("test-plot_lesion_segregation")


# Load GRangesList
grl <- readRDS(system.file("states/read_vcfs_as_granges_output.rds",
  package = "MutationalPatterns"
))

# Only use two samples to reduce runtime
grl <- grl[1:2]

# Select sample
gr <- grl[[1]]

# Perform function
output <- plot_lesion_segregation(grl)
output_singlesample <- plot_lesion_segregation(gr, sample_name = "Colon1")
output_noname <- plot_lesion_segregation(gr)
output_l <- plot_lesion_segregation(gr, per_chrom = TRUE, sample_name = "Colon1")
output_chr_filter = plot_lesion_segregation(grl, chromosomes = c("chr2", "chr3"))
output_chr_filter2 = plot_lesion_segregation(grl, chromosomes = c("2", "3"))
output_subsample <- plot_lesion_segregation(grl, subsample = 0.1)

test_that("Output has correct class", {
  expect_true(inherits(output, c("gg")))
  expect_true(inherits(output_singlesample, c("gg")))
  expect_true(inherits(output_noname, c("gg")))
  expect_true(inherits(output_l, c("list")))
  expect_true(inherits(output_l[[1]], c("gg")))
  expect_true(inherits(output_chr_filter, c("gg")))
  expect_true(inherits(output_chr_filter2, c("gg")))
  expect_true(inherits(output_subsample, c("gg")))
})

test_that("Output per chromosome has correct length", {
  expect_equal(length(output_l), 22)
})