Update the computation of the consensus quality score

This commit is contained in:
Eric Coissac
2025-02-23 15:16:31 +01:00
parent d4209b4549
commit fb6f857d8c
2 changed files with 16 additions and 9 deletions

View File

@ -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 {

View File

@ -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.