mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a bug in comparison of attibutes during sequence annotation merging
This commit is contained in:
@ -2,6 +2,7 @@ package obiseq
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
|
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
|
||||||
@ -154,7 +155,19 @@ func (sequence *BioSequence) Merge(tomerge *BioSequence, na string, inplace bool
|
|||||||
for k, va := range annotations {
|
for k, va := range annotations {
|
||||||
if !strings.HasPrefix(k, "merged_") {
|
if !strings.HasPrefix(k, "merged_") {
|
||||||
vm, ok := ma[k]
|
vm, ok := ma[k]
|
||||||
if !ok || vm != va {
|
if ok {
|
||||||
|
switch vm := vm.(type) {
|
||||||
|
case int, float64, string, bool:
|
||||||
|
if va != vm {
|
||||||
|
delete(annotations, k)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
if !reflect.DeepEqual(va, vm) {
|
||||||
|
delete(annotations, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
delete(annotations, k)
|
delete(annotations, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +184,9 @@ func (sequence *BioSequence) Merge(tomerge *BioSequence, na string, inplace bool
|
|||||||
return sequence
|
return sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
|
*
|
||||||
|
|
||||||
Merges a set of sequence into a single sequence.
|
Merges a set of sequence into a single sequence.
|
||||||
|
|
||||||
The function assumes that every sequence in the batch is
|
The function assumes that every sequence in the batch is
|
||||||
|
Reference in New Issue
Block a user