From 0e3d6e9f8163333454c716cfbb90a07e51f4c3da Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Sun, 23 Aug 2015 11:55:42 +0200 Subject: [PATCH] Change _originals to val --- .../sasc/biopet/utils/intervals/BedRecord.scala | 17 ++++++----------- .../biopet/utils/intervals/BedRecordList.scala | 4 +--- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecord.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecord.scala index 543e41509..4c50cc857 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecord.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecord.scala @@ -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 diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordList.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordList.scala index ed2c873d3..906f90df1 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordList.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordList.scala @@ -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 } -- GitLab