File: test_ceScan.R

package info (click to toggle)
r-bioc-cner 1.26.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 18,216 kB
  • sloc: ansic: 23,458; makefile: 6
file content (55 lines) | stat: -rw-r--r-- 2,622 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
test_that("test_ceScan", {
  axtFnHg38DanRer10 <- file.path(system.file("extdata", package="CNEr"),
                                 "hg38.danRer10.net.axt")
  axtHg38DanRer10 <- readAxt(axtFnHg38DanRer10)
  axtFnDanRer10Hg38 <- file.path(system.file("extdata", package="CNEr"),
                                 "danRer10.hg38.net.axt")
  axtDanRer10Hg38 <- readAxt(axtFnDanRer10Hg38)
  bedHg38Fn <- file.path(system.file("extdata", package="CNEr"),
                         "filter_regions.hg38.bed")
  bedHg38 <- readBed(bedHg38Fn)
  bedDanRer10Fn <- file.path(system.file("extdata", package="CNEr"),
                             "filter_regions.danRer10.bed")
  bedDanRer10 <- readBed(bedDanRer10Fn)

  skip_if_not_installed("BSgenome.Hsapiens.UCSC.hg38")
  skip_if_not_installed("BSgenome.Drerio.UCSC.danRer10")
  library(BSgenome.Drerio.UCSC.danRer10)
  library(BSgenome.Hsapiens.UCSC.hg38)
  qSizesHg38 <- seqinfo(BSgenome.Hsapiens.UCSC.hg38)
  qSizesDanRer10 <- seqinfo(BSgenome.Drerio.UCSC.danRer10)
  
  windows <- c(50L, 50L, 50L)
  identities <- c(45L, 48L, 49L)
  CNEHg38DanRer10 <- ceScan(x=axtHg38DanRer10, tFilter=bedHg38,
                            qFilter=bedDanRer10,
                            tSizes=qSizesHg38, qSizes=qSizesDanRer10,
                            window=windows, identity=identities)
  # check the names of CNE list
  expect_identical(names(CNEHg38DanRer10), c("45_50", "48_50", "49_50"))
  
  # check the CNEs in "45_50" set
  expect_identical(length(CNEHg38DanRer10[["45_50"]]), 4L)
  
  targetCNEs <- GRanges(seqnames=c("chr3"),
                        ranges=IRanges(start=c(137523038, 137523122,
                                               137269941, 137264717),
                                       end=c(137523102, 137523187,
                                             137269991, 137265124)),
                        strand="+", seqinfo=qSizesHg38)
  expect_identical(first(CNEHg38DanRer10[["45_50"]]), targetCNEs)
  
  queryCNEs <- GRanges(seqnames=c("chr6"),
                       ranges=IRanges(start=c(26638744, 26638826,
                                              26746284, 26745047),
                                      end=c(26638808, 26638891,
                                            26746334, 26745455)),
                       strand="+", seqinfo=qSizesDanRer10)
  expect_identical(last(CNEHg38DanRer10[["45_50"]]), queryCNEs)
  
  library(S4Vectors)
  mcolsCNEs <- DataFrame(score=c(87.69, 89.39, 90.20, 95.11),
                        cigar=c("65M", "66M", "51M", "218M1D190M"))
  expect_identical(mcols(CNEHg38DanRer10[["45_50"]]), mcolsCNEs)
}
)