From 13d610aff74d3aa8ff22acd2459c1b06e736d46e Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 24 Feb 2025 15:25:45 +0100 Subject: [PATCH] Changes to be committed: modified: pkg/obioptions/version.go modified: pkg/obitools/obiclean/chimera.go --- pkg/obioptions/version.go | 2 +- pkg/obitools/obiclean/chimera.go | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index 01ba7b8..99f162c 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 = "51b3e83" +var _Commit = "db284f1" var _Version = "Release 4.2.0" // Version returns the version of the obitools package. diff --git a/pkg/obitools/obiclean/chimera.go b/pkg/obitools/obiclean/chimera.go index 7aacbc7..04545f7 100644 --- a/pkg/obitools/obiclean/chimera.go +++ b/pkg/obitools/obiclean/chimera.go @@ -35,15 +35,17 @@ func commonSuffix(a, b *obiseq.BioSequence) int { j := b.Len() - 1 if i < 0 || j < 0 { - return -1 + return 0 } as := a.Sequence() bs := b.Sequence() + l := 0 for i >= 0 && j >= 0 && as[i] == bs[j] { i-- j-- + l++ } if obiutils.UnsafeString(as[i+1:]) != obiutils.UnsafeString(bs[j+1:]) { @@ -51,7 +53,7 @@ func commonSuffix(a, b *obiseq.BioSequence) int { } // log.Warnf("i: %d, j: %d (%s)", i, j, as[i+1:]) - return i + 1 + return l } func AnnotateChimera(samples map[string]*[]*seqPCR) { @@ -97,16 +99,11 @@ func AnnotateChimera(samples map[string]*[]*seqPCR) { } } + ls := s.Sequence.Len() + for k := i + 1; k < lp; k++ { for l := i + 1; l < lp; l++ { - if k != l && - cs[k] >= 0 && - obiutils.Abs(cp[k]-cs[l]) == 0 && - obiutils.UnsafeString(pcrs[k].Sequence.Sequence()[:cp[k]]) != - obiutils.UnsafeString(pcrs[l].Sequence.Sequence()[:cp[k]]) && - obiutils.UnsafeString(pcrs[k].Sequence.Sequence()[cp[k]:]) != - obiutils.UnsafeString(pcrs[l].Sequence.Sequence()[cp[k]:]) { - + if k != l && cp[k]+cs[l] == ls { cm[sample] = fmt.Sprintf("{%s}/{%s}@(%d)", pcrs[k].Sequence.Id(), pcrs[l].Sequence.Id(),