-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lots of cleanup of the initial bolus of code. (#3)
A bunch of refactoring, most notably of how we accrue counts and assign IDs to breakpoints, so that we are guaranteed to count all evidence for breakpoint the same way and only assign it a single ID.
- Loading branch information
Showing
15 changed files
with
305 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/scala/com/fulcrumgenomics/sv/BreakpointEvidence.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.fulcrumgenomics.sv | ||
|
||
object BreakpointEvidence { | ||
/** | ||
* Builds a breakpoint evidence from two aligned segments and an evidence type. | ||
* | ||
* The two segments must be given in such a way that a read traversing the breakpoint would | ||
* read through `from` in the genomic orientation given by `from` and then into `into` in the | ||
* orientation given by `into`. E.g. if the two segments originate from a single (split-read) | ||
* alignment then `from` should come from earlier in the read in sequencing order. Since the | ||
* segments could be from different reads in a mate pair, this cannot be validated/required() | ||
* in this method, but violating this assumption will lead to invalid breakpoints. | ||
* | ||
* The returned breakpoint will be canonicalized such that the `left` side of the breakpoint will have the | ||
* lower (or equal to) position on the genome vs. the `right` side. | ||
*/ | ||
def apply(from: AlignedSegment, | ||
into: AlignedSegment, | ||
evidence: EvidenceType): BreakpointEvidence = { | ||
new BreakpointEvidence(breakpoint = Breakpoint(from, into), evidence = evidence) | ||
} | ||
} | ||
|
||
|
||
/** Stores the genomic break ends of a putative breakpoint | ||
* | ||
* @param breakpoint the breakpoint for which we have evidence | ||
* @param evidence the type of evidence for this breakpoint | ||
*/ | ||
case class BreakpointEvidence(breakpoint: Breakpoint, evidence: EvidenceType) extends Ordered[BreakpointEvidence] { | ||
|
||
/** Defines an ordering over breakpoints, first by genomic coordinates of the left then right end, then evidence type. */ | ||
def compare(that: BreakpointEvidence): Int = { | ||
var result = this.breakpoint.compare(that.breakpoint) | ||
if (result == 0) result = this.evidence.compare(that.evidence) | ||
result | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ulcrumgenomics/sv/util/EvidenceType.scala → ...com/fulcrumgenomics/sv/EvidenceType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.