Start to use leveled log

This commit is contained in:
2022-02-24 12:14:52 +01:00
parent f18cc034bb
commit abcf02e488
43 changed files with 156 additions and 67 deletions

View File

@@ -1,7 +1,7 @@
package obiconvert
import (
"log"
log "github.com/sirupsen/logrus"
"os"
"path/filepath"
"strings"

View File

@@ -1,7 +1,7 @@
package obiconvert
import (
"log"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiformats"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"

View File

@@ -1,7 +1,7 @@
package obidistribute
import (
"log"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiformats"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"

View File

@@ -2,7 +2,7 @@ package obidistribute
import (
"fmt"
"log"
log "github.com/sirupsen/logrus"
"strings"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"

View File

@@ -1,7 +1,7 @@
package obimultiplex
import (
"log"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obingslibrary"

View File

@@ -1,7 +1,7 @@
package obipairing
import (
"log"
log "github.com/sirupsen/logrus"
"math"
"os"
"runtime"

View File

@@ -1,7 +1,7 @@
package obipcr
import (
"log"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiapat"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"

View File

@@ -10,22 +10,29 @@ var _Keys = make([]string, 0, 10)
var _OnDisk = false
var _chunks = 100
var _NAValue = "NA"
var _NoSingleton = false
func UniqueOptionSet(options *getoptions.GetOpt) {
options.StringSliceVar(&_StatsOn, "merge",
1, 1,
options.Alias("m"),
options.ArgName("KEY"),
options.Description("Adds a merged attribute containing the list of sequence record ids merged within this group."))
options.StringSliceVar(&_Keys, "category-attribute",
1, 1,
options.Alias("c"),
options.ArgName("CATEGORY"),
options.Description("Adds one attribute to the list of attributes used to define sequence groups (this option can be used several times)."))
options.StringVar(&_NAValue, "na-value", _NAValue,
options.ArgName("NA_NAME"),
options.Description("Value used when the classifier tag is not defined for a sequence."))
options.BoolVar(&_OnDisk, "on-disk", true,
options.BoolVar(&_NoSingleton, "no-singleton", _NoSingleton,
options.Description("If set, sequences occurring a single time in the data set are discarded."))
options.BoolVar(&_OnDisk, "on-disk", _OnDisk,
options.Description("Allows for using a disk cache during the dereplication process. "))
options.IntVar(&_chunks, "chunk-count", _chunks,
@@ -49,7 +56,7 @@ func CLIKeys() []string {
}
func CLIUniqueInMemory() bool {
return _OnDisk
return !_OnDisk
}
func CLINumberOfChunks() int {
@@ -63,3 +70,7 @@ func CLINumberOfChunks() int {
func CLINAValue() string {
return _NAValue
}
func CLINoSingleton() bool {
return _NoSingleton
}

View File

@@ -1,7 +1,7 @@
package obiuniq
import (
"log"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obichunk"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
@@ -24,6 +24,13 @@ func Unique(sequences obiiter.IBioSequenceBatch) obiiter.IBioSequenceBatch {
options = append(options, obichunk.OptionSortOnDisk())
}
if CLINoSingleton() {
log.Printf("Removing sigletons from the output")
options = append(options, obichunk.OptionsNoSingleton())
} else {
log.Printf("Keep sigletons in the output")
}
options = append(options,
obichunk.OptionStatOn(CLIStatsOn()...))