mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 08:10:45 +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:
@ -14,7 +14,7 @@ func main() {
|
||||
optionParser := obioptions.GenerateOptionParser(
|
||||
"obicomplement",
|
||||
"reverse complement of sequences",
|
||||
obiconvert.OptionSet)
|
||||
obiconvert.OptionSet(true))
|
||||
|
||||
_, args := optionParser(os.Args)
|
||||
|
||||
|
@ -17,7 +17,7 @@ func main() {
|
||||
optionParser := obioptions.GenerateOptionParser(
|
||||
"obiconvert",
|
||||
"convertion of sequence files to various formats",
|
||||
obiconvert.OptionSet)
|
||||
obiconvert.OptionSet(true))
|
||||
|
||||
_, args := optionParser(os.Args)
|
||||
|
||||
|
@ -169,7 +169,7 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis
|
||||
|
||||
right = len(*bufferQA) - right
|
||||
|
||||
// log.Warnf("BuildQualityConsensus: left = %d right = %d\n", left, right)
|
||||
// obilog.Warnf("BuildQualityConsensus: left = %d right = %d\n", left, right)
|
||||
|
||||
for i, qA = range *bufferQA {
|
||||
nA := (*bufferSA)[i]
|
||||
|
@ -117,7 +117,7 @@ func _MatchScoreRatio(QF, QR byte) (float64, float64) {
|
||||
term1 := _Logaddexp(qF, qR)
|
||||
term2 := _Logdiffexp(term1, qF+qR)
|
||||
|
||||
// log.Warnf("MatchScoreRatio: %v, %v , %v, %v", QF, QR, term1, term2)
|
||||
// obilog.Warnf("MatchScoreRatio: %v, %v , %v, %v", QF, QR, term1, term2)
|
||||
|
||||
match_logp := _Log1mexp(term2 + l3 - l4)
|
||||
match_score := match_logp - _Log1mexp(match_logp)
|
||||
|
@ -152,7 +152,7 @@ func LocatePattern(id string, pattern, sequence []byte) (int, int, int) {
|
||||
|
||||
}
|
||||
|
||||
// log.Warnf("from : %d to: %d error: %d match: %v",
|
||||
// obilog.Warnf("from : %d to: %d error: %d match: %v",
|
||||
// i, end+1, -buffer[buffIndex(len(sequence)-1, len(pattern)-1, width)],
|
||||
// string(sequence[i:(end+1)]))
|
||||
return i, end + 1, -buffer[buffIndex(len(sequence)-1, len(pattern)-1, width)]
|
||||
|
@ -53,10 +53,10 @@ func ReadAlign(seqA, seqB *obiseq.BioSequence,
|
||||
over = min(seqA.Len(), seqB.Len())
|
||||
}
|
||||
|
||||
// log.Warnf("fw/fw: %v shift=%d fastCount=%d/over=%d fastScore=%f",
|
||||
// obilog.Warnf("fw/fw: %v shift=%d fastCount=%d/over=%d fastScore=%f",
|
||||
// directAlignment, shift, fastCount, over, fastScore)
|
||||
|
||||
// log.Warnf(("seqA: %s\nseqB: %s\n"), seqA.String(), seqB.String())
|
||||
// obilog.Warnf(("seqA: %s\nseqB: %s\n"), seqA.String(), seqB.String())
|
||||
|
||||
// At least one mismatch exists in the overlaping region
|
||||
if fastCount+3 < over {
|
||||
|
@ -410,8 +410,8 @@ func (pattern ApatPattern) FilterBestMatch(sequence ApatSequence, begin, length
|
||||
|
||||
best := [3]int{0, 0, 10000}
|
||||
for _, m := range res {
|
||||
// log.Warnf("Current : Begin : %d End : %d Err : %d", m[0], m[1], m[2])
|
||||
// log.Warnf("Best : Begin : %d End : %d Err : %d", best[0], best[1], best[2])
|
||||
// obilog.Warnf("Current : Begin : %d End : %d Err : %d", m[0], m[1], m[2])
|
||||
// obilog.Warnf("Best : Begin : %d End : %d Err : %d", best[0], best[1], best[2])
|
||||
if (m[0] - m[2]) < best[1]+best[2] {
|
||||
// match are overlapping
|
||||
// log.Warnln("overlap")
|
||||
@ -467,7 +467,7 @@ func (pattern ApatPattern) AllMatches(sequence ApatSequence, begin, length int)
|
||||
// Recompute the start and end position of the match
|
||||
// when the pattern allows for indels
|
||||
if m[2] > 0 && pattern.pointer.pointer.hasIndel {
|
||||
// log.Warnf("Locating indel on sequence %s[%s]", sequence.pointer.reference.Id(), pattern.String())
|
||||
// obilog.Warnf("Locating indel on sequence %s[%s]", sequence.pointer.reference.Id(), pattern.String())
|
||||
start := m[0] - m[2]*2
|
||||
start = max(start, 0)
|
||||
end := start + int(pattern.pointer.pointer.patlen) + 4*m[2]
|
||||
@ -489,7 +489,7 @@ func (pattern ApatPattern) AllMatches(sequence ApatSequence, begin, length int)
|
||||
m[0] = start + pb
|
||||
m[1] = start + pe
|
||||
|
||||
// log.Warnf("seq[%d@%d:%d] %d: %s %d - %s:%s:%s", i, m[0], m[1], olderr, sequence.pointer.reference.Id(), score,
|
||||
// obilog.Warnf("seq[%d@%d:%d] %d: %s %d - %s:%s:%s", i, m[0], m[1], olderr, sequence.pointer.reference.Id(), score,
|
||||
// frg, (*cpattern)[0:int(pattern.pointer.pointer.patlen)], sequence.pointer.reference.Sequence()[m[0]:m[1]])
|
||||
}
|
||||
|
||||
|
11
pkg/obidefault/logger.go
Normal file
11
pkg/obidefault/logger.go
Normal file
@ -0,0 +1,11 @@
|
||||
package obidefault
|
||||
|
||||
var __silent_warning__ = false
|
||||
|
||||
func SilentWarning() bool {
|
||||
return __silent_warning__
|
||||
}
|
||||
|
||||
func SilentWarningPtr() *bool {
|
||||
return &__silent_warning__
|
||||
}
|
@ -213,7 +213,7 @@ func _ParseFastaFile(
|
||||
|
||||
for chunks := range input {
|
||||
sequences, err := parser(chunks.Source, chunks.Raw)
|
||||
// log.Warnf("Chunck(%d:%d) -%d- ", chunks.Order, l, sequences.Len())
|
||||
// obilog.Warnf("Chunck(%d:%d) -%d- ", chunks.Order, l, sequences.Len())
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("File %s : Cannot parse the fasta file : %v", chunks.Source, err)
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
func EndOfLastFastqEntry(buffer []byte) int {
|
||||
var i int
|
||||
|
||||
// log.Warnf("EndOfLastFastqEntry(%d): %s", len(buffer), string(buffer[0:20]))
|
||||
// obilog.Warnf("EndOfLastFastqEntry(%d): %s", len(buffer), string(buffer[0:20]))
|
||||
imax := len(buffer)
|
||||
state := 0
|
||||
restart := imax - 1
|
||||
@ -74,7 +74,7 @@ func EndOfLastFastqEntry(buffer []byte) int {
|
||||
state = 3
|
||||
} else {
|
||||
// it was not the sequence part
|
||||
// log.Warnf("it was not the sequence part : %c", C)
|
||||
// obilog.Warnf("it was not the sequence part : %c", C)
|
||||
state = 0
|
||||
i = restart
|
||||
}
|
||||
@ -101,7 +101,7 @@ func EndOfLastFastqEntry(buffer []byte) int {
|
||||
// log.Warn("====> End of the last sequence")
|
||||
state = 7
|
||||
} else {
|
||||
// log.Warnf("%s: Strange it was not the end of the last sequence : %c : %s", string(buffer[0:40]), C, string(buffer[i-20:i+5]))
|
||||
// obilog.Warnf("%s: Strange it was not the end of the last sequence : %c : %s", string(buffer[0:40]), C, string(buffer[i-20:i+5]))
|
||||
state = 5
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
)
|
||||
@ -106,7 +107,7 @@ func FormatFastaBatch(batch obiiter.BioSequenceBatch, formater FormatHeader, ski
|
||||
// Handle empty sequences
|
||||
if skipEmpty {
|
||||
// Skip empty sequences if skipEmpty is true
|
||||
log.Warnf("Sequence %s is empty and skipped in output", seq.Id())
|
||||
obilog.Warnf("Sequence %s is empty and skipped in output", seq.Id())
|
||||
} else {
|
||||
// Terminate the program if skipEmpty is false
|
||||
log.Fatalf("Sequence %s is empty", seq.Id())
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
)
|
||||
@ -75,7 +76,7 @@ func FormatFastqBatch(batch obiiter.BioSequenceBatch,
|
||||
|
||||
} else {
|
||||
if skipEmpty {
|
||||
log.Warnf("Sequence %s is empty and skiped in output", seq.Id())
|
||||
obilog.Warnf("Sequence %s is empty and skiped in output", seq.Id())
|
||||
} else {
|
||||
log.Fatalf("Sequence %s is empty", seq.Id())
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ func ReadFileChunk(
|
||||
} else {
|
||||
end = -1
|
||||
}
|
||||
// log.Warnf("Splitter not found, attempting %d to read in %d B increments : len(buff) = %d/%d", ic, fileChunkSize, len(extbuff), len(buff))
|
||||
// obilog.Warnf("Splitter not found, attempting %d to read in %d B increments : len(buff) = %d/%d", ic, fileChunkSize, len(extbuff), len(buff))
|
||||
}
|
||||
|
||||
pieces = pieces.Head().Pack()
|
||||
@ -204,7 +204,7 @@ func ReadFileChunk(
|
||||
}
|
||||
|
||||
if len(pieces.data) > 0 {
|
||||
// log.Warnf("chuck %d :Read %d bytes from file %s", i, io.Len(), source)
|
||||
// obilog.Warnf("chuck %d :Read %d bytes from file %s", i, io.Len(), source)
|
||||
chunk_channel <- pieces.FileChunk(source, i)
|
||||
i++
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obingslibrary"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
@ -663,7 +664,7 @@ func ReadCSVNGSFilter(reader io.Reader) (*obingslibrary.NGSLibrary, error) {
|
||||
if ok {
|
||||
setparam(&ngsfilter, data...)
|
||||
} else {
|
||||
log.Warnf("At line %d: Skipping unknown parameter %s: %v", i, param, data)
|
||||
obilog.Warnf("At line %d: Skipping unknown parameter %s: %v", i, param, data)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"math"
|
||||
"math/bits"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -46,7 +47,7 @@ func (u Uint128) IsZero() bool {
|
||||
// Returns a Uint64 value.
|
||||
func (u Uint128) Uint64() Uint64 {
|
||||
if u.w1 != 0 {
|
||||
log.Warnf("Uint128 overflow at Uint64(%v)", u)
|
||||
obilog.Warnf("Uint128 overflow at Uint64(%v)", u)
|
||||
}
|
||||
return Uint64{w0: u.w0}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"math"
|
||||
"math/bits"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -51,7 +52,7 @@ func (u Uint256) IsZero() bool {
|
||||
// Returns a Uint64 value.
|
||||
func (u Uint256) Uint64() Uint64 {
|
||||
if u.w3 != 0 || u.w2 != 0 || u.w1 != 0 {
|
||||
log.Warnf("Uint256 overflow at Uint64(%v)", u)
|
||||
obilog.Warnf("Uint256 overflow at Uint64(%v)", u)
|
||||
}
|
||||
return Uint64{w0: u.w0}
|
||||
}
|
||||
@ -64,7 +65,7 @@ func (u Uint256) Uint64() Uint64 {
|
||||
// Returns a Uint128 value.
|
||||
func (u Uint256) Uint128() Uint128 {
|
||||
if u.w3 != 0 || u.w2 != 0 {
|
||||
log.Warnf("Uint256 overflow at Uint128(%v)", u)
|
||||
obilog.Warnf("Uint256 overflow at Uint128(%v)", u)
|
||||
}
|
||||
return Uint128{u.w1, u.w0}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"math"
|
||||
"math/bits"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -100,7 +101,7 @@ func (u Uint64) LeftShift64(n uint, carryIn uint64) (value, carry uint64) {
|
||||
|
||||
}
|
||||
|
||||
log.Warnf("Uint64 overflow at LeftShift64(%v, %v)", u, n)
|
||||
obilog.Warnf("Uint64 overflow at LeftShift64(%v, %v)", u, n)
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
@ -129,7 +130,7 @@ func (u Uint64) RightShift64(n uint, carryIn uint64) (value, carry uint64) {
|
||||
return carryIn, u.w0 >> (n - 64)
|
||||
}
|
||||
|
||||
log.Warnf("Uint64 overflow at RightShift64(%v, %v)", u, n)
|
||||
obilog.Warnf("Uint64 overflow at RightShift64(%v, %v)", u, n)
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@ package obiiter
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"github.com/pbnjay/memory"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (iterator IBioSequence) LimitMemory(fraction float64) IBioSequence {
|
||||
@ -25,11 +25,11 @@ func (iterator IBioSequence) LimitMemory(fraction float64) IBioSequence {
|
||||
runtime.Gosched()
|
||||
nwait++
|
||||
if nwait%1000 == 0 {
|
||||
log.Warnf("Wait for memory limit %f/%f", fracLoad(), fraction)
|
||||
obilog.Warnf("Wait for memory limit %f/%f", fracLoad(), fraction)
|
||||
|
||||
}
|
||||
if nwait > 10000 {
|
||||
log.Warnf("Very long wait for memory limit %f/%f", fracLoad(), fraction)
|
||||
obilog.Warnf("Very long wait for memory limit %f/%f", fracLoad(), fraction)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obifp"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type KmerMap[T obifp.FPUint[T]] struct {
|
||||
@ -226,12 +226,12 @@ func NewKmerMap[T obifp.FPUint[T]](
|
||||
sparseAt := -1
|
||||
|
||||
if sparse && kmersize%2 == 0 {
|
||||
log.Warnf("Kmer size must be odd when using sparse mode")
|
||||
obilog.Warnf("Kmer size must be odd when using sparse mode")
|
||||
kmersize++
|
||||
}
|
||||
|
||||
if !sparse && kmersize%2 == 1 {
|
||||
log.Warnf("Kmer size must be even when not using sparse mode")
|
||||
obilog.Warnf("Kmer size must be even when not using sparse mode")
|
||||
kmersize--
|
||||
|
||||
}
|
||||
|
12
pkg/obilog/warning.go
Normal file
12
pkg/obilog/warning.go
Normal file
@ -0,0 +1,12 @@
|
||||
package obilog
|
||||
|
||||
import (
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func Warnf(format string, args ...interface{}) {
|
||||
if !obidefault.SilentWarning() {
|
||||
logrus.Warnf(format, args...)
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
log "github.com/sirupsen/logrus"
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
@ -230,7 +231,7 @@ func LuaProcessor(iterator obiiter.IBioSequence, name, program string, breakOnEr
|
||||
if breakOnError {
|
||||
log.Fatalf("Error during Lua sequence processing : %v", err)
|
||||
} else {
|
||||
log.Warnf("Error during Lua sequence processing : %v", err)
|
||||
obilog.Warnf("Error during Lua sequence processing : %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ func lookForTag(seq string, delimiter byte) string {
|
||||
|
||||
i := len(seq) - 1
|
||||
|
||||
// log.Warnf("Provided fragment : %s", string(seq))
|
||||
// obilog.Warnf("Provided fragment : %s", string(seq))
|
||||
|
||||
for i >= 0 && seq[i] != delimiter {
|
||||
i--
|
||||
@ -109,7 +109,7 @@ func lookForTag(seq string, delimiter byte) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// log.Warnf("extracted : %s", string(seq[begin:end]))
|
||||
// obilog.Warnf("extracted : %s", string(seq[begin:end]))
|
||||
return seq[begin:end]
|
||||
}
|
||||
|
||||
@ -340,8 +340,8 @@ func (marker *Marker) beginTagExtractor(
|
||||
sequence *obiseq.BioSequence,
|
||||
begin int,
|
||||
forward bool) string {
|
||||
// log.Warnf("Forward : %v -> %d %c", forward, marker.Forward_spacer, marker.Forward_tag_delimiter)
|
||||
// log.Warnf("Forward : %v -> %d %c", forward, marker.Reverse_spacer, marker.Reverse_tag_delimiter)
|
||||
// obilog.Warnf("Forward : %v -> %d %c", forward, marker.Forward_spacer, marker.Forward_tag_delimiter)
|
||||
// obilog.Warnf("Forward : %v -> %d %c", forward, marker.Reverse_spacer, marker.Reverse_tag_delimiter)
|
||||
if forward {
|
||||
if marker.Forward_tag_length == 0 {
|
||||
return ""
|
||||
@ -351,10 +351,10 @@ func (marker *Marker) beginTagExtractor(
|
||||
return marker.beginFixedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
if marker.Forward_tag_indels == 0 {
|
||||
// log.Warnf("Delimited tag for forward primers %s", marker.forward.String())
|
||||
// obilog.Warnf("Delimited tag for forward primers %s", marker.forward.String())
|
||||
return marker.beginDelimitedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
// log.Warnf("Rescue tag for forward primers %s", marker.forward.String())
|
||||
// obilog.Warnf("Rescue tag for forward primers %s", marker.forward.String())
|
||||
return marker.beginRescueTagExtractor(sequence, begin, forward)
|
||||
}
|
||||
}
|
||||
@ -367,10 +367,10 @@ func (marker *Marker) beginTagExtractor(
|
||||
return marker.beginFixedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
if marker.Reverse_tag_indels == 0 {
|
||||
// log.Warnf("Delimited tag for reverse/complement primers %s", marker.creverse.String())
|
||||
// obilog.Warnf("Delimited tag for reverse/complement primers %s", marker.creverse.String())
|
||||
return marker.beginDelimitedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
// log.Warnf("Rescue tag for reverse/complement primers %s", marker.creverse.String())
|
||||
// obilog.Warnf("Rescue tag for reverse/complement primers %s", marker.creverse.String())
|
||||
return marker.beginRescueTagExtractor(sequence, begin, forward)
|
||||
}
|
||||
}
|
||||
@ -390,10 +390,10 @@ func (marker *Marker) endTagExtractor(
|
||||
return marker.endFixedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
if marker.Reverse_tag_indels == 0 {
|
||||
// log.Warnf("Delimited tag for reverse primers %s", marker.reverse.String())
|
||||
// obilog.Warnf("Delimited tag for reverse primers %s", marker.reverse.String())
|
||||
return marker.endDelimitedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
// log.Warnf("Rescue tag for reverse primers %s", marker.reverse.String())
|
||||
// obilog.Warnf("Rescue tag for reverse primers %s", marker.reverse.String())
|
||||
return marker.endRescueTagExtractor(sequence, end, forward)
|
||||
}
|
||||
}
|
||||
@ -406,10 +406,10 @@ func (marker *Marker) endTagExtractor(
|
||||
return marker.endFixedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
if marker.Forward_tag_indels == 0 {
|
||||
// log.Warnf("Delimited tag for forward/complement primers %s", marker.cforward.String())
|
||||
// obilog.Warnf("Delimited tag for forward/complement primers %s", marker.cforward.String())
|
||||
return marker.endDelimitedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
// log.Warnf("Rescue tag for forward/complement primers %s", marker.cforward.String())
|
||||
// obilog.Warnf("Rescue tag for forward/complement primers %s", marker.cforward.String())
|
||||
return marker.endRescueTagExtractor(sequence, end, forward)
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,11 @@ func GenerateOptionParser(program string,
|
||||
options.GetEnv("OBISOLEXA"),
|
||||
options.Description("Decodes quality string according to the Solexa specification."))
|
||||
|
||||
options.BoolVar(obidefault.SilentWarningPtr(), "silent-warning", obidefault.SilentWarning(),
|
||||
options.GetEnv("OBIWARNING"),
|
||||
options.Description("Stop printing of the warning message"),
|
||||
)
|
||||
|
||||
for _, o := range optionset {
|
||||
o(options)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// corresponds to the last commit, and not the one when the file will be
|
||||
// commited
|
||||
|
||||
var _Commit = "8b379d3"
|
||||
var _Commit = "2ab6f67"
|
||||
var _Version = "Release 4.4.0"
|
||||
|
||||
// Version returns the version of the obitools package.
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"golang.org/x/exp/rand"
|
||||
"gonum.org/v1/gonum/stat/sampleuv"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -280,7 +281,7 @@ func (clustering *KmeansClustering) AssignToClass() {
|
||||
nreset := clustering.ResetEmptyCenters()
|
||||
|
||||
if nreset > 0 {
|
||||
log.Warnf("Reseted %d empty centers", nreset)
|
||||
obilog.Warnf("Reseted %d empty centers", nreset)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ func (f *TaxidFactory) FromString(taxid string) (Taxid, error) {
|
||||
if len(part2) == 0 {
|
||||
taxid = part1
|
||||
} else {
|
||||
//log.Warnf("TaxidFactory.FromString: taxid %s -> -%s- -%s- ", taxid, part1, part2)
|
||||
//obilog.Warnf("TaxidFactory.FromString: taxid %s -> -%s- -%s- ", taxid, part1, part2)
|
||||
if part1 != f.code {
|
||||
return nil, fmt.Errorf("taxid %s string does not start with taxonomy code %s", taxid, f.code)
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ func CLIAnnotationWorker() obiseq.SeqWorker {
|
||||
|
||||
if CLIHasCut() {
|
||||
from, to := CLICut()
|
||||
w := CutSequenceWorker(from, to, false)
|
||||
w := CutSequenceWorker(from, to, true)
|
||||
|
||||
annotator = annotator.ChainWorkers(w)
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func SequenceAnnotationOptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obipcr command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
obigrep.SequenceSelectionOptionSet(options)
|
||||
SequenceAnnotationOptionSet(options)
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func commonSuffix(a, b *obiseq.BioSequence) int {
|
||||
if obiutils.UnsafeString(as[i+1:]) != obiutils.UnsafeString(bs[j+1:]) {
|
||||
log.Fatalf("i: %d, j: %d (%s/%s)", i, j, as[i+1:], bs[j+1:])
|
||||
}
|
||||
// log.Warnf("i: %d, j: %d (%s)", i, j, as[i+1:])
|
||||
// obilog.Warnf("i: %d, j: %d (%s)", i, j, as[i+1:])
|
||||
|
||||
return l
|
||||
}
|
||||
|
@ -113,10 +113,10 @@ func MakeSequenceFamilyGenusWorker(references obiseq.BioSequenceSlice) obiseq.Se
|
||||
}
|
||||
|
||||
// level, _ := sequence.GetAttribute("obicleandb_level")
|
||||
// log.Warnf("%s - level: %v", sequence.Id(), level)
|
||||
// log.Warnf("%s - gdist: %v", sequence.Id(), indist)
|
||||
// log.Warnf("%s - fdist: %v", sequence.Id(), outdist)
|
||||
// log.Warnf("%s - pval: %f", sequence.Id(), pval)
|
||||
// obilog.Warnf("%s - level: %v", sequence.Id(), level)
|
||||
// obilog.Warnf("%s - gdist: %v", sequence.Id(), indist)
|
||||
// obilog.Warnf("%s - fdist: %v", sequence.Id(), outdist)
|
||||
// obilog.Warnf("%s - pval: %f", sequence.Id(), pval)
|
||||
}
|
||||
|
||||
if pval < 0.0 {
|
||||
|
@ -126,11 +126,16 @@ func PairedFilesOptionSet(options *getoptions.GetOpt) {
|
||||
)
|
||||
}
|
||||
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obioptions.LoadTaxonomyOptionSet(options, false, false)
|
||||
InputOptionSet(options)
|
||||
OutputOptionSet(options)
|
||||
PairedFilesOptionSet(options)
|
||||
func OptionSet(allow_paired bool) func(options *getoptions.GetOpt) {
|
||||
f := func(options *getoptions.GetOpt) {
|
||||
obioptions.LoadTaxonomyOptionSet(options, false, false)
|
||||
InputOptionSet(options)
|
||||
OutputOptionSet(options)
|
||||
if allow_paired {
|
||||
PairedFilesOptionSet(options)
|
||||
}
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// Returns true if the number of reads described in the
|
||||
|
@ -17,7 +17,7 @@ func DemergeOptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obipcr command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
DemergeOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ func SequenceSelectionOptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obipcr command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(true)(options)
|
||||
SequenceSelectionOptionSet(options)
|
||||
|
||||
options.StringVar(&_SaveRejected, "save-discarded", _SaveRejected,
|
||||
|
@ -46,7 +46,7 @@ func JoinOptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obipcr command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
JoinOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,12 @@ func KmerSimMatchOptionSet(options *getoptions.GetOpt) {
|
||||
}
|
||||
|
||||
func CountOptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
KmerSimCountOptionSet(options)
|
||||
}
|
||||
|
||||
func MatchOptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
KmerSimCountOptionSet(options)
|
||||
KmerSimMatchOptionSet(options)
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func MicroSatelliteOptionSet(options *getoptions.GetOpt) {
|
||||
}
|
||||
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
MicroSatelliteOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func MultiplexOptionSet(options *getoptions.GetOpt) {
|
||||
}
|
||||
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
MultiplexOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func PCROptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obipcr command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
PCROptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func IndexSequence(seqidx int,
|
||||
// Initialize a matrix to store alignment scores
|
||||
var matrix []uint64
|
||||
|
||||
// log.Warnf("%s : %s", sequence.Id(), pseq.String())
|
||||
// obilog.Warnf("%s : %s", sequence.Id(), pseq.String())
|
||||
for idx_path := 1; idx_path < path_len; idx_path++ {
|
||||
mini := -1
|
||||
seqidcs := refs[pseq.Taxon(idx_path).Node]
|
||||
@ -144,8 +144,8 @@ func IndexSequence(seqidx int,
|
||||
}
|
||||
|
||||
if mini == 0 {
|
||||
// log.Warnf("%s: %s", sequence.Id(), sequence.String())
|
||||
// log.Warnf("%s: %s", suject.Id(), suject.String())
|
||||
// obilog.Warnf("%s: %s", sequence.Id(), sequence.String())
|
||||
// obilog.Warnf("%s: %s", suject.Id(), suject.String())
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ func IndexSequence(seqidx int,
|
||||
// insure than closest is strictly increasing
|
||||
for k := idx_path - 1; k >= 0 && mini < closest[k]; k-- {
|
||||
closest[k] = mini
|
||||
// log.Warnf("(%s,%s) Smaller alignment found than previous (%d,%d). Resetting closest.", sequence.Id(), pseq.Taxon(idx_path).String(), mini, closest[k])
|
||||
// obilog.Warnf("(%s,%s) Smaller alignment found than previous (%d,%d). Resetting closest.", sequence.Id(), pseq.Taxon(idx_path).String(), mini, closest[k])
|
||||
}
|
||||
} else {
|
||||
closest[idx_path] = seq_len
|
||||
@ -167,7 +167,7 @@ func IndexSequence(seqidx int,
|
||||
|
||||
obitag_index := make(map[int]string, pseq.Len())
|
||||
|
||||
// log.Warnf("(%s,%s): %v", sequence.Id(), pseq.Taxon(0).String(), closest)
|
||||
// obilog.Warnf("(%s,%s): %v", sequence.Id(), pseq.Taxon(0).String(), closest)
|
||||
for i, d := range closest {
|
||||
if i < (len(closest)-1) && d < closest[i+1] {
|
||||
current_taxon := pseq.Taxon(i)
|
||||
|
@ -8,5 +8,5 @@ import (
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obiuniq command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func ScriptOptionSet(options *getoptions.GetOpt) {
|
||||
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
ScriptOptionSet(options)
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
obigrep.SequenceSelectionOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ func SplitOptionSet(options *getoptions.GetOpt) {
|
||||
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
SplitOptionSet(options)
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
}
|
||||
|
||||
func CLIHasConfig() bool {
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilog"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
||||
@ -260,7 +261,7 @@ func CLIAssignTaxonomy(iterator obiiter.IBioSequence,
|
||||
if taxon != nil {
|
||||
j++
|
||||
} else {
|
||||
log.Warnf("Taxid %s is not described in the taxonomy %s."+
|
||||
obilog.Warnf("Taxid %s is not described in the taxonomy %s."+
|
||||
" Sequence %s is discared from the reference database",
|
||||
seq.Taxid(), taxo.Name(), seq.Id())
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func TagOptionSet(options *getoptions.GetOpt) {
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obiuniq command
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
TagOptionSet(options)
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,12 @@ func UniqueOptionSet(options *getoptions.GetOpt) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// OptionSet adds to the basic option set every options declared for
|
||||
// the obiuniq command
|
||||
//
|
||||
// It takes a pointer to a GetOpt struct as its parameter and does not return anything.
|
||||
func OptionSet(options *getoptions.GetOpt) {
|
||||
obiconvert.OptionSet(options)
|
||||
obiconvert.OptionSet(false)(options)
|
||||
UniqueOptionSet(options)
|
||||
}
|
||||
|
||||
@ -150,4 +149,4 @@ func CLINoSingleton() bool {
|
||||
// noSingleton bool - The boolean value to set for _NoSingleton.
|
||||
func SetNoSingleton(noSingleton bool) {
|
||||
_NoSingleton = noSingleton
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user