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,7 +4,6 @@ import (
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
log "github.com/sirupsen/logrus"
)
@@ -47,8 +46,8 @@ func CLIPCR(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error) {
frags := obiiter.IFragments(
CLIMaxLength()*1000,
CLIMaxLength()*100,
CLIMaxLength()+obiutils.Max(len(CLIForwardPrimer()),
len(CLIReversePrimer()))+obiutils.Min(len(CLIForwardPrimer()),
CLIMaxLength()+max(len(CLIForwardPrimer()),
len(CLIReversePrimer()))+min(len(CLIForwardPrimer()),
len(CLIReversePrimer()))/2,
100,
obioptions.CLIParallelWorkers(),

View File

@@ -63,7 +63,7 @@ func IndexSequence(seqidx int,
if lca[order] == ancestor {
// nseq[i]++
if mini != -1 {
wordmin = obiutils.Max(sequence.Len(), references[order].Len()) - 3 - 4*mini
wordmin = max(sequence.Len(), references[order].Len()) - 3 - 4*mini
}
if cw[order] < wordmin {
@@ -189,7 +189,7 @@ func IndexReferenceDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
indexed := obiiter.MakeIBioSequence()
go func() {
for i := 0; i < len(references); i += 10 {
limits <- [2]int{i, obiutils.Min(i+10, len(references))}
limits <- [2]int{i, min(i+10, len(references))}
}
close(limits)
}()

View File

@@ -110,7 +110,7 @@ func FindClosests(sequence *obiseq.BioSequence,
d, _, _, _ := obialign.D1Or0(sequence, references[order])
if d >= 0 {
score = d
alilength = obiutils.Max(sequence.Len(), ref.Len())
alilength = max(sequence.Len(), ref.Len())
lcs = alilength - score
}
} else {
@@ -294,8 +294,8 @@ func CLIAssignTaxonomy(iterator obiiter.IBioSequence,
j++
} else {
log.Warnf("Taxid %d is not described in the taxonomy."+
" Sequence %s is discared from the reference database",
seq.Taxid(), seq.Id())
" Sequence %s is discared from the reference database",
seq.Taxid(), seq.Id())
}
}