mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch the empty batch bug
Former-commit-id: fcee04b58f2c4a0bf2c27792f991391c0b6ce78e
This commit is contained in:
@ -69,6 +69,7 @@ func WriteFasta(iterator obiiter.IBioSequence,
|
|||||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
|
|
||||||
|
iterator = iterator.Rebatch(10000)
|
||||||
file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
||||||
|
|
||||||
newIter := obiiter.MakeIBioSequence()
|
newIter := obiiter.MakeIBioSequence()
|
||||||
|
@ -56,6 +56,9 @@ type FileChunck struct {
|
|||||||
func WriteFastq(iterator obiiter.IBioSequence,
|
func WriteFastq(iterator obiiter.IBioSequence,
|
||||||
file io.WriteCloser,
|
file io.WriteCloser,
|
||||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||||
|
|
||||||
|
iterator = iterator.Rebatch(10000)
|
||||||
|
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
|
|
||||||
file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
file, _ = goutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
||||||
|
@ -14,8 +14,6 @@ func WriteSequence(iterator obiiter.IBioSequence,
|
|||||||
file io.WriteCloser,
|
file io.WriteCloser,
|
||||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||||
|
|
||||||
iterator = iterator.Rebatch(1000)
|
|
||||||
|
|
||||||
ok := iterator.Next()
|
ok := iterator.Next()
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -235,9 +235,9 @@ func (iterator IBioSequence) Push(batch BioSequenceBatch) {
|
|||||||
if batch.IsNil() {
|
if batch.IsNil() {
|
||||||
log.Panicln("A Nil batch is pushed on the channel")
|
log.Panicln("A Nil batch is pushed on the channel")
|
||||||
}
|
}
|
||||||
if batch.Len() == 0 {
|
// if batch.Len() == 0 {
|
||||||
log.Panicln("An empty batch is pushed on the channel")
|
// log.Panicln("An empty batch is pushed on the channel")
|
||||||
}
|
// }
|
||||||
|
|
||||||
iterator.pointer.channel <- batch
|
iterator.pointer.channel <- batch
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
iterator = obiformats.ReadSequencesBatchFromFiles(
|
iterator = obiformats.ReadSequencesBatchFromFiles(
|
||||||
filenames,
|
list_of_files,
|
||||||
reader,
|
reader,
|
||||||
nreader,
|
nreader,
|
||||||
opts...,
|
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 {
|
if CLIProgressBar() {
|
||||||
// iterator = iterator.Skip(SequencesToSkip())
|
iterator = iterator.Speed()
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if AnalyzeOnly() > 0 {
|
|
||||||
// iterator = iterator.Head(AnalyzeOnly())
|
|
||||||
// }
|
|
||||||
|
|
||||||
return iterator, nil
|
return iterator, nil
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,6 @@ func BuildPairedFileNames(filename string) (string, string) {
|
|||||||
func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
||||||
terminalAction bool, filenames ...string) (obiiter.IBioSequence, error) {
|
terminalAction bool, filenames ...string) (obiiter.IBioSequence, error) {
|
||||||
|
|
||||||
if CLIProgressBar() {
|
|
||||||
iterator = iterator.Speed()
|
|
||||||
}
|
|
||||||
var newIter obiiter.IBioSequence
|
var newIter obiiter.IBioSequence
|
||||||
|
|
||||||
opts := make([]obiformats.WithOption, 0, 10)
|
opts := make([]obiformats.WithOption, 0, 10)
|
||||||
|
Reference in New Issue
Block a user