refactoring of the file chunck writing

This commit is contained in:
Eric Coissac
2024-11-29 18:15:03 +01:00
parent 69ef1758a2
commit 00b0edc15a
16 changed files with 71 additions and 98 deletions

View File

@@ -1,6 +1,7 @@
package obicsv
import (
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
"github.com/DavidGamba/go-getoptions"
@@ -66,6 +67,7 @@ func CSVOptionSet(options *getoptions.GetOpt) {
func OptionSet(options *getoptions.GetOpt) {
obiconvert.InputOptionSet(options)
obiconvert.OutputModeOptionSet(options)
obioptions.LoadTaxonomyOptionSet(options, false, false)
CSVOptionSet(options)
}

View File

@@ -121,7 +121,7 @@ func NewCSVSequenceIterator(iter obiiter.IBioSequence, options ...WithOption) *I
if len(batch.Slice()) == 0 {
log.Panicf("first batch should not be empty")
}
auto_slot := batch.Slice().AttributeKeys(true).Members()
auto_slot := batch.Slice().AttributeKeys(true, true).Members()
slices.Sort(auto_slot)
CSVKeys(auto_slot)(opt)
iter.PushBack()

View File

@@ -55,7 +55,7 @@ func WriteCSV(iterator *ICSVRecord,
nwriters := opt.ParallelWorkers()
chunkchan := obiformats.WriteSeqFileChunk(file, opt.CloseFile())
chunkchan := obiformats.WriteFileChunk(file, opt.CloseFile())
newIter.Add(nwriters)
@@ -72,7 +72,7 @@ func WriteCSV(iterator *ICSVRecord,
log.Debugf("Formating CSV chunk %d", batch.Order())
ss := obiformats.SeqFileChunk{
ss := obiformats.FileChunk{
Source: batch.Source(),
Raw: FormatCVSBatch(
batch,