refactoring of the file chunck writing

This commit is contained in:
Eric Coissac
2024-11-29 18:15:03 +01:00
parent 69ef1758a2
commit 00b0edc15a
16 changed files with 71 additions and 98 deletions

View File

@ -16,11 +16,12 @@ import (
//
// Returns:
// - A set of strings containing the keys of the BioSequence attributes.
func (s *BioSequence) AttributeKeys(skip_container bool) obiutils.Set[string] {
func (s *BioSequence) AttributeKeys(skip_container, skip_definition bool) obiutils.Set[string] {
keys := obiutils.MakeSet[string]()
for k, v := range s.Annotations() {
if !skip_container || !obiutils.IsAContainer(v) {
if !((skip_container && obiutils.IsAContainer(v)) ||
(skip_definition && k == "definition")) {
keys.Add(k)
}
}
@ -38,8 +39,8 @@ func (s *BioSequence) AttributeKeys(skip_container bool) obiutils.Set[string] {
//
// Returns:
// - A set of strings containing the keys of the BioSequence.
func (s *BioSequence) Keys(skip_container bool) obiutils.Set[string] {
keys := s.AttributeKeys(skip_container)
func (s *BioSequence) Keys(skip_container, skip_definition bool) obiutils.Set[string] {
keys := s.AttributeKeys(skip_container, skip_definition)
keys.Add("id")
if s.HasSequence() {

View File

@ -150,11 +150,11 @@ func (s BioSequenceSlice) Size() int {
return size
}
func (s BioSequenceSlice) AttributeKeys(skip_map bool) obiutils.Set[string] {
func (s BioSequenceSlice) AttributeKeys(skip_map, skip_definition bool) obiutils.Set[string] {
keys := obiutils.MakeSet[string]()
for _, k := range s {
keys = keys.Union(k.AttributeKeys(skip_map))
keys = keys.Union(k.AttributeKeys(skip_map, skip_definition))
}
return keys