diff --git a/pkg/obiformats/fastseq_write_fasta.go b/pkg/obiformats/fastseq_write_fasta.go index 0c36d3d..1e6e079 100644 --- a/pkg/obiformats/fastseq_write_fasta.go +++ b/pkg/obiformats/fastseq_write_fasta.go @@ -69,6 +69,7 @@ func WriteFasta(iterator obiiter.IBioSequence, options ...WithOption) (obiiter.IBioSequence, error) { opt := MakeOptions(options) + iterator = iterator.Rebatch(10000) file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile()) newIter := obiiter.MakeIBioSequence() diff --git a/pkg/obiformats/fastseq_write_fastq.go b/pkg/obiformats/fastseq_write_fastq.go index f8e3a39..e987987 100644 --- a/pkg/obiformats/fastseq_write_fastq.go +++ b/pkg/obiformats/fastseq_write_fastq.go @@ -56,6 +56,9 @@ type FileChunck struct { func WriteFastq(iterator obiiter.IBioSequence, file io.WriteCloser, options ...WithOption) (obiiter.IBioSequence, error) { + + iterator = iterator.Rebatch(10000) + opt := MakeOptions(options) file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile()) diff --git a/pkg/obiformats/universal_write.go b/pkg/obiformats/universal_write.go index c96e673..f286521 100644 --- a/pkg/obiformats/universal_write.go +++ b/pkg/obiformats/universal_write.go @@ -14,8 +14,6 @@ func WriteSequence(iterator obiiter.IBioSequence, file io.WriteCloser, options ...WithOption) (obiiter.IBioSequence, error) { - iterator = iterator.Rebatch(1000) - ok := iterator.Next() if ok { diff --git a/pkg/obiiter/batchiterator.go b/pkg/obiiter/batchiterator.go index 8782b87..15705aa 100644 --- a/pkg/obiiter/batchiterator.go +++ b/pkg/obiiter/batchiterator.go @@ -235,9 +235,9 @@ func (iterator IBioSequence) Push(batch BioSequenceBatch) { if batch.IsNil() { log.Panicln("A Nil batch is pushed on the channel") } - if batch.Len() == 0 { - log.Panicln("An empty batch is pushed on the channel") - } + // if batch.Len() == 0 { + // log.Panicln("An empty batch is pushed on the channel") + // } iterator.pointer.channel <- batch } diff --git a/pkg/obitools/obiconvert/sequence_reader.go b/pkg/obitools/obiconvert/sequence_reader.go index 0df6b4b..b9e2d1e 100644 --- a/pkg/obitools/obiconvert/sequence_reader.go +++ b/pkg/obitools/obiconvert/sequence_reader.go @@ -138,7 +138,7 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) { } iterator = obiformats.ReadSequencesBatchFromFiles( - filenames, + list_of_files, reader, nreader, opts..., @@ -162,34 +162,11 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) { } - // list_of_files = list_of_files[1:] - // others := make([]obiiter.IBioSequenceBatch, 0, len(list_of_files)) - - // for _, fn := range list_of_files { - // r, err := reader(fn, opts...) - // if err != nil { - // return obiiter.NilIBioSequenceBatch, err - // } - // others = append(others, r) - // } - - // if len(others) > 0 { - // if CLINoInputOrder() { - // iterator = iterator.Pool(others...) - // } else { - // iterator = iterator.Concat(others...) - // } - // } - } - // if SequencesToSkip() > 0 { - // iterator = iterator.Skip(SequencesToSkip()) - // } - - // if AnalyzeOnly() > 0 { - // iterator = iterator.Head(AnalyzeOnly()) - // } + if CLIProgressBar() { + iterator = iterator.Speed() + } return iterator, nil } diff --git a/pkg/obitools/obiconvert/sequence_writer.go b/pkg/obitools/obiconvert/sequence_writer.go index d5ef634..e91e5a8 100644 --- a/pkg/obitools/obiconvert/sequence_writer.go +++ b/pkg/obitools/obiconvert/sequence_writer.go @@ -35,9 +35,6 @@ func BuildPairedFileNames(filename string) (string, string) { func CLIWriteBioSequences(iterator obiiter.IBioSequence, terminalAction bool, filenames ...string) (obiiter.IBioSequence, error) { - if CLIProgressBar() { - iterator = iterator.Speed() - } var newIter obiiter.IBioSequence opts := make([]obiformats.WithOption, 0, 10)