400
400
subjectHits = unname(matchMatrix3[ , 2L]),
401
401
queryLength = 4L, subjectLength = 4L)
402
402
checkIdentical(target3, current3)
405
q0 <- GRanges("A", IRanges(c(11, 5, 4, 11, 11, 4),
406
c(30, 30, 30, 50, 51, 51)))
407
s0 <- GRanges("A", IRanges(5, width=46))
408
s0@seqinfo <- Seqinfo(seqnames="A", seqlengths=100, isCircular=TRUE)
409
## sanity check with linear shift
410
fo0 <- findOverlaps(q0, s0, type="within")
411
expected <- c(1L, 2L, 4L)
412
checkIdentical(queryHits(fo0), expected)
416
fo1 <- findOverlaps(q1, s1, type="within")
417
checkIdentical(queryHits(fo1), expected)
420
q2 <- shift(q0, A + 100 * n1)
421
s2 <- shift(s0, A + 100 * n2)
422
fo1 <- findOverlaps(q1, s1, type="within")
423
checkIdentical(queryHits(fo1), expected)
425
## With A of length 8 --> range 3 is within range 2
426
gr <- GRanges(seqnames=rep.int("A", 4),
427
ranges=IRanges(start=c(2, 4, 6, 8), width=c(3, 3, 3, 5)))
428
gr@seqinfo <- Seqinfo(seqnames="A", seqlengths=8, isCircular=TRUE)
429
current4 <- findOverlaps(gr, gr, type="within")
430
matchMatrix4 <- matrix(c(1L, 1L, 2L, 3L, 4L,
431
1L, 4L, 2L, 3L, 4L), ncol = 2,
432
dimnames = list(NULL, c("queryHits", "subjectHits")))
433
target4 <- new("Hits",
434
queryHits = unname(matchMatrix4[ , 1L]),
435
subjectHits = unname(matchMatrix4[ , 2L]),
436
queryLength = 4L, subjectLength = 4L)
437
checkIdentical(target4, current4)
438
## With A of length 9 --> range 3 is not within range 2
439
gr@seqinfo <- Seqinfo(seqnames="A", seqlengths=9, isCircular=TRUE)
440
current5 <- findOverlaps(gr, gr, type="within")
441
target5 <- new("Hits",
442
queryHits = unname(matchMatrix2[ , 1L]),
443
subjectHits = unname(matchMatrix2[ , 2L]),
444
queryLength = 4L, subjectLength = 4L)
445
checkIdentical(target5, current5)