From fb6f857d8c25c7ce7650c61a108c15745bc70aa3 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Sun, 23 Feb 2025 15:16:31 +0100 Subject: [PATCH] Update the computation of the consensus quality score --- pkg/obialign/alignment.go | 23 +++++++++++++++-------- pkg/obioptions/version.go | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pkg/obialign/alignment.go b/pkg/obialign/alignment.go index 48a482e..81af36f 100644 --- a/pkg/obialign/alignment.go +++ b/pkg/obialign/alignment.go @@ -163,7 +163,15 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis nB := (*bufferSB)[i] qB = (*bufferQB)[i] - if statOnMismatch && nA != nB && nA != ' ' && nB != ' ' { + if statOnMismatch && nA != nB { + if nA == ' ' { + nA = '-' + qA = 0 + } + if nB == ' ' { + nB = '-' + qB = 0 + } mismatches[strings.ToUpper(fmt.Sprintf("(%c:%02d)->(%c:%02d)", nA, qA, nB, qB))] = i + 1 } @@ -183,13 +191,12 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis q := qA + qB - if qA > 0 && qB > 0 { - if nA != nB { - q = qM - byte(math.Log10(1-math.Pow(10, -float64(qm)/30))*10+0.5) - } - if nA == nB { - match++ - } + if nA != nB { + q = qM - byte(math.Log10(1-math.Pow(10, -float64(qm)/40))*10+0.5) + } + + if nA == nB { + match++ } if q > 90 { diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index 0d2dd9a..cc30c40 100644 --- a/pkg/obioptions/version.go +++ b/pkg/obioptions/version.go @@ -8,7 +8,7 @@ import ( // corresponds to the last commit, and not the one when the file will be // commited -var _Commit = "4588bf8" +var _Commit = "d4209b4" var _Version = "Release 4.2.0" // Version returns the version of the obitools package.