Patch obimatrix accoring to the new type obiseq.StatsOnValues

This commit is contained in:
Eric Coissac
2025-06-19 16:51:53 +02:00
parent add9d89ccc
commit 27fa984a63
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ import (
// corresponds to the last commit, and not the one when the file will be // corresponds to the last commit, and not the one when the file will be
// commited // commited
var _Commit = "9965370" var _Commit = "add9d89"
var _Version = "Release 4.4.0" var _Version = "Release 4.4.0"
// Version returns the version of the obitools package. // Version returns the version of the obitools package.

View File

@ -79,7 +79,11 @@ func (data1 *MatrixData) MergeMatrixData(data2 *MatrixData) *MatrixData {
// - *MatrixData: The updated MatrixData object. // - *MatrixData: The updated MatrixData object.
func (data *MatrixData) Update(s *obiseq.BioSequence, mapkey string) *MatrixData { func (data *MatrixData) Update(s *obiseq.BioSequence, mapkey string) *MatrixData {
if v, ok := s.GetAttribute(mapkey); ok { if v, ok := s.GetAttribute(mapkey); ok {
if obiutils.IsAMap(v) { if m, ok := v.(*obiseq.StatsOnValues); ok {
m.RLock()
(*data)[s.Id()] = obiutils.MapToMapInterface(m.Map())
m.RUnlock()
} else if obiutils.IsAMap(v) {
(*data)[s.Id()] = obiutils.MapToMapInterface(v) (*data)[s.Id()] = obiutils.MapToMapInterface(v)
} else { } else {
log.Panicf("Attribute %s is not a map in the sequence %s", mapkey, s.Id()) log.Panicf("Attribute %s is not a map in the sequence %s", mapkey, s.Id())