mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Remove single sequence ierators. Only batch iterators persist
This commit is contained in:
@@ -175,9 +175,3 @@ func ReadBioSequencesBatch(filenames ...string) (obiiter.IBioSequenceBatch, erro
|
||||
|
||||
return iterator, nil
|
||||
}
|
||||
|
||||
func ReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
|
||||
ib, err := ReadBioSequencesBatch(filenames...)
|
||||
return ib.SortBatches().IBioSequence(), err
|
||||
|
||||
}
|
||||
|
||||
@@ -8,63 +8,6 @@ import (
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obioptions"
|
||||
)
|
||||
|
||||
func WriteBioSequences(iterator obiiter.IBioSequence, filenames ...string) error {
|
||||
|
||||
opts := make([]obiformats.WithOption, 0, 10)
|
||||
|
||||
switch CLIOutputFastHeaderFormat() {
|
||||
case "json":
|
||||
log.Println("On output use JSON headers")
|
||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||
case "obi":
|
||||
log.Println("On output use OBI headers")
|
||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqOBIHeader))
|
||||
default:
|
||||
log.Println("On output use JSON headers")
|
||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||
}
|
||||
|
||||
nworkers := obioptions.CLIParallelWorkers() / 4
|
||||
if nworkers < 2 {
|
||||
nworkers = 2
|
||||
}
|
||||
|
||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
||||
opts = append(opts, obiformats.OptionsBufferSize(obioptions.CLIBufferSize()))
|
||||
opts = append(opts, obiformats.OptionsBatchSize(obioptions.CLIBatchSize()))
|
||||
|
||||
opts = append(opts, obiformats.OptionsQualityShift(CLIOutputQualityShift()))
|
||||
|
||||
var err error
|
||||
|
||||
if len(filenames) == 0 {
|
||||
switch CLIOutputFormat() {
|
||||
case "fastq":
|
||||
err = obiformats.WriteFastqToStdout(iterator, opts...)
|
||||
case "fasta":
|
||||
err = obiformats.WriteFastaToStdout(iterator, opts...)
|
||||
default:
|
||||
err = obiformats.WriteSequencesToStdout(iterator, opts...)
|
||||
}
|
||||
} else {
|
||||
switch CLIOutputFormat() {
|
||||
case "fastq":
|
||||
err = obiformats.WriteFastqToFile(iterator, filenames[0], opts...)
|
||||
case "fasta":
|
||||
err = obiformats.WriteFastaToFile(iterator, filenames[0], opts...)
|
||||
default:
|
||||
err = obiformats.WriteSequencesToFile(iterator, filenames[0], opts...)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Write file error: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func WriteBioSequencesBatch(iterator obiiter.IBioSequenceBatch,
|
||||
terminalAction bool, filenames ...string) (obiiter.IBioSequenceBatch, error) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user