Patch a bug in the new version of setDefinition()

Former-commit-id: 9a382d9891e158dd3d445bfb4053691739ca9fdb
This commit is contained in:
2023-10-05 07:48:47 +02:00
parent 0a8f7afb2a
commit 6acce603a1

View File

@ -324,7 +324,21 @@ func (s *BioSequence) SetId(id string) {
//
// It takes a string parameter 'definition' and assigns it to the 'definition' field of the BioSequence struct.
func (s *BioSequence) SetDefinition(definition string) {
s.SetAttribute("definition", definition)
if definition != "" {
s.SetAttribute("definition", definition)
} else {
s.RemoveAttribute("definition")
}
}
func (s *BioSequence) RemoveAttribute(key string) {
if s.HasAnnotation() {
if s.HasAttribute(key) {
defer s.AnnotationsUnlock()
s.AnnotationsLock()
delete(s.annotations, key)
}
}
}
// SetSource sets the source of the BioSequence.