Swich to the system min and max functions and remove the version from obiutils

Former-commit-id: 8c4558921b0d0c266b070f16e83813de6e6d4a0f
This commit is contained in:
Eric Coissac
2024-05-30 08:27:24 +02:00
parent 98b3bc2a8c
commit dd9307a4cd
12 changed files with 58 additions and 145 deletions

View File

@ -4,13 +4,10 @@ import (
"math"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
)
type Table4mer [256]uint16
func Count4Mer(seq *obiseq.BioSequence, buffer *[]byte, counts *Table4mer) *Table4mer {
iternal_buffer := Encode4mer(seq, buffer) // The slice of 4-mer codes
@ -33,7 +30,7 @@ func Count4Mer(seq *obiseq.BioSequence, buffer *[]byte, counts *Table4mer) *Tabl
func Common4Mer(count1, count2 *Table4mer) int {
sum := 0
for i := 0; i < 256; i++ {
sum += int(obiutils.Min((*count1)[i], (*count2)[i]))
sum += int(min((*count1)[i], (*count2)[i]))
}
return sum
}
@ -49,7 +46,7 @@ func Sum4Mer(count *Table4mer) int {
func LCS4MerBounds(count1, count2 *Table4mer) (int, int) {
s1 := Sum4Mer(count1)
s2 := Sum4Mer(count2)
smin := obiutils.Min(s1, s2)
smin := min(s1, s2)
cw := Common4Mer(count1, count2)
@ -66,7 +63,7 @@ func LCS4MerBounds(count1, count2 *Table4mer) (int, int) {
func Error4MerBounds(count1, count2 *Table4mer) (int, int) {
s1 := Sum4Mer(count1)
s2 := Sum4Mer(count2)
smax := obiutils.Max(s1, s2)
smax := max(s1, s2)
cw := Common4Mer(count1, count2)

View File

@ -10,7 +10,6 @@ import (
"slices"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
log "github.com/sirupsen/logrus"
)
@ -472,7 +471,7 @@ func (graph *DeBruijnGraph) Gml() string {
n := graph.Nexts(idx)
for _, dst := range n {
dstid := nodeidx[dst]
weight := obiutils.Min(graph.Weight(dst), weight)
weight := min(graph.Weight(dst), weight)
label := decode[dst&3]
buffer.WriteString(
fmt.Sprintf(`edge [ source "%d"