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:
@@ -46,47 +46,6 @@ func FormatFastqBatch(batch obiiter.BioSequenceBatch, quality_shift int,
|
||||
return bs.Bytes()
|
||||
}
|
||||
|
||||
func WriteFastq(iterator obiiter.IBioSequence, file io.Writer, options ...WithOption) error {
|
||||
opt := MakeOptions(options)
|
||||
|
||||
header_format := opt.FormatFastSeqHeader()
|
||||
quality := opt.QualityShift()
|
||||
|
||||
for iterator.Next() {
|
||||
seq := iterator.Get()
|
||||
fmt.Fprintln(file, FormatFastq(seq, quality, header_format))
|
||||
}
|
||||
|
||||
if opt.CloseFile() {
|
||||
switch file := file.(type) {
|
||||
case *os.File:
|
||||
file.Close()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func WriteFastqToFile(iterator obiiter.IBioSequence,
|
||||
filename string,
|
||||
options ...WithOption) error {
|
||||
|
||||
file, err := os.Create(filename)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("open file error: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
options = append(options, OptionCloseFile())
|
||||
return WriteFastq(iterator, file, options...)
|
||||
}
|
||||
|
||||
func WriteFastqToStdout(iterator obiiter.IBioSequence, options ...WithOption) error {
|
||||
options = append(options, OptionDontCloseFile())
|
||||
return WriteFastq(iterator, os.Stdout, options...)
|
||||
}
|
||||
|
||||
type FileChunck struct {
|
||||
text []byte
|
||||
order int
|
||||
|
||||
Reference in New Issue
Block a user