mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Debug fasta and fastq writer when the first sequence is hudge
Former-commit-id: d208ff838abb7e19e117067f6243298492d60f14
This commit is contained in:
@ -52,14 +52,24 @@ func FormatFastqBatch(batch obiiter.BioSequenceBatch,
|
||||
formater FormatHeader, skipEmpty bool) []byte {
|
||||
var bs bytes.Buffer
|
||||
|
||||
for i, seq := range batch.Slice() {
|
||||
lt := 0
|
||||
|
||||
for _, seq := range batch.Slice() {
|
||||
lt += seq.Len()
|
||||
}
|
||||
|
||||
// Iterate over each sequence in the batch
|
||||
first := true
|
||||
|
||||
for _, seq := range batch.Slice() {
|
||||
if seq.Len() > 0 {
|
||||
_formatFastq(&bs, seq, formater)
|
||||
|
||||
if i == 0 {
|
||||
|
||||
bs.Grow(len(bs.Bytes()) * len(batch.Slice()) * 5 / 4)
|
||||
if first {
|
||||
bs.Grow(lt + (len(bs.Bytes())-seq.Len())*batch.Len()*5/4)
|
||||
first = false
|
||||
}
|
||||
|
||||
} else {
|
||||
if skipEmpty {
|
||||
log.Warnf("Sequence %s is empty and skiped in output", seq.Id())
|
||||
|
Reference in New Issue
Block a user