Commit 0e3d6e9f authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Change _originals to val

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