diff --git a/pkg/obiformats/fastseq_json_header.go b/pkg/obiformats/fastseq_json_header.go index 915ed0d..e4f0410 100644 --- a/pkg/obiformats/fastseq_json_header.go +++ b/pkg/obiformats/fastseq_json_header.go @@ -12,7 +12,6 @@ import ( ) func _parse_json_header_(header string, annotations obiseq.Annotation) string { - start := -1 stop := -1 level := 0 @@ -58,6 +57,9 @@ func _parse_json_header_(header string, annotations obiseq.Annotation) string { if vt == math.Floor(vt) { annotations[k] = int(vt) } + { + annotations[k] = vt + } } } @@ -69,8 +71,18 @@ func _parse_json_header_(header string, annotations obiseq.Annotation) string { } func ParseFastSeqJsonHeader(sequence *obiseq.BioSequence) { - sequence.SetDefinition(_parse_json_header_(sequence.Definition(), - sequence.Annotations())) + definition := sequence.Definition() + sequence.SetDefinition("") + + definition_part := _parse_json_header_( + definition, + sequence.Annotations()) + if len(definition_part) > 0 { + if sequence.HasDefinition() { + definition_part = sequence.Definition() + " " + definition_part + } + sequence.SetDefinition(definition_part) + } } func FormatFastSeqJsonHeader(sequence *obiseq.BioSequence) string { @@ -80,7 +92,7 @@ func FormatFastSeqJsonHeader(sequence *obiseq.BioSequence) string { text, err := obiutils.JsonMarshal(sequence.Annotations()) if err != nil { - panic(err) + log.Fatal(err) } return string(text) diff --git a/pkg/obiformats/fastseq_obi_header.go b/pkg/obiformats/fastseq_obi_header.go index 6dd4a1c..d7ac4d5 100644 --- a/pkg/obiformats/fastseq_obi_header.go +++ b/pkg/obiformats/fastseq_obi_header.go @@ -285,11 +285,17 @@ func ParseOBIFeatures(text string, annotations obiseq.Annotation) string { func ParseFastSeqOBIHeader(sequence *obiseq.BioSequence) { annotations := sequence.Annotations() + definition := sequence.Definition() + sequence.SetDefinition("") - definition := ParseOBIFeatures(sequence.Definition(), - annotations) + definition = ParseOBIFeatures(definition, annotations) - sequence.SetDefinition(definition) + if len(definition) > 0 { + if sequence.HasDefinition() { + definition = sequence.Definition() + " " + definition + } + sequence.SetDefinition(definition) + } } func FormatFastSeqOBIHeader(sequence *obiseq.BioSequence) string { diff --git a/pkg/obiformats/seqfile_chunck_read.go b/pkg/obiformats/seqfile_chunck_read.go index 07e6ef4..84f994d 100644 --- a/pkg/obiformats/seqfile_chunck_read.go +++ b/pkg/obiformats/seqfile_chunck_read.go @@ -106,6 +106,16 @@ func ReadSeqFileChunk(reader io.Reader, } } + if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF { + log.Fatalf("Error reading data from file : %s", err) + } + + // Send the last chunk to the channel + if len(buff) > 0 { + io := bytes.NewBuffer(slices.Clone(buff)) + chunk_channel <- SeqFileChunk{io, i} + } + // Close the readers channel when the end of the file is reached close(chunk_channel) }() diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index 8095363..db7494f 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 = "f4fcc19" +var _Commit = "b842d60" var _Version = "Release 4.2.0" // Version returns the version of the obitools package.