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,7 +4,7 @@ import (
"fmt"
"strconv"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiutils"
log "github.com/sirupsen/logrus"
)
@@ -17,6 +17,7 @@ func (s *BioSequence) HasAttribute(key string) bool {
return ok
}
// A method that returns the value of the key in the annotation map.
func (s *BioSequence) GetAttribute(key string) (interface{}, bool) {
var val interface{}
@@ -43,7 +44,7 @@ func (s *BioSequence) GetIntAttribute(key string) (int, bool) {
v, ok := s.GetAttribute(key)
if ok {
val, err = goutils.InterfaceToInt(v)
val, err = obiutils.InterfaceToInt(v)
ok = err == nil
}
@@ -52,15 +53,15 @@ func (s *BioSequence) GetIntAttribute(key string) (int, bool) {
// Deleting the key from the annotation map.
func (s *BioSequence) DeleteAttribute(key string) {
delete(s.Annotations(),key)
delete(s.Annotations(), key)
}
// Renaming the key in the annotation map.
func (s *BioSequence) RenameAttribute(newName, oldName string) {
val,ok := s.GetAttribute(oldName)
val, ok := s.GetAttribute(oldName)
if (ok) {
s.SetAttribute(newName,val)
if ok {
s.SetAttribute(newName, val)
s.DeleteAttribute(oldName)
}
}
@@ -73,14 +74,13 @@ func (s *BioSequence) GetNumericAttribute(key string) (float64, bool) {
v, ok := s.GetAttribute(key)
if ok {
val, err = goutils.InterfaceToFloat64(v)
val, err = obiutils.InterfaceToFloat64(v)
ok = err == nil
}
return val, ok
}
// A method that returns the value of the key in the annotation map.
func (s *BioSequence) GetStringAttribute(key string) (string, bool) {
var val string
@@ -101,7 +101,7 @@ func (s *BioSequence) GetBoolAttribute(key string) (bool, bool) {
v, ok := s.GetAttribute(key)
if ok {
val, err = goutils.InterfaceToBool(v)
val, err = obiutils.InterfaceToBool(v)
ok = err == nil
}
@@ -115,7 +115,7 @@ func (s *BioSequence) GetIntMap(key string) (map[string]int, bool) {
v, ok := s.GetAttribute(key)
if ok {
val, err = goutils.InterfaceToIntMap(v)
val, err = obiutils.InterfaceToIntMap(v)
ok = err == nil
}
@@ -139,7 +139,6 @@ func (s *BioSequence) SetCount(count int) {
annot["count"] = count
}
// Returning the taxid of the sequence.
func (s *BioSequence) Taxid() int {
taxid, ok := s.GetIntAttribute("taxid")
@@ -157,7 +156,6 @@ func (s *BioSequence) SetTaxid(taxid int) {
annot["taxid"] = taxid
}
func (s *BioSequence) OBITagRefIndex() map[int]string {
var val map[int]string
@@ -179,7 +177,7 @@ func (s *BioSequence) OBITagRefIndex() map[int]string {
log.Panicln(err)
}
val[score], err = goutils.InterfaceToString(v)
val[score], err = obiutils.InterfaceToString(v)
if err != nil {
log.Panicln(err)
}