mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
a first version of obisummary
Former-commit-id: cca1019d82a14a322f46a20890b996b5c7491d41
This commit is contained in:
@@ -287,6 +287,21 @@ func (s *BioSequence) GetIntMap(key string) (map[string]int, bool) {
|
||||
return val, ok
|
||||
}
|
||||
|
||||
func (s *BioSequence) GetStringMap(key string) (map[string]string, bool) {
|
||||
var val map[string]string
|
||||
|
||||
var err error
|
||||
|
||||
v, ok := s.GetAttribute(key)
|
||||
|
||||
if ok {
|
||||
val, err = obiutils.InterfaceToStringMap(v)
|
||||
ok = err == nil
|
||||
}
|
||||
|
||||
return val, ok
|
||||
}
|
||||
|
||||
// GetIntSlice returns the integer slice value associated with the given key in the BioSequence object.
|
||||
//
|
||||
// Parameters:
|
||||
|
||||
@@ -6,6 +6,18 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestSubsequence tests the Subsequence function.
|
||||
//
|
||||
// The function tests various cases of the Subsequence method of a BioSequence object.
|
||||
// It checks different scenarios of subsequence slicing, including both valid and invalid parameters.
|
||||
// The function is designed for unit testing purposes and uses the Go testing package.
|
||||
// It asserts that the expected subsequence is returned for each test case and checks for any errors.
|
||||
// The function also verifies the correctness of the subsequence qualities, if applicable.
|
||||
// The test cases cover both non-circular and circular subsequence slicing.
|
||||
// It ensures that the function handles different scenarios such as when `from` is greater than `to`,
|
||||
// `from` or `to` is out of bounds, and normal subsequence slicing cases.
|
||||
//
|
||||
// TestSubsequence does not return any value.
|
||||
func TestSubsequence(t *testing.T) {
|
||||
// Test case 1: Subsequence with valid parameters and non-circular
|
||||
seq := NewBioSequence("ID1", []byte("ATCG"), "")
|
||||
|
||||
Reference in New Issue
Block a user