From 2d52322876f9f0637ae9ffcc8447cf4e5bdebe9a Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Thu, 27 Mar 2025 14:54:13 +0100 Subject: [PATCH] Patch a bug in the obi2 annotation parser on map indexed by integers --- pkg/obiformats/fastseq_obi_header.go | 2 ++ pkg/obioptions/version.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/obiformats/fastseq_obi_header.go b/pkg/obiformats/fastseq_obi_header.go index 05d76bd..f8e2e3c 100644 --- a/pkg/obiformats/fastseq_obi_header.go +++ b/pkg/obiformats/fastseq_obi_header.go @@ -18,6 +18,7 @@ import ( var __obi_header_value_string_pattern__ = regexp.MustCompile(`^'\s*([^']*'|"[^"]*")\s*;`) var __obi_header_value_numeric_pattern__ = regexp.MustCompile(`^\s*([+-]?\.\d+|[+-]?\d+(\.\d*)?([eE][+-]?\d+)?)\s*;`) +var __obi_header_map_int_key__ = regexp.MustCompile("([{,])([0-9]+):") func __match__dict__(text []byte) []int { @@ -212,6 +213,7 @@ func ParseOBIFeatures(text string, annotations obiseq.Annotation) string { if len(m) > 0 { bvalue = bytes.TrimSpace(part[m[0]:(m[1] - 1)]) j := bytes.ReplaceAll(bvalue, []byte("'"), []byte(`"`)) + j = __obi_header_map_int_key__.ReplaceAll(j, []byte(`$1"$2":`)) var err error switch { case strings.HasPrefix(key, "merged_") || diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index d3ad99c..9ae19f5 100644 --- a/pkg/obioptions/version.go +++ b/pkg/obioptions/version.go @@ -8,7 +8,7 @@ import ( // corresponds to the last commit, and not the one when the file will be // commited -var _Commit = "5a3705b" +var _Commit = "fd80249" var _Version = "Release 4.4.0" // Version returns the version of the obitools package.