From f365755d45a3bbcc388e821a527e3d5b8441adbc Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Mon, 24 Aug 2015 11:17:34 +0200 Subject: [PATCH] Added utr features --- .../lumc/sasc/biopet/utils/intervals/BedRecord.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 9a798fbaf..b8f5e680c 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 @@ -47,6 +47,18 @@ case class BedRecord(chr: String, })) } else None + lazy val utr5 = (strand, thickStart, thickEnd) match { + case (Some("+"), Some(tStart), Some(tEnd)) => Some(BedRecord(chr, start, tStart - 1, name.map(_ + "_utr5"))) + case (Some("-"), Some(tStart), Some(tEnd)) => Some(BedRecord(chr, tEnd + 1, end, name.map(_ + "_utr5"))) + case _ => None + } + + lazy val utr3 = (strand, thickStart, thickEnd) match { + case (Some("-"), Some(tStart), Some(tEnd)) => Some(BedRecord(chr, start, tStart - 1, name.map(_ + "_utr3"))) + case (Some("+"), Some(tStart), Some(tEnd)) => Some(BedRecord(chr, tEnd + 1, end, name.map(_ + "_utr3"))) + case _ => None + } + override def toString = { def arrayToOption[T](array: Array[T]): Option[Array[T]] = { if (array.isEmpty) None -- GitLab