Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADAM-1747] Fixed subtract bug and tests #1748

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,10 @@ case class ReferenceRegion(
start,
other.start,
newRegionStrand))
} else if (end > other.end) {
Iterable(ReferenceRegion(referenceName,
start,
other.end,
newRegionStrand))
} else {
Iterable.empty[ReferenceRegion]
}
val second = if (other.start > start && end > other.end) {
val second = if (end > other.end) {
Iterable(ReferenceRegion(referenceName,
other.end,
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,13 @@ class ReferenceRegionSuite extends FunSuite {
// right end unstranded
assert(ReferenceRegion("chr0", 10, 100, Strand.FORWARD).subtract(ReferenceRegion("chr0", 90, 150, Strand.REVERSE), false) === List(ReferenceRegion("chr0", 10, 90)))
// left end unstranded
assert(ReferenceRegion("chr0", 90, 150, Strand.REVERSE).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), false) === List(ReferenceRegion("chr0", 90, 100)))
assert(ReferenceRegion("chr0", 90, 150, Strand.REVERSE).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), false) === List(ReferenceRegion("chr0", 100, 150)))
// contained unstranded
assert(ReferenceRegion("chr0", 2, 150, Strand.REVERSE).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), false) === List(ReferenceRegion("chr0", 2, 10), ReferenceRegion("chr0", 100, 150)))
// right end stranded
assert(ReferenceRegion("chr0", 10, 100, Strand.FORWARD).subtract(ReferenceRegion("chr0", 90, 150, Strand.FORWARD), true) === List(ReferenceRegion("chr0", 10, 90, Strand.FORWARD)))
// left end stranded
assert(ReferenceRegion("chr0", 90, 150, Strand.FORWARD).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), true) === List(ReferenceRegion("chr0", 90, 100, Strand.FORWARD)))
assert(ReferenceRegion("chr0", 90, 150, Strand.FORWARD).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), true) === List(ReferenceRegion("chr0", 100, 150, Strand.FORWARD)))
// contained stranded
assert(ReferenceRegion("chr0", 2, 150, Strand.FORWARD).subtract(ReferenceRegion("chr0", 10, 100, Strand.FORWARD), true) === List(ReferenceRegion("chr0", 2, 10, Strand.FORWARD), ReferenceRegion("chr0", 100, 150, Strand.FORWARD)))

Expand Down