From 3f579353282e14af6bf83ce299d1ad0f8a04cb86 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 5 Aug 2024 11:32:37 +0200 Subject: [PATCH] Adjust the size of the genbank and embl buffer size --- pkg/obiformats/embl_read.go | 2 +- pkg/obiformats/genbank_read.go | 2 +- pkg/obiformats/seqfile_chunk_read.go | 8 +++----- pkg/obioptions/version.go | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/obiformats/embl_read.go b/pkg/obiformats/embl_read.go index 1cd5b3c..876866f 100644 --- a/pkg/obiformats/embl_read.go +++ b/pkg/obiformats/embl_read.go @@ -187,7 +187,7 @@ func _ParseEmblFile( func ReadEMBL(reader io.Reader, options ...WithOption) (obiiter.IBioSequence, error) { opt := MakeOptions(options) - buff := make([]byte, 1024*1024*512) + buff := make([]byte, 1024*1024*128) // 128 MB entry_channel := ReadSeqFileChunk( opt.Source(), diff --git a/pkg/obiformats/genbank_read.go b/pkg/obiformats/genbank_read.go index d6dec7e..f9dfed2 100644 --- a/pkg/obiformats/genbank_read.go +++ b/pkg/obiformats/genbank_read.go @@ -223,7 +223,7 @@ func ReadGenbank(reader io.Reader, options ...WithOption) (obiiter.IBioSequence, opt := MakeOptions(options) // entry_channel := make(chan _FileChunk) - buff := make([]byte, 1024*1024*512) + buff := make([]byte, 1024*1024*128) // 128 MB entry_channel := ReadSeqFileChunk( opt.Source(), diff --git a/pkg/obiformats/seqfile_chunk_read.go b/pkg/obiformats/seqfile_chunk_read.go index ed214ce..727325f 100644 --- a/pkg/obiformats/seqfile_chunk_read.go +++ b/pkg/obiformats/seqfile_chunk_read.go @@ -9,8 +9,6 @@ import ( log "github.com/sirupsen/logrus" ) -var _FileChunkSize = 1024 * 1024 * 10 - type SeqFileChunkParser func(string, io.Reader) (obiseq.BioSequenceSlice, error) type SeqFileChunk struct { @@ -46,7 +44,7 @@ func ReadSeqFileChunk( chunk_channel := make(ChannelSeqFileChunk) - _FileChunkSize := len(buff) + fileChunkSize := len(buff) go func() { size := 0 @@ -73,9 +71,9 @@ func ReadSeqFileChunk( // Read from the reader in 1 MB increments until the end of the last entry is found for end = splitter(buff); err == nil && end < 0; end = splitter(buff) { ic++ - buff = slices.Grow(buff, _FileChunkSize) + buff = slices.Grow(buff, fileChunkSize) l := len(buff) - extbuff := buff[l:(l + _FileChunkSize - 1)] + extbuff := buff[l:(l + fileChunkSize - 1)] size, err = io.ReadFull(reader, extbuff) buff = buff[0:(l + size)] } diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index c208bca..a9b1642 100644 --- a/pkg/obioptions/version.go +++ b/pkg/obioptions/version.go @@ -7,7 +7,7 @@ import ( // TODO: The version number is extracted from git. This induces that the version // corresponds to the last commit, and not the one when the file will be // commited -var _Commit = "f83032e" +var _Commit = "886b5d9" var _Version = "Release 4.2.0" // Version returns the version of the obitools package.