diff --git a/src/main/scala/com/fulcrumgenomics/umi/Umis.scala b/src/main/scala/com/fulcrumgenomics/umi/Umis.scala index 772f67351..a024dfc2f 100644 --- a/src/main/scala/com/fulcrumgenomics/umi/Umis.scala +++ b/src/main/scala/com/fulcrumgenomics/umi/Umis.scala @@ -26,8 +26,7 @@ package com.fulcrumgenomics.umi import com.fulcrumgenomics.bam.api.SamRecord -import com.fulcrumgenomics.umi.ConsensusTags.PerBase.AbRawReadCount -import com.fulcrumgenomics.umi.ConsensusTags.PerRead.{BaRawReadCount, RawReadCount} +import com.fulcrumgenomics.umi.ConsensusTags import com.fulcrumgenomics.util.Sequences object Umis { @@ -136,6 +135,7 @@ object Umis { * @return boolean indicating if the record is a consensus or not */ def isConsensusRead(rec: SamRecord): Boolean = { - rec.contains(RawReadCount) | (rec.contains(AbRawReadCount) & rec.contains(BaRawReadCount)) + rec.contains(ConsensusTags.PerRead.RawReadCount) || + (rec.contains(ConsensusTags.PerRead.AbRawReadCount) && rec.contains(ConsensusTags.PerRead.BaRawReadCount)) } } diff --git a/src/test/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetricsTest.scala b/src/test/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetricsTest.scala index 8c646a91a..3624d357c 100644 --- a/src/test/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetricsTest.scala +++ b/src/test/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetricsTest.scala @@ -31,8 +31,7 @@ import com.fulcrumgenomics.bam.api.SamOrder import com.fulcrumgenomics.commons.util.SimpleCounter import com.fulcrumgenomics.testing.SamBuilder.{Minus, Plus} import com.fulcrumgenomics.testing.{SamBuilder, UnitSpec} -import com.fulcrumgenomics.umi.ConsensusTags.PerBase.AbRawReadCount -import com.fulcrumgenomics.umi.ConsensusTags.PerRead.{AllPerReadTags, BaRawReadCount} +import com.fulcrumgenomics.umi.ConsensusTags import com.fulcrumgenomics.util.{Io, Metric, Rscript} import htsjdk.samtools.util.{Interval, IntervalList} import org.apache.commons.math3.distribution.NormalDistribution @@ -320,7 +319,12 @@ class CollectDuplexSeqMetricsTest extends UnitSpec { contig=1, start1=1000, start2=1100, - attrs=Map(RX -> "AAA-GGG", MI -> "1/A", AbRawReadCount -> 10, BaRawReadCount -> 10) + attrs=Map( + RX -> "AAA-GGG", + MI -> "1/A", + ConsensusTags.PerRead.AbRawReadCount -> 10, + ConsensusTags.PerRead.BaRawReadCount -> 10 + ) ) an[IllegalArgumentException] shouldBe thrownBy { exec(builder) } } diff --git a/src/test/scala/com/fulcrumgenomics/umi/UmisTest.scala b/src/test/scala/com/fulcrumgenomics/umi/UmisTest.scala index f9b1ddd3e..427131982 100644 --- a/src/test/scala/com/fulcrumgenomics/umi/UmisTest.scala +++ b/src/test/scala/com/fulcrumgenomics/umi/UmisTest.scala @@ -27,8 +27,7 @@ package com.fulcrumgenomics.umi import com.fulcrumgenomics.bam.api.{SamOrder, SamRecord} import com.fulcrumgenomics.testing.{SamBuilder, UnitSpec} -import com.fulcrumgenomics.umi.ConsensusTags.PerBase.AbRawReadCount -import com.fulcrumgenomics.umi.ConsensusTags.PerRead.{BaRawReadCount, RawReadCount} +import com.fulcrumgenomics.umi.ConsensusTags import org.scalatest.OptionValues class UmisTest extends UnitSpec with OptionValues { @@ -122,8 +121,11 @@ class UmisTest extends UnitSpec with OptionValues { it should "return true for reads with consensus tags" in { val builder = new SamBuilder(sort=Some(SamOrder.Coordinate), readLength=10, baseQuality=20) - builder.addFrag(start=10, attrs=Map(RawReadCount -> 10)).exists(Umis.isConsensusRead) shouldBe true - builder.addFrag(start=10, attrs=Map(AbRawReadCount -> 10, BaRawReadCount -> 10)) + builder.addFrag(start=10, attrs=Map(ConsensusTags.PerRead.RawReadCount -> 10)) .exists(Umis.isConsensusRead) shouldBe true + builder.addFrag( + start=10, + attrs=Map(ConsensusTags.PerRead.AbRawReadCount -> 10, ConsensusTags.PerRead.BaRawReadCount -> 10) + ).exists(Umis.isConsensusRead) shouldBe true } }