Skip to content
Snippets Groups Projects
Commit 0e3d6e9f authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Change _originals to val

parent 38d3970e
No related branches found
No related tags found
No related merge requests found
...@@ -14,9 +14,8 @@ case class BedRecord(chr: String, ...@@ -14,9 +14,8 @@ case class BedRecord(chr: String,
rgbColor: Option[(Int, Int, Int)] = None, rgbColor: Option[(Int, Int, Int)] = None,
blockCount: Option[Int] = None, blockCount: Option[Int] = None,
blockSizes: Array[Int] = Array(), blockSizes: Array[Int] = Array(),
blockStarts: Array[Int] = Array()) { blockStarts: Array[Int] = Array(),
protected[intervals] val _originals: List[BedRecord] = Nil) {
protected[intervals] var _originals: List[BedRecord] = Nil
def originals(nested: Boolean = false): List[BedRecord] = { def originals(nested: Boolean = false): List[BedRecord] = {
if (_originals.isEmpty) List(this) if (_originals.isEmpty) List(this)
...@@ -32,10 +31,8 @@ case class BedRecord(chr: String, ...@@ -32,10 +31,8 @@ case class BedRecord(chr: String,
case Some(false) => blockCount.get - i case Some(false) => blockCount.get - i
case _ => i + 1 case _ => i + 1
} }
val record = BedRecord(chr, start + blockStarts(i), start + blockStarts(i) + blockSizes(i), BedRecord(chr, start + blockStarts(i), start + blockStarts(i) + blockSizes(i),
name.map(_ + s"_exon-$exonNumber")) name.map(_ + s"_exon-$exonNumber"), _originals = List(this))
record._originals :+= this
record
})) }))
} else None } else None
...@@ -45,10 +42,8 @@ case class BedRecord(chr: String, ...@@ -45,10 +42,8 @@ case class BedRecord(chr: String,
case Some(false) => blockCount.get - i case Some(false) => blockCount.get - i
case _ => i + 1 case _ => i + 1
} }
val record = BedRecord(chr, start + start + blockStarts(i) + blockSizes(i) + 1, start + blockStarts(i + 1) - 1, BedRecord(chr, start + start + blockStarts(i) + blockSizes(i) + 1, start + blockStarts(i + 1) - 1,
name.map(_ + s"_intron-$intronNumber")) name.map(_ + s"_intron-$intronNumber"), _originals = List(this))
record._originals :+= this
record
})) }))
} else None } else None
......
...@@ -83,9 +83,7 @@ object BedRecordList { ...@@ -83,9 +83,7 @@ object BedRecordList {
val overlapRecords = records.takeWhile(_.start <= records.head.end) val overlapRecords = records.takeWhile(_.start <= records.head.end)
val end = overlapRecords.map(_.end).max val end = overlapRecords.map(_.end).max
val newRecord = BedRecord(chr, start, end) newRecords += BedRecord(chr, start, end, _originals = overlapRecords)
newRecord._originals = overlapRecords
newRecords += newRecord
combineOverlap(records.drop(overlapRecords.length), newRecords) combineOverlap(records.drop(overlapRecords.length), newRecords)
} else newRecords.toList } else newRecords.toList
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment