mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-10 01:24:41 +00:00
Implement advanced primer search filtering and reference handling
This update introduces new configuration options for pair selection, including multi-match filtering, circularity settings, and reference site validation. It also enhances the search functionality to correctly identify and track repeated sequences and reference locations, improving the accuracy of primer pair identification.
This commit is contained in:
1 parent
c156f11947
commit
57c2517b24
15 files changed
+2041
-9
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package obiprimer
|
||||
|
||||
import "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||
|
||||
// DropRepeatedWords removes the strict words found more than once (on either
|
||||
// strand) in at least one example sequence. It is the first half of the
|
||||
// ecoPrimers -U option (no multi-match).
|
||||
func DropRepeatedWords(words []obikmer.SeqKmerCount) (kept []obikmer.SeqKmerCount, dropped int) {
|
||||
kept = make([]obikmer.SeqKmerCount, 0, len(words))
|
||||
for _, w := range words {
|
||||
if w.Repeated {
|
||||
dropped++
|
||||
continue
|
||||
}
|
||||
kept = append(kept, w)
|
||||
}
|
||||
return kept, dropped
|
||||
}
|
||||
|
||||
// DropMultiMatch removes the words having two or more approximate occurrences,
|
||||
// both strands counted, in at least one sequence of the corpus, whatever its
|
||||
// role. It is the second half of the ecoPrimers -U option: the primers that
|
||||
// can anneal at several places of a sequence are discarded.
|
||||
func DropMultiMatch(wm []WordMatches) (kept []WordMatches, dropped int) {
|
||||
kept = make([]WordMatches, 0, len(wm))
|
||||
for _, w := range wm {
|
||||
multi := false
|
||||
for i := 1; i < len(w.Matches); i++ {
|
||||
if w.Matches[i].Seq == w.Matches[i-1].Seq {
|
||||
multi = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if multi {
|
||||
dropped++
|
||||
continue
|
||||
}
|
||||
kept = append(kept, w)
|
||||
}
|
||||
return kept, dropped
|
||||
}
|
||||
Reference in new issue
Block a user