mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds the --silent-warning options to the obitools commands and removes the --pared-with option from some of the obitols commands.
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -136,7 +137,12 @@ func (s *BioSequence) SetAttribute(key string, value interface{}) {
|
||||
}
|
||||
|
||||
if key == "sequence" {
|
||||
s.SetSequence(value.([]byte))
|
||||
data, err := obiutils.InterfaceToString(value)
|
||||
if err != nil {
|
||||
obilog.Warnf("%s: cannot convert value %v to sequence", s.Id(), value)
|
||||
return
|
||||
}
|
||||
s.SetSequence([]byte(data))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -444,6 +444,15 @@ func (s *BioSequence) SetSequence(sequence []byte) {
|
||||
s.sequence = obiutils.InPlaceToLower(CopySlice(sequence))
|
||||
}
|
||||
|
||||
func (s *BioSequence) HasValidSequence() bool {
|
||||
for _, c := range s.sequence {
|
||||
if !((c >= 'a' && c <= 'z') || c == '-' || c == '.' || c == '[' || c == ']') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Setting the qualities of the BioSequence.
|
||||
func (s *BioSequence) SetQualities(qualities Quality) {
|
||||
if s.qualities != nil {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package obiseq
|
||||
|
||||
import (
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -61,7 +62,7 @@ func (s *BioSequenceSlice) EnsureCapacity(capacity int) *BioSequenceSlice {
|
||||
if c < capacity {
|
||||
n++
|
||||
if n < 4 {
|
||||
log.Warnf("cannot allocate a Biosequence Slice of size %d (only %d from %d)", capacity, c, old_c)
|
||||
obilog.Warnf("cannot allocate a Biosequence Slice of size %d (only %d from %d)", capacity, c, old_c)
|
||||
} else {
|
||||
log.Panicf("cannot allocate a Biosequence Slice of size %d (only %d from %d)", capacity, c, old_c)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -278,9 +279,10 @@ func ExpressionPredicat(expression string) SequencePredicate {
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Expression '%s' cannot be evaluated on sequence %s",
|
||||
obilog.Warnf("Expression '%s' cannot be evaluated on sequence %s",
|
||||
expression,
|
||||
sequence.Id())
|
||||
return false
|
||||
}
|
||||
|
||||
return value
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
)
|
||||
@ -41,7 +42,7 @@ func (s *BioSequence) SetTaxid(taxid string, rank ...string) {
|
||||
taxon, isAlias, err = taxonomy.Taxon(taxid)
|
||||
|
||||
if err != nil {
|
||||
logger := log.Warnf
|
||||
logger := obilog.Warnf
|
||||
if obidefault.FailOnTaxonomy() {
|
||||
logger = log.Fatalf
|
||||
}
|
||||
@ -51,7 +52,7 @@ func (s *BioSequence) SetTaxid(taxid string, rank ...string) {
|
||||
|
||||
if isAlias {
|
||||
if obidefault.UpdateTaxid() {
|
||||
log.Warnf("%s: Taxid: %v is updated to %s",
|
||||
obilog.Warnf("%s: Taxid: %v is updated to %s",
|
||||
s.Id(), taxid, taxon.String())
|
||||
taxid = taxon.String()
|
||||
} else {
|
||||
@ -59,7 +60,7 @@ func (s *BioSequence) SetTaxid(taxid string, rank ...string) {
|
||||
log.Fatalf("%s: Taxid: %v is an alias from taxonomy (%v) to %s",
|
||||
s.Id(), taxid, taxonomy.Name(), taxon.String())
|
||||
}
|
||||
log.Warnf("%s: Taxid %v has to be updated to %s",
|
||||
obilog.Warnf("%s: Taxid %v has to be updated to %s",
|
||||
s.Id(), taxid, taxon.String())
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package obiseq
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
)
|
||||
@ -66,7 +67,7 @@ func IsSubCladeOfSlot(taxonomy *obitax.Taxonomy, key string) SequencePredicate {
|
||||
parent, _, err := taxonomy.Taxon(val)
|
||||
|
||||
if err != nil {
|
||||
log.Warnf("%s: %s is unkown from the taxonomy (%v)", sequence.Id(), val, err)
|
||||
obilog.Warnf("%s: %s is unkown from the taxonomy (%v)", sequence.Id(), val, err)
|
||||
}
|
||||
|
||||
taxon := sequence.Taxon(taxonomy)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
)
|
||||
|
||||
type SeqAnnotator func(*BioSequence)
|
||||
@ -119,7 +119,7 @@ func SeqToSliceWorker(worker SeqWorker,
|
||||
s.Id(), err)
|
||||
return BioSequenceSlice{}, err
|
||||
} else {
|
||||
log.Warnf("got an error on sequence %s processing : %v",
|
||||
obilog.Warnf("got an error on sequence %s processing : %v",
|
||||
s.Id(), err)
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@ func SeqToSliceConditionalWorker(
|
||||
s.Id(), err)
|
||||
return BioSequenceSlice{}, err
|
||||
} else {
|
||||
log.Warnf("got an error on sequence %s processing : %v",
|
||||
obilog.Warnf("got an error on sequence %s processing : %v",
|
||||
s.Id(), err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user