rename goutils to obiutils

Former-commit-id: 2147f53db972bba571dfdae30c51b62d3e69cec5
This commit is contained in:
2023-03-24 10:25:12 +07:00
parent 42aae88520
commit d5e84ec676
33 changed files with 245 additions and 156 deletions

View File

@@ -4,10 +4,10 @@ import (
"fmt"
"os"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obioptions"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
"github.com/schollz/progressbar/v3"
log "github.com/sirupsen/logrus"
)
@@ -120,7 +120,7 @@ func HeadCount(sequence *obiseq.BioSequence) int {
value := 0
if ok {
value, err = goutils.InterfaceToInt(value)
value, err = obiutils.InterfaceToInt(value)
if err != nil {
log.Panic("obiclean_headcount attribute of sequence %s must be an integer value not : %v", sequence.Id(), ivalue)
}
@@ -136,7 +136,7 @@ func InternalCount(sequence *obiseq.BioSequence) int {
value := 0
if ok {
value, err = goutils.InterfaceToInt(value)
value, err = obiutils.InterfaceToInt(value)
if err != nil {
log.Panic("obiclean_internalcount attribute of sequence %s must be an integer value not : %v", sequence.Id(), ivalue)
}
@@ -152,7 +152,7 @@ func SingletonCount(sequence *obiseq.BioSequence) int {
value := 0
if ok {
value, err = goutils.InterfaceToInt(value)
value, err = obiutils.InterfaceToInt(value)
if err != nil {
log.Panic("obiclean_samplecount attribute of sequence %s must be an integer value not : %v", sequence.Id(), ivalue)
}
@@ -271,7 +271,7 @@ func Weight(sequence *obiseq.BioSequence) map[string]int {
case map[string]interface{}:
weight = make(map[string]int)
for k, v := range iobistatus {
weight[k], err = goutils.InterfaceToInt(v)
weight[k], err = obiutils.InterfaceToInt(v)
if err != nil {
log.Panicf("Weight value %v cannnot be casted to an integer value\n", v)
}

View File

@@ -1,8 +1,8 @@
package obicsv
import (
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
"github.com/DavidGamba/go-getoptions"
)
@@ -103,18 +103,18 @@ func CLIToBeKeptAttributes() []string {
_keepOnly = append(_keepOnly, _softAttributes["obipairing"]...)
}
if i := goutils.LookFor(_keepOnly, "count"); i >= 0 {
_keepOnly = goutils.RemoveIndex(_keepOnly, i)
if i := obiutils.LookFor(_keepOnly, "count"); i >= 0 {
_keepOnly = obiutils.RemoveIndex(_keepOnly, i)
_outputCount = true
}
if i := goutils.LookFor(_keepOnly, "taxid"); i >= 0 {
_keepOnly = goutils.RemoveIndex(_keepOnly, i)
if i := obiutils.LookFor(_keepOnly, "taxid"); i >= 0 {
_keepOnly = obiutils.RemoveIndex(_keepOnly, i)
_outputTaxon = true
}
if i := goutils.LookFor(_keepOnly, "scientific_name"); i >= 0 {
_keepOnly = goutils.RemoveIndex(_keepOnly, i)
if i := obiutils.LookFor(_keepOnly, "scientific_name"); i >= 0 {
_keepOnly = obiutils.RemoveIndex(_keepOnly, i)
_outputTaxon = true
}

View File

@@ -5,11 +5,11 @@ import (
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiformats/ncbitaxdump"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitax"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
"github.com/DavidGamba/go-getoptions"
)
@@ -345,7 +345,7 @@ func CLIIdPatternPredicate() obiseq.SequencePredicate {
func CLIIdListPredicate() obiseq.SequencePredicate {
if _IdList != "" {
ids, err := goutils.ReadLines(_IdList)
ids, err := obiutils.ReadLines(_IdList)
if err != nil {
log.Fatalf("cannot read the id file %s : %v", _IdList, err)

View File

@@ -5,7 +5,6 @@ import (
"log"
"os"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obialign"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obikmer"
@@ -13,6 +12,7 @@ import (
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitax"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obifind"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
"github.com/schollz/progressbar/v3"
)
@@ -38,7 +38,7 @@ func IndexSequence(seqidx int,
// log.Println("Redone : ",r,"/",t,"(",w,")")
o := goutils.IntOrder(score)
o := obiutils.IntOrder(score)
current_taxid, err := taxo.Taxon(references[o[0]].Taxid())
current_score := score[o[0]]
@@ -121,7 +121,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, goutils.MinInt(i+10, len(references))}
limits <- [2]int{i, obiutils.MinInt(i+10, len(references))}
}
close(limits)
}()

View File

@@ -6,7 +6,6 @@ import (
"strconv"
"strings"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obialign"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obikmer"
@@ -15,6 +14,7 @@ import (
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitax"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obifind"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obirefidx"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
)
func FindClosests(sequence *obiseq.BioSequence,
@@ -31,7 +31,7 @@ func FindClosests(sequence *obiseq.BioSequence,
cw[i] = obikmer.Common4Mer(seqwords, ref)
}
o := goutils.ReverseIntOrder(cw)
o := obiutils.ReverseIntOrder(cw)
// mcw := 100000
// for _, i := range o {
@@ -57,11 +57,11 @@ func FindClosests(sequence *obiseq.BioSequence,
for i, j := range o {
ref := references[j]
lmin, lmax := goutils.MinMaxInt(sequence.Len(), ref.Len())
lmin, lmax := obiutils.MinMaxInt(sequence.Len(), ref.Len())
atMost := lmax - lmin + int(math.Ceil(float64(lmin-3-cw[j])/4.0)) - 2
if i == 0 {
maxe = goutils.MaxInt(sequence.Len(), ref.Len())
maxe = obiutils.MaxInt(sequence.Len(), ref.Len())
}
// log.Println(sequence.Id(),cw[j], maxe)