diff --git a/pkg/obialign/alignment.go b/pkg/obialign/alignment.go index 81af36f..ed5a392 100644 --- a/pkg/obialign/alignment.go +++ b/pkg/obialign/alignment.go @@ -10,6 +10,7 @@ import ( "strings" "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq" + "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils" ) // // A pool of byte slices. @@ -158,19 +159,29 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis match := 0 + left := obiutils.Abs(path[0]) + right := 0 + if path[len(path)-1] == 0 { + right = path[len(path)-2] + } + + right = obiutils.Abs(right) + + right = len(*bufferQA) - right + + // log.Warnf("BuildQualityConsensus: left = %d right = %d\n", left, right) + for i, qA = range *bufferQA { nA := (*bufferSA)[i] nB := (*bufferSB)[i] qB = (*bufferQB)[i] - if statOnMismatch && nA != nB { + if statOnMismatch && i >= left && i < right && 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 } diff --git a/pkg/obialign/pairedendalign.go b/pkg/obialign/pairedendalign.go index e5c12cb..637454e 100644 --- a/pkg/obialign/pairedendalign.go +++ b/pkg/obialign/pairedendalign.go @@ -625,6 +625,8 @@ func PEAlign(seqA, seqB *obiseq.BioSequence, &arena.pointer.scoreMatrix, &arena.pointer.pathMatrix) + score = scoreR + path = _Backtracking(arena.pointer.pathMatrix, len(rawSeqA), len(rawSeqB), &(arena.pointer.path)) @@ -641,6 +643,7 @@ func PEAlign(seqA, seqB *obiseq.BioSequence, len(rawSeqA), len(rawSeqB), &(arena.pointer.path)) isLeftAlign = true + score = scoreL } } diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index cc30c40..d4ff1b6 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 = "d4209b4" +var _Commit = "fb6f857" var _Version = "Release 4.2.0" // Version returns the version of the obitools package. diff --git a/pkg/obitools/obipairing/pairing.go b/pkg/obitools/obipairing/pairing.go index 0614f29..45fc809 100644 --- a/pkg/obitools/obipairing/pairing.go +++ b/pkg/obitools/obipairing/pairing.go @@ -129,6 +129,7 @@ func AssemblePESequences(seqA, seqB *obiseq.BioSequence, } lcons := cons.Len() aliLength := lcons - _Abs(left) - _Abs(right) + identity := float64(match) / float64(aliLength) if aliLength == 0 { identity = 0