Skip to content

Commit d6173c3

Browse files
author
Daniel Cameron
committed
Fixed regression bug in findBreakpointOverlaps()
1 parent 73abb98 commit d6173c3

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: StructuralVariantAnnotation
22
Type: Package
33
Title: VariantionAnnoration for Structural Variants
4-
Version: 0.7.2
4+
Version: 0.7.3
55
Date: 2018-01-25
66
Author: Daniel Cameron
77
Maintainer: Daniel Cameron <[email protected]>

R/BreakpointGRanges.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ partner <- function(gr) {
3333
findBreakpointOverlaps <- function(query, subject, maxgap=-1L, minoverlap=0L, ignore.strand=FALSE, sizemargin=0.25, restrictMarginToSizeMultiple=0.5) {
3434
hits <- dplyr::bind_rows(
3535
as.data.frame(findOverlaps(query, subject, maxgap=maxgap, minoverlap=minoverlap, type="any", select="all", ignore.strand=ignore.strand), row.names=NULL),
36-
as.data.frame(findOverlaps(query, subject, maxgap=maxgap, minoverlap=minoverlap, type="any", select="all", ignore.strand=ignore.strand), row.names=NULL))
36+
as.data.frame(findOverlaps(partner(query), partner(subject), maxgap=maxgap, minoverlap=minoverlap, type="any", select="all", ignore.strand=ignore.strand), row.names=NULL))
37+
#as.data.frame(findOverlaps(partner(query), partner(subject), maxgap=maxgap, minoverlap=minoverlap, type="any", select="all", ignore.strand=ignore.strand), row.names=NULL))
38+
3739
# we now want to do:
3840
# hits <- hits[duplicated(hits),] # both breakends match
3941
# but for large hit sets (such as focal false positive loci) we run out of memory (>32GB)

tests/testthat/test-BreakpointGRanges.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ test_that(".constrict", {
3636
expect_equal(start(gr), c(1, 16571))
3737
})
3838

39-
39+
justHits <- function(df) {
40+
return(data.frame(queryHits=df$queryHits, subjectHits=df$subjectHits))
41+
}
4042
test_that("findBreakpointOverlaps", {
41-
justHits <- function(df) {
42-
return(data.frame(queryHits=df$queryHits, subjectHits=df$subjectHits))
43-
}
4443
expect_equal(justHits(findBreakpointOverlaps(breakpointRanges(.testrecord(c(
4544
"chr1 100000 a N N[chr1:100100[ . . SVTYPE=BND;PARID=b",
4645
"chr1 100100 b N ]chr1:100000]N . . SVTYPE=BND;PARID=a",
@@ -84,6 +83,13 @@ test_that("findBreakpointOverlaps", {
8483
maxgap=1)),
8584
data.frame(queryHits=c(1,2), subjectHits=c(2,1)))
8685
})
86+
test_that("findBreakpointOverlaps_match_both_sides", {
87+
gr1 = GRanges(seqnames="1", ranges=IRanges(start=c(1, 100), width=1), strand="+", partner=c("2", "1"))
88+
names(gr1) = c("1", "2")
89+
gr2 = GRanges(seqnames="1", ranges=IRanges(start=c(100, 100), width=1), strand="+", partner=c("2", "1"))
90+
names(gr2) = c("1", "2")
91+
expect_equal(nrow(findBreakpointOverlaps(gr1, gr2, sizemargin=NULL)), 0)
92+
})
8793

8894
test_that("findBreakpointOverlaps: delly vs truth", {
8995
grdelly <- breakpointRanges(.testrecord(c(

0 commit comments

Comments
 (0)