few small correction

Former-commit-id: 9319387ef5379b66e008233dbd7b6ea60b5d3b1e
This commit is contained in:
2024-03-06 12:52:22 -03:00
parent 7bd073ccd4
commit b4afd784dc
3 changed files with 30 additions and 7 deletions

View File

@ -1,7 +1,7 @@
package obiiter package obiiter
import ( import (
"log" log "github.com/sirupsen/logrus"
) )
func (b BioSequenceBatch) IsPaired() bool { func (b BioSequenceBatch) IsPaired() bool {

View File

@ -182,6 +182,11 @@ func (marker *Marker) Match(sequence *obiseq.BioSequence) *DemultiplexMatch {
return &m return &m
} }
//
// At this point the forward primer didn't match.
// We try now with the reverse primer
//
start, end, nerr, matched = marker.reverse.BestMatch(aseq, marker.taglength, -1) start, end, nerr, matched = marker.reverse.BestMatch(aseq, marker.taglength, -1)
if matched { if matched {

View File

@ -124,7 +124,7 @@ func SplitPattern(sequence *obiseq.BioSequence,
matches := LocatePatterns(sequence, patterns) matches := LocatePatterns(sequence, patterns)
from := Pattern_match{ from := Pattern_match{
name: "5extremity", name: "extremity",
pattern: "", pattern: "",
match: "", match: "",
begin: 0, begin: 0,
@ -169,10 +169,19 @@ func SplitPattern(sequence *obiseq.BioSequence,
if from.name == to.name { if from.name == to.name {
sub.SetAttribute("obisplit_group", from.name) sub.SetAttribute("obisplit_group", from.name)
} else { } else {
sub.SetAttribute("obisplit_group", fmt.Sprintf("%s-%s", from.name, to.name)) fname := from.name
tname := to.name
if tname == "extremity" {
fname, tname = tname, fname
} else {
if tname < fname && fname != "extremity" {
fname, tname = tname, fname
}
}
sub.SetAttribute("obisplit_group", fmt.Sprintf("%s-%s", fname, tname))
} }
sub.SetAttribute("obisplit_location", fmt.Sprintf("%d..%d", start, end)) sub.SetAttribute("obisplit_location", fmt.Sprintf("%d..%d", start+1, end))
sub.SetAttribute("obisplit_right_error", to.nerrors) sub.SetAttribute("obisplit_right_error", to.nerrors)
sub.SetAttribute("obisplit_left_error", from.nerrors) sub.SetAttribute("obisplit_left_error", from.nerrors)
@ -191,7 +200,7 @@ func SplitPattern(sequence *obiseq.BioSequence,
if from.end < sequence.Len() { if from.end < sequence.Len() {
to := Pattern_match{ to := Pattern_match{
name: "3extremity", name: "extremity",
pattern: "", pattern: "",
match: "", match: "",
begin: sequence.Len(), begin: sequence.Len(),
@ -218,9 +227,18 @@ func SplitPattern(sequence *obiseq.BioSequence,
if from.name == to.name { if from.name == to.name {
sub.SetAttribute("obisplit_group", from.name) sub.SetAttribute("obisplit_group", from.name)
} else { } else {
sub.SetAttribute("obisplit_group", fmt.Sprintf("%s-%s", from.name, to.name)) fname := from.name
tname := to.name
if tname == "extremity" {
fname, tname = tname, fname
} else {
if tname < fname && fname != "extremity" {
fname, tname = tname, fname
}
}
sub.SetAttribute("obisplit_group", fmt.Sprintf("%s-%s", fname, tname))
} }
sub.SetAttribute("obisplit_location", fmt.Sprintf("%d..%d", start, end)) sub.SetAttribute("obisplit_location", fmt.Sprintf("%d..%d", start+1, end))
sub.SetAttribute("obisplit_right_error", to.nerrors) sub.SetAttribute("obisplit_right_error", to.nerrors)
sub.SetAttribute("obisplit_left_error", from.nerrors) sub.SetAttribute("obisplit_left_error", from.nerrors)