-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.R
More file actions
32 lines (25 loc) · 1012 Bytes
/
test.R
File metadata and controls
32 lines (25 loc) · 1012 Bytes
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
libs <- c("testthat",
"GenomicRanges",
"ShortRead",
"BSgenome",
sprintf("BSgenome.Hsapiens.UCSC.%s", "hg18"))
null <- suppressMessages(sapply(libs, library, character.only=TRUE))
source("simIntSiteReads_func.R")
## test on + strand
context('test fetching sequence downstream')
pos <- 59165408
for( chr in c("chr1") ) {
for( pos in c(59165408, 49165408, 39165408) ) {
context(paste('Position', chr, pos))
context('Sequence on + strand')
width <- c(30, 40, 50)
expect_equal(
get_sequence_downstream(Hsapiens, chr, pos, "+", width)$seq,
sapply(width, function(w) as.character(Hsapiens[[chr]][1:w-1+pos])) )
context('Sequence on - strand')
width <- c(30, 40, 50)
expect_equal(
get_sequence_downstream(Hsapiens, chr, pos, "-", width)$seq,
sapply(width, function(w) as.character(reverseComplement(Hsapiens[[chr]][1:w+pos-w]) ) ) )
}
}