mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-09 01:00:26 +00:00
Big change iin the data model, and a first version of obiuniq
This commit is contained in:
@@ -14,8 +14,10 @@ var _BioSequenceByteSlicePool = sync.Pool{
|
||||
}
|
||||
|
||||
func RecycleSlice(s *[]byte) {
|
||||
*s = (*s)[:0]
|
||||
_BioSequenceByteSlicePool.Put(s)
|
||||
if s != nil && *s != nil {
|
||||
*s = (*s)[:0]
|
||||
_BioSequenceByteSlicePool.Put(s)
|
||||
}
|
||||
}
|
||||
|
||||
func GetSlice(values ...byte) []byte {
|
||||
@@ -30,7 +32,7 @@ func GetSlice(values ...byte) []byte {
|
||||
|
||||
var BioSequenceAnnotationPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
bs := make(Annotation, 100)
|
||||
bs := make(Annotation, 5)
|
||||
return &bs
|
||||
},
|
||||
}
|
||||
@@ -40,12 +42,16 @@ func RecycleAnnotation(a *Annotation) {
|
||||
for k := range *a {
|
||||
delete(*a, k)
|
||||
}
|
||||
BioSequenceAnnotationPool.Put(&(a))
|
||||
BioSequenceAnnotationPool.Put(a)
|
||||
}
|
||||
}
|
||||
|
||||
func GetAnnotation(values ...Annotation) Annotation {
|
||||
a := *(BioSequenceAnnotationPool.Get().(*Annotation))
|
||||
a := Annotation(nil)
|
||||
|
||||
for a == nil {
|
||||
a = *(BioSequenceAnnotationPool.Get().(*Annotation))
|
||||
}
|
||||
|
||||
if len(values) > 0 {
|
||||
goutils.CopyMap(a, values[0])
|
||||
@@ -53,58 +59,3 @@ func GetAnnotation(values ...Annotation) Annotation {
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
var _BioSequenceSlicePool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
bs := make(BioSequenceSlice, 0, 5000)
|
||||
return &bs
|
||||
},
|
||||
}
|
||||
|
||||
func (s *BioSequenceSlice) Recycle() {
|
||||
*s = (*s)[:0]
|
||||
_BioSequenceSlicePool.Put(s)
|
||||
}
|
||||
|
||||
func GetBioSequenceSlicePtr(values ...BioSequence) *BioSequenceSlice {
|
||||
s := _BioSequenceSlicePool.Get().(*BioSequenceSlice)
|
||||
|
||||
if len(values) > 0 {
|
||||
*s = append(*s, values...)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func GetBioSequenceSlice(values ...BioSequence) BioSequenceSlice {
|
||||
return *GetBioSequenceSlicePtr(values...)
|
||||
}
|
||||
|
||||
// var __bioseq__pool__ = sync.Pool{
|
||||
// New: func() interface{} {
|
||||
// var bs _BioSequence
|
||||
// bs.annotations = make(Annotation, 50)
|
||||
// return &bs
|
||||
// },
|
||||
// }
|
||||
|
||||
// func MakeEmptyBioSequence() BioSequence {
|
||||
// bs := BioSequence{__bioseq__pool__.Get().(*_BioSequence)}
|
||||
// return bs
|
||||
// }
|
||||
|
||||
// func MakeBioSequence(id string,
|
||||
// sequence []byte,
|
||||
// definition string) BioSequence {
|
||||
// bs := MakeEmptyBioSequence()
|
||||
// bs.SetId(id)
|
||||
// bs.Write(sequence)
|
||||
// bs.SetDefinition(definition)
|
||||
// return bs
|
||||
// }
|
||||
|
||||
// func (sequence *BioSequence) Recycle() {
|
||||
// sequence.Reset()
|
||||
// __bioseq__pool__.Put(sequence.sequence)
|
||||
// sequence.sequence = nil
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user