Fix for expanded intervals in the case where the input file has overlapping intervals in it (seriously?)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5337 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
5ac9af472c
commit
abab23350f
|
|
@ -56,8 +56,14 @@ class ExpandIntervals(in : File, start: Int, size: Int, out: File, ref: File, ip
|
|||
curLoc = nextLoc
|
||||
nextLoc = if ( xrl.hasNext ) parseGenomeInterval(xrl.next) else null
|
||||
if ( curLoc != null ) {
|
||||
intervalCache += refine(expandLeft(curLoc),prevLoc)
|
||||
intervalCache += refine(expandRight(curLoc),nextLoc)
|
||||
val left: GenomeLoc = refine(expandLeft(curLoc),prevLoc)
|
||||
val right: GenomeLoc = refine(expandRight(curLoc),nextLoc)
|
||||
if ( left != null ) {
|
||||
intervalCache += left
|
||||
}
|
||||
if ( right != null ) {
|
||||
intervalCache += right
|
||||
}
|
||||
}
|
||||
linesProcessed += 1
|
||||
if ( linesProcessed % LINES_TO_CACHE == 0 ) {
|
||||
|
|
@ -83,14 +89,20 @@ class ExpandIntervals(in : File, start: Int, size: Int, out: File, ref: File, ip
|
|||
|
||||
def refine(newG: GenomeLoc, borderG: GenomeLoc) : GenomeLoc = {
|
||||
if ( borderG == null || ! newG.overlapsP(borderG) ) {
|
||||
newG
|
||||
return newG
|
||||
} else {
|
||||
if ( newG.getStart < borderG.getStart ) {
|
||||
parser.createGenomeLoc(newG.getContig,newG.getStart,borderG.getStart-startInt)
|
||||
if ( borderG.getStart - startInt > newG.getStart ) {
|
||||
return parser.createGenomeLoc(newG.getContig,newG.getStart,borderG.getStart-startInt)
|
||||
}
|
||||
} else {
|
||||
parser.createGenomeLoc(newG.getContig,borderG.getStop+startInt,newG.getStop)
|
||||
if ( borderG.getStop + startInt < newG.getStop ){
|
||||
return parser.createGenomeLoc(newG.getContig,borderG.getStop+startInt,newG.getStop)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
|
||||
def repr(loc : GenomeLoc) : String = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue