Skip to content

Commit

Permalink
chore: suit review by @tfenne
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed Sep 9, 2024
1 parent 1b0f187 commit df69ce8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private[alignment] object CigarStats {
*/
case class Cigar(elems: IndexedSeq[CigarElem]) extends Iterable[CigarElem] {
// Cache whether or not the Cigar is coalesced already (i.e. has no pair of adjacent elements with the same operator)
private lazy val isCoalesced: Boolean = {
private lazy val isCoalesced: Boolean = elems.length == 1 || {
var itIs = true
var index = 0
while (index < elems.length-1 && itIs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ class DuplexConsensusCaller(override val readNamePrefix: String,
if (consensus.forall(duplexHasMinimumNumberOfReads)) {
consensus
} else {
// Even though we had enough reads going into consensus calling, we can
// lose some in the process (e.g. to CIGAR filtering), and end up with
// consensus reads that will than fail the min-reads check
rejectRecords(groups.flatten, FilterMinReads)
Nil
}
Expand All @@ -221,9 +224,8 @@ class DuplexConsensusCaller(override val readNamePrefix: String,
this.minTotalReads <= numXy + numYx && this.minXyReads <= numXy && this.minYxReads <= numYx
}

/** Returns true if there enough are enough reads composing the consensus according to the minReads option. */
/** Returns true if there are enough reads composing the consensus according to the minReads option. */
private def duplexHasMinimumNumberOfReads(consensus: SamRecord): Boolean = {
if (!Umis.isFgbioDuplexConsensus(consensus)) throw new IllegalArgumentException(s"Record is not a duplex consensus: $consensus")
val (numXy: Int, numYx: Int) = {
val numAb = consensus[Int](ConsensusTags.PerRead.AbRawReadCount)
val numBa = consensus[Int](ConsensusTags.PerRead.BaRawReadCount)
Expand Down

0 comments on commit df69ce8

Please sign in to comment.