Correct the number of workers

Former-commit-id: febbccfb853263e0761ecfccb0f09c8c1bf88475
This commit is contained in:
2023-11-22 09:46:30 +01:00
parent 8905a16bc0
commit 2e0c1bd801
11 changed files with 206 additions and 39 deletions

View File

@@ -1,7 +1,6 @@
package obiseq
import (
"errors"
"fmt"
)
@@ -17,15 +16,21 @@ import (
// - error: an error if the subsequence parameters are invalid.
func (sequence *BioSequence) Subsequence(from, to int, circular bool) (*BioSequence, error) {
if from >= to && !circular {
return nil, errors.New("from greater than to")
return nil, fmt.Errorf("from: %d greater than to: %d", from, to)
}
if from < 0 || from >= sequence.Len() {
return nil, errors.New("from out of bounds")
if from < 0 {
return nil, fmt.Errorf("from out of bounds %d < 0", from)
}
if to <= 0 || to > sequence.Len() {
return nil, errors.New("to out of bounds")
if from >= sequence.Len() {
return nil,
fmt.Errorf("from out of bounds %d >= %d", from, sequence.Len())
}
if to > sequence.Len() {
return nil,
fmt.Errorf("to out of bounds %d > %d", to, sequence.Len())
}
var newSeq *BioSequence