Files
obitools4/pkg/obiseq/speed.go

40 lines
643 B
Go
Raw Normal View History

2022-02-18 22:53:09 +01:00
package obiseq
import (
"os"
"github.com/schollz/progressbar/v3"
)
func (iterator IBioSequenceBatch) Speed() IBioSequenceBatch {
2022-02-18 22:53:09 +01:00
newIter := MakeIBioSequenceBatch()
newIter.Add(1)
go func() {
newIter.WaitAndClose()
}()
bar := progressbar.NewOptions(
-1,
progressbar.OptionSetWriter(os.Stderr),
progressbar.OptionSetWidth(15),
progressbar.OptionShowCount(),
progressbar.OptionShowIts(),
progressbar.OptionSetDescription("[Sequence Processing]"))
go func() {
for iterator.Next() {
batch := iterator.Get()
l := batch.Length()
newIter.Push(batch)
bar.Add(l)
}
newIter.Done()
}()
2022-02-18 22:53:09 +01:00
return newIter
}