mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Big change iin the data model, and a first version of obiuniq
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
|
||||
)
|
||||
@@ -19,9 +18,13 @@ func min(x, y int) int {
|
||||
return y
|
||||
}
|
||||
|
||||
func FormatFasta(seq obiseq.BioSequence, formater FormatHeader) string {
|
||||
func FormatFasta(seq *obiseq.BioSequence, formater FormatHeader) string {
|
||||
var fragments strings.Builder
|
||||
|
||||
if seq==nil {
|
||||
log.Panicln("try to format a nil BioSequence")
|
||||
}
|
||||
|
||||
s := seq.Sequence()
|
||||
l := len(s)
|
||||
|
||||
@@ -106,16 +109,8 @@ func WriteFastaBatch(iterator obiseq.IBioSequenceBatch, file io.Writer, options
|
||||
newIter.Add(nwriters)
|
||||
|
||||
go func() {
|
||||
newIter.Wait()
|
||||
for len(chunkchan) > 0 {
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
newIter.WaitAndClose()
|
||||
close(chunkchan)
|
||||
for len(newIter.Channel()) > 0 {
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
close(newIter.Channel())
|
||||
|
||||
}()
|
||||
|
||||
ff := func(iterator obiseq.IBioSequenceBatch) {
|
||||
@@ -125,7 +120,7 @@ func WriteFastaBatch(iterator obiseq.IBioSequenceBatch, file io.Writer, options
|
||||
FormatFastaBatch(batch, header_format),
|
||||
batch.Order(),
|
||||
}
|
||||
newIter.Channel() <- batch
|
||||
newIter.Push(batch)
|
||||
}
|
||||
newIter.Done()
|
||||
}
|
||||
@@ -156,7 +151,7 @@ func WriteFastaBatch(iterator obiseq.IBioSequenceBatch, file io.Writer, options
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if opt.CloseFile() {
|
||||
switch file := file.(type) {
|
||||
case *os.File:
|
||||
|
||||
Reference in New Issue
Block a user