mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Reduce memory allocation events
Former-commit-id: fbdb2afc857b02adc2593e2278d3bd838e99b0b2
This commit is contained in:
@ -46,17 +46,8 @@ func FormatFastqBatch(batch obiiter.BioSequenceBatch,
|
||||
for _, seq := range batch.Slice() {
|
||||
if seq.Len() > 0 {
|
||||
fs := FormatFastq(seq, formater)
|
||||
lb := bs.Len()
|
||||
n, _ := bs.WriteString(fs)
|
||||
|
||||
if n < len(fs) {
|
||||
log.Panicln("FormatFastqBatch: Cannot write all FASTQ sequences")
|
||||
}
|
||||
bs.WriteString(fs)
|
||||
bs.WriteString("\n")
|
||||
|
||||
if bs.Len()-lb < len(fs)+1 {
|
||||
log.Panicln("FormatFastqBatch: Cannot write all FASTQ sequences correctly")
|
||||
}
|
||||
} else {
|
||||
if skipEmpty {
|
||||
log.Warnf("Sequence %s is empty and skiped in output", seq.Id())
|
||||
@ -69,12 +60,6 @@ func FormatFastqBatch(batch obiiter.BioSequenceBatch,
|
||||
|
||||
chunk := bs.Bytes()
|
||||
|
||||
chunk = chunk[:bs.Len()]
|
||||
|
||||
if chunk[0] != '@' {
|
||||
log.Panicln("FormatFastqBatch: FASTQ format error")
|
||||
}
|
||||
|
||||
return chunk
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user