mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
introduce obidefault
This commit is contained in:
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicleandb"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicleandb"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obicleandb.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obicleandb.OptionSet)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
@ -10,8 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obiconvert.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obiconvert.OptionSet)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicount"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicount"
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ func main() {
|
|||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
obioptions.SetStrictReadWorker(min(4, obioptions.CLIParallelWorkers()))
|
obidefault.SetStrictReadWorker(min(4, obidefault.ParallelWorkers()))
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidemerge"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidemerge"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
@ -11,8 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obidemerge.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obidemerge.OptionSet)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obijoin"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obijoin"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
@ -11,8 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obijoin.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obijoin.OptionSet)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
||||||
@ -33,8 +34,8 @@ func main() {
|
|||||||
|
|
||||||
optionParser(os.Args)
|
optionParser(os.Args)
|
||||||
|
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
pairs, err := obipairing.CLIPairedSequence()
|
pairs, err := obipairing.CLIPairedSequence()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -51,7 +52,7 @@ func main() {
|
|||||||
obipairing.CLIFastMode(),
|
obipairing.CLIFastMode(),
|
||||||
obipairing.CLIFastRelativeScore(),
|
obipairing.CLIFastRelativeScore(),
|
||||||
obipairing.CLIWithStats(),
|
obipairing.CLIWithStats(),
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(paired, true)
|
obiconvert.CLIWriteBioSequences(paired, true)
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipcr"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipcr"
|
||||||
@ -23,10 +24,10 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(2)
|
obidefault.SetWorkerPerCore(2)
|
||||||
obioptions.SetReadWorkerPerCore(0.5)
|
obidefault.SetReadWorkerPerCore(0.5)
|
||||||
obioptions.SetParallelFilesRead(obioptions.CLIParallelWorkers() / 4)
|
obidefault.SetParallelFilesRead(obidefault.ParallelWorkers() / 4)
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obipcr.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obipcr.OptionSet)
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
@ -33,10 +34,10 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(2)
|
obidefault.SetWorkerPerCore(2)
|
||||||
obioptions.SetStrictReadWorker(1)
|
obidefault.SetStrictReadWorker(1)
|
||||||
obioptions.SetStrictWriteWorker(1)
|
obidefault.SetStrictWriteWorker(1)
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obitag.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obitag.OptionSet)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
||||||
@ -30,7 +31,7 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(1)
|
obidefault.SetWorkerPerCore(1)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obitagpcr.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obitagpcr.OptionSet)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
obidefault.SetReadQualities(false)
|
obidefault.SetReadQualities(false)
|
||||||
optionParser := obioptions.GenerateOptionParser(obiuniq.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(obiuniq.OptionSet)
|
||||||
|
|
||||||
|
@ -3,13 +3,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitaxformat"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
obitaxformat.DetectTaxonomyFormat(os.Args[1])
|
obitax.DetectTaxonomyFormat(os.Args[1])
|
||||||
println(obiutils.RemoveAllExt("toto/tutu/test.txt"))
|
println(obiutils.RemoveAllExt("toto/tutu/test.txt"))
|
||||||
println(obiutils.Basename("toto/tutu/test.txt"))
|
println(obiutils.Basename("toto/tutu/test.txt"))
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package obiapat
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
@ -104,7 +104,7 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
extension: -1,
|
extension: -1,
|
||||||
fullExtension: false,
|
fullExtension: false,
|
||||||
circular: false,
|
circular: false,
|
||||||
parallelWorkers: obioptions.CLIParallelWorkers(),
|
parallelWorkers: obidefault.ParallelWorkers(),
|
||||||
batchSize: 100,
|
batchSize: 100,
|
||||||
forward: NilApatPattern,
|
forward: NilApatPattern,
|
||||||
cfwd: NilApatPattern,
|
cfwd: NilApatPattern,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package obichunk
|
package obichunk
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
navalue: "NA",
|
navalue: "NA",
|
||||||
cacheOnDisk: false,
|
cacheOnDisk: false,
|
||||||
batchCount: 100,
|
batchCount: 100,
|
||||||
batchSize: obioptions.CLIBatchSize(),
|
batchSize: obidefault.BatchSize(),
|
||||||
parallelWorkers: obioptions.CLIParallelWorkers(),
|
parallelWorkers: obidefault.ParallelWorkers(),
|
||||||
noSingleton: false,
|
noSingleton: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ func ISequenceSubChunk(iterator obiiter.IBioSequence,
|
|||||||
nworkers int) (obiiter.IBioSequence, error) {
|
nworkers int) (obiiter.IBioSequence, error) {
|
||||||
|
|
||||||
if nworkers <= 0 {
|
if nworkers <= 0 {
|
||||||
nworkers = obioptions.CLIParallelWorkers()
|
nworkers = obidefault.ParallelWorkers()
|
||||||
}
|
}
|
||||||
|
|
||||||
newIter := obiiter.MakeIBioSequence()
|
newIter := obiiter.MakeIBioSequence()
|
||||||
|
26
pkg/obidefault/batch.go
Normal file
26
pkg/obidefault/batch.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package obidefault
|
||||||
|
|
||||||
|
var _BatchSize = 2000
|
||||||
|
|
||||||
|
// SetBatchSize sets the size of the sequence batches.
|
||||||
|
//
|
||||||
|
// n - an integer representing the size of the sequence batches.
|
||||||
|
func SetBatchSize(n int) {
|
||||||
|
_BatchSize = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// CLIBatchSize returns the expected size of the sequence batches.
|
||||||
|
//
|
||||||
|
// In Obitools, the sequences are processed in parallel by batches.
|
||||||
|
// The number of sequence in each batch is determined by the command line option
|
||||||
|
// --batch-size and the environment variable OBIBATCHSIZE.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer value.
|
||||||
|
func BatchSize() int {
|
||||||
|
return _BatchSize
|
||||||
|
}
|
||||||
|
|
||||||
|
func BatchSizePtr() *int {
|
||||||
|
return &_BatchSize
|
||||||
|
}
|
15
pkg/obidefault/compressed.go
Normal file
15
pkg/obidefault/compressed.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package obidefault
|
||||||
|
|
||||||
|
var __compressed__ = false
|
||||||
|
|
||||||
|
func CompressOutput() bool {
|
||||||
|
return __compressed__
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetCompressOutput(b bool) {
|
||||||
|
__compressed__ = b
|
||||||
|
}
|
||||||
|
|
||||||
|
func CompressedPtr() *bool {
|
||||||
|
return &__compressed__
|
||||||
|
}
|
32
pkg/obidefault/taxonomy.go
Normal file
32
pkg/obidefault/taxonomy.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package obidefault
|
||||||
|
|
||||||
|
var __taxonomy__ = ""
|
||||||
|
var __alternative_name__ = false
|
||||||
|
|
||||||
|
func SelectedTaxonomy() string {
|
||||||
|
return __taxonomy__
|
||||||
|
}
|
||||||
|
|
||||||
|
func HasSelectedTaxonomy() bool {
|
||||||
|
return __taxonomy__ != ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func AreAlternativeNamesSelected() bool {
|
||||||
|
return __alternative_name__
|
||||||
|
}
|
||||||
|
|
||||||
|
func SelectedTaxonomyPtr() *string {
|
||||||
|
return &__taxonomy__
|
||||||
|
}
|
||||||
|
|
||||||
|
func AlternativeNamesSelectedPtr() *bool {
|
||||||
|
return &__alternative_name__
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetSelectedTaxonomy(taxonomy string) {
|
||||||
|
__taxonomy__ = taxonomy
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetAlternativeNamesSelected(alt bool) {
|
||||||
|
__alternative_name__ = alt
|
||||||
|
}
|
170
pkg/obidefault/workers.go
Normal file
170
pkg/obidefault/workers.go
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
package obidefault
|
||||||
|
|
||||||
|
import "runtime"
|
||||||
|
|
||||||
|
var _MaxAllowedCPU = runtime.NumCPU()
|
||||||
|
var _WorkerPerCore = 1.0
|
||||||
|
|
||||||
|
var _ReadWorkerPerCore = 0.25
|
||||||
|
var _WriteWorkerPerCore = 0.25
|
||||||
|
|
||||||
|
var _StrictReadWorker = 0
|
||||||
|
var _StrictWriteWorker = 0
|
||||||
|
|
||||||
|
var _ParallelFilesRead = 0
|
||||||
|
|
||||||
|
// CLIParallelWorkers returns the number of parallel workers used for
|
||||||
|
// computing the result.
|
||||||
|
//
|
||||||
|
// The number of parallel workers is determined by the command line option
|
||||||
|
// --max-cpu|-m and the environment variable OBIMAXCPU. This number is
|
||||||
|
// multiplied by the variable _WorkerPerCore.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer representing the number of parallel workers.
|
||||||
|
func ParallelWorkers() int {
|
||||||
|
return int(float64(MaxCPU()) * float64(WorkerPerCore()))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CLIMaxCPU returns the maximum number of CPU cores allowed.
|
||||||
|
//
|
||||||
|
// The maximum number of CPU cores is determined by the command line option
|
||||||
|
// --max-cpu|-m and the environment variable OBIMAXCPU.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer representing the maximum number of CPU cores allowed.
|
||||||
|
func MaxCPU() int {
|
||||||
|
return _MaxAllowedCPU
|
||||||
|
}
|
||||||
|
|
||||||
|
func MaxCPUPtr() *int {
|
||||||
|
return &_MaxAllowedCPU
|
||||||
|
}
|
||||||
|
|
||||||
|
// WorkerPerCore returns the number of workers per CPU core.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns a float64 representing the number of workers per CPU core.
|
||||||
|
func WorkerPerCore() float64 {
|
||||||
|
return _WorkerPerCore
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetWorkerPerCore sets the number of workers per CPU core.
|
||||||
|
//
|
||||||
|
// It takes a float64 parameter representing the number of workers
|
||||||
|
// per CPU core and does not return any value.
|
||||||
|
func SetWorkerPerCore(n float64) {
|
||||||
|
_WorkerPerCore = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMaxCPU sets the maximum number of CPU cores allowed.
|
||||||
|
//
|
||||||
|
// n - an integer representing the new maximum number of CPU cores.
|
||||||
|
func SetMaxCPU(n int) {
|
||||||
|
_MaxAllowedCPU = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReadWorker sets the number of workers for reading files.
|
||||||
|
//
|
||||||
|
// The number of worker dedicated to reading files is determined
|
||||||
|
// as the number of allowed CPU cores multiplied by number of read workers per core.
|
||||||
|
// Setting the number of read workers using this function allows to decouple the number
|
||||||
|
// of read workers from the number of CPU cores.
|
||||||
|
//
|
||||||
|
// n - an integer representing the number of workers to be set.
|
||||||
|
func SetStrictReadWorker(n int) {
|
||||||
|
_StrictReadWorker = n
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetStrictWriteWorker(n int) {
|
||||||
|
_StrictWriteWorker = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReadWorkerPerCore sets the number of worker per CPU
|
||||||
|
// core for reading files.
|
||||||
|
//
|
||||||
|
// n float64
|
||||||
|
func SetReadWorkerPerCore(n float64) {
|
||||||
|
_ReadWorkerPerCore = n
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetWriteWorkerPerCore(n float64) {
|
||||||
|
_WriteWorkerPerCore = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadWorker returns the number of workers for reading files.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer representing the number of workers.
|
||||||
|
func StrictReadWorker() int {
|
||||||
|
return _StrictReadWorker
|
||||||
|
}
|
||||||
|
|
||||||
|
func StrictWriteWorker() int {
|
||||||
|
return _StrictWriteWorker
|
||||||
|
}
|
||||||
|
|
||||||
|
// CLIReadParallelWorkers returns the number of parallel workers used for
|
||||||
|
// reading files.
|
||||||
|
//
|
||||||
|
// The number of parallel workers is determined by the command line option
|
||||||
|
// --max-cpu|-m and the environment variable OBIMAXCPU. This number is
|
||||||
|
// multiplied by the variable _ReadWorkerPerCore.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer representing the number of parallel workers.
|
||||||
|
func ReadParallelWorkers() int {
|
||||||
|
if StrictReadWorker() == 0 {
|
||||||
|
n := int(float64(MaxCPU()) * ReadWorkerPerCore())
|
||||||
|
if n == 0 {
|
||||||
|
n = 1
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
} else {
|
||||||
|
return StrictReadWorker()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WriteParallelWorkers() int {
|
||||||
|
if StrictWriteWorker() == 0 {
|
||||||
|
n := int(float64(MaxCPU()) * WriteWorkerPerCore())
|
||||||
|
if n == 0 {
|
||||||
|
n = 1
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
} else {
|
||||||
|
return StrictReadWorker()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadWorkerPerCore returns the number of worker per CPU core for
|
||||||
|
// computing the result.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns a float64 representing the number of worker per CPU core.
|
||||||
|
func ReadWorkerPerCore() float64 {
|
||||||
|
return _ReadWorkerPerCore
|
||||||
|
}
|
||||||
|
|
||||||
|
func WriteWorkerPerCore() float64 {
|
||||||
|
return _ReadWorkerPerCore
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParallelFilesRead returns the number of files to be read in parallel.
|
||||||
|
//
|
||||||
|
// No parameters.
|
||||||
|
// Returns an integer representing the number of files to be read.
|
||||||
|
func ParallelFilesRead() int {
|
||||||
|
if _ParallelFilesRead == 0 {
|
||||||
|
return ReadParallelWorkers()
|
||||||
|
} else {
|
||||||
|
return _ParallelFilesRead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetParallelFilesRead sets the number of files to be read in parallel.
|
||||||
|
//
|
||||||
|
// n - an integer representing the number of files to be set.
|
||||||
|
func SetParallelFilesRead(n int) {
|
||||||
|
_ParallelFilesRead = n
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package obiformats
|
package obiformats
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
seqBatchFormater: nil,
|
seqBatchFormater: nil,
|
||||||
with_progress_bar: false,
|
with_progress_bar: false,
|
||||||
buffer_size: 2,
|
buffer_size: 2,
|
||||||
parallel_workers: obioptions.CLIReadParallelWorkers(),
|
parallel_workers: obidefault.ReadParallelWorkers(),
|
||||||
batch_size: obioptions.CLIBatchSize(),
|
batch_size: obidefault.BatchSize(),
|
||||||
total_seq_size: 1024 * 1024 * 100, // 100 MB by default
|
total_seq_size: 1024 * 1024 * 100, // 100 MB by default
|
||||||
no_order: false,
|
no_order: false,
|
||||||
full_file_batch: false,
|
full_file_batch: false,
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
"github.com/tevino/abool/v2"
|
"github.com/tevino/abool/v2"
|
||||||
@ -591,7 +591,7 @@ func (iterator IBioSequence) DivideOn(predicate obiseq.SequencePredicate,
|
|||||||
// A function that takes a predicate and a batch of sequences and returns a filtered batch of sequences.
|
// A function that takes a predicate and a batch of sequences and returns a filtered batch of sequences.
|
||||||
func (iterator IBioSequence) FilterOn(predicate obiseq.SequencePredicate,
|
func (iterator IBioSequence) FilterOn(predicate obiseq.SequencePredicate,
|
||||||
size int, sizes ...int) IBioSequence {
|
size int, sizes ...int) IBioSequence {
|
||||||
nworkers := obioptions.CLIReadParallelWorkers()
|
nworkers := obidefault.ReadParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
@ -643,7 +643,7 @@ func (iterator IBioSequence) FilterOn(predicate obiseq.SequencePredicate,
|
|||||||
|
|
||||||
func (iterator IBioSequence) FilterAnd(predicate obiseq.SequencePredicate,
|
func (iterator IBioSequence) FilterAnd(predicate obiseq.SequencePredicate,
|
||||||
size int, sizes ...int) IBioSequence {
|
size int, sizes ...int) IBioSequence {
|
||||||
nworkers := obioptions.CLIReadParallelWorkers()
|
nworkers := obidefault.ReadParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package obicsv
|
package obiiter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ func (dist *IDistribute) Classifier() *obiseq.BioSequenceClassifier {
|
|||||||
// It ensures that the outputs are closed and cleaned up once
|
// It ensures that the outputs are closed and cleaned up once
|
||||||
// processing is complete.
|
// processing is complete.
|
||||||
func (iterator IBioSequence) Distribute(class *obiseq.BioSequenceClassifier, sizes ...int) IDistribute {
|
func (iterator IBioSequence) Distribute(class *obiseq.BioSequenceClassifier, sizes ...int) IDistribute {
|
||||||
batchsize := obioptions.CLIBatchSize()
|
batchsize := obidefault.BatchSize()
|
||||||
|
|
||||||
outputs := make(map[int]IBioSequence, 100)
|
outputs := make(map[int]IBioSequence, 100)
|
||||||
slices := make(map[int]*obiseq.BioSequenceSlice, 100)
|
slices := make(map[int]*obiseq.BioSequenceSlice, 100)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package obiiter
|
package obiiter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ func (iter IBioSequence) PairTo(p IBioSequence) IBioSequence {
|
|||||||
|
|
||||||
newIter := MakeIBioSequence()
|
newIter := MakeIBioSequence()
|
||||||
|
|
||||||
iter = iter.SortBatches().Rebatch(obioptions.CLIBatchSize())
|
iter = iter.SortBatches().Rebatch(obidefault.BatchSize())
|
||||||
p = p.SortBatches().Rebatch(obioptions.CLIBatchSize())
|
p = p.SortBatches().Rebatch(obidefault.BatchSize())
|
||||||
|
|
||||||
newIter.Add(1)
|
newIter.Add(1)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package obiiter
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ import (
|
|||||||
func (iterator IBioSequence) MakeIWorker(worker obiseq.SeqWorker,
|
func (iterator IBioSequence) MakeIWorker(worker obiseq.SeqWorker,
|
||||||
breakOnError bool,
|
breakOnError bool,
|
||||||
sizes ...int) IBioSequence {
|
sizes ...int) IBioSequence {
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
@ -34,13 +34,13 @@ func (iterator IBioSequence) MakeIWorker(worker obiseq.SeqWorker,
|
|||||||
// Parameters:
|
// Parameters:
|
||||||
// - predicate: A function that takes a sequence and returns a boolean value indicating whether the sequence satisfies a certain condition.
|
// - predicate: A function that takes a sequence and returns a boolean value indicating whether the sequence satisfies a certain condition.
|
||||||
// - worker: A function that takes a sequence and returns a modified version of the sequence.
|
// - worker: A function that takes a sequence and returns a modified version of the sequence.
|
||||||
// - sizes: Optional. One or more integers representing the number of workers to be used for parallel processing. If not provided, the number of workers will be determined by the obioptions.CLIReadParallelWorkers() function.
|
// - sizes: Optional. One or more integers representing the number of workers to be used for parallel processing. If not provided, the number of workers will be determined by the obidefault.ReadParallelWorkers() function.
|
||||||
//
|
//
|
||||||
// Return:
|
// Return:
|
||||||
// - newIter: A new IBioSequence iterator with the modified sequences.
|
// - newIter: A new IBioSequence iterator with the modified sequences.
|
||||||
func (iterator IBioSequence) MakeIConditionalWorker(predicate obiseq.SequencePredicate,
|
func (iterator IBioSequence) MakeIConditionalWorker(predicate obiseq.SequencePredicate,
|
||||||
worker obiseq.SeqWorker, breakOnError bool, sizes ...int) IBioSequence {
|
worker obiseq.SeqWorker, breakOnError bool, sizes ...int) IBioSequence {
|
||||||
nworkers := obioptions.CLIReadParallelWorkers()
|
nworkers := obidefault.ReadParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
@ -63,7 +63,7 @@ func (iterator IBioSequence) MakeIConditionalWorker(predicate obiseq.SequencePre
|
|||||||
//
|
//
|
||||||
// The function returns a new IBioSequence containing the modified slices.
|
// The function returns a new IBioSequence containing the modified slices.
|
||||||
func (iterator IBioSequence) MakeISliceWorker(worker obiseq.SeqSliceWorker, breakOnError bool, sizes ...int) IBioSequence {
|
func (iterator IBioSequence) MakeISliceWorker(worker obiseq.SeqSliceWorker, breakOnError bool, sizes ...int) IBioSequence {
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
lua "github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
@ -154,7 +154,7 @@ func LuaProcessor(iterator obiiter.IBioSequence, name, program string, breakOnEr
|
|||||||
newIter := obiiter.MakeIBioSequence()
|
newIter := obiiter.MakeIBioSequence()
|
||||||
|
|
||||||
if nworkers <= 0 {
|
if nworkers <= 0 {
|
||||||
nworkers = obioptions.CLIParallelWorkers()
|
nworkers = obidefault.ParallelWorkers()
|
||||||
}
|
}
|
||||||
|
|
||||||
newIter.Add(nworkers)
|
newIter.Add(nworkers)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package obingslibrary
|
package obingslibrary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
allowedMismatch: 0,
|
allowedMismatch: 0,
|
||||||
allowsIndel: false,
|
allowsIndel: false,
|
||||||
withProgressBar: false,
|
withProgressBar: false,
|
||||||
parallelWorkers: obioptions.CLIParallelWorkers(),
|
parallelWorkers: obidefault.ParallelWorkers(),
|
||||||
batchSize: obioptions.CLIBatchSize(),
|
batchSize: obidefault.BatchSize(),
|
||||||
}
|
}
|
||||||
|
|
||||||
opt := Options{&o}
|
opt := Options{&o}
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package obioptions
|
package obioptions
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitaxformat"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/DavidGamba/go-getoptions"
|
"github.com/DavidGamba/go-getoptions"
|
||||||
@ -18,21 +15,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _Debug = false
|
var _Debug = false
|
||||||
var _WorkerPerCore = 1.0
|
|
||||||
var _ReadWorkerPerCore = 0.25
|
|
||||||
var _WriteWorkerPerCore = 0.25
|
|
||||||
var _StrictReadWorker = 0
|
|
||||||
var _StrictWriteWorker = 0
|
|
||||||
var _ParallelFilesRead = 0
|
|
||||||
var _MaxAllowedCPU = runtime.NumCPU()
|
|
||||||
var _BatchSize = 2000
|
var _BatchSize = 2000
|
||||||
var _Pprof = false
|
var _Pprof = false
|
||||||
var _PprofMudex = 10
|
var _PprofMudex = 10
|
||||||
var _PprofGoroutine = 6060
|
var _PprofGoroutine = 6060
|
||||||
|
|
||||||
var __taxonomy__ = ""
|
|
||||||
var __alternative_name__ = false
|
|
||||||
|
|
||||||
type ArgumentParser func([]string) (*getoptions.GetOpt, []string)
|
type ArgumentParser func([]string) (*getoptions.GetOpt, []string)
|
||||||
|
|
||||||
func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser {
|
func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser {
|
||||||
@ -56,7 +43,7 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
// options.Alias("w"),
|
// options.Alias("w"),
|
||||||
// options.Description("Number of parallele threads computing the result"))
|
// options.Description("Number of parallele threads computing the result"))
|
||||||
|
|
||||||
options.IntVar(&_MaxAllowedCPU, "max-cpu", _MaxAllowedCPU,
|
options.IntVar(obidefault.MaxCPUPtr(), "max-cpu", obidefault.MaxCPU(),
|
||||||
options.GetEnv("OBIMAXCPU"),
|
options.GetEnv("OBIMAXCPU"),
|
||||||
options.Description("Number of parallele threads computing the result"))
|
options.Description("Number of parallele threads computing the result"))
|
||||||
|
|
||||||
@ -71,7 +58,7 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
options.GetEnv("OBIPPROFGOROUTINE"),
|
options.GetEnv("OBIPPROFGOROUTINE"),
|
||||||
options.Description("Enable profiling of goroutine blocking profile."))
|
options.Description("Enable profiling of goroutine blocking profile."))
|
||||||
|
|
||||||
options.IntVar(&_BatchSize, "batch-size", _BatchSize,
|
options.IntVar(obidefault.BatchSizePtr(), "batch-size", obidefault.BatchSize(),
|
||||||
options.GetEnv("OBIBATCHSIZE"),
|
options.GetEnv("OBIBATCHSIZE"),
|
||||||
options.Description("Number of sequence per batch for paralelle processing"))
|
options.Description("Number of sequence per batch for paralelle processing"))
|
||||||
|
|
||||||
@ -79,6 +66,10 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
options.GetEnv("OBISOLEXA"),
|
options.GetEnv("OBISOLEXA"),
|
||||||
options.Description("Decodes quality string according to the Solexa specification."))
|
options.Description("Decodes quality string according to the Solexa specification."))
|
||||||
|
|
||||||
|
options.BoolVar(obidefault.CompressedPtr(), "compressed", obidefault.CompressOutput(),
|
||||||
|
options.Alias("Z"),
|
||||||
|
options.Description("Compress all the result using gzip"))
|
||||||
|
|
||||||
for _, o := range optionset {
|
for _, o := range optionset {
|
||||||
o(options)
|
o(options)
|
||||||
}
|
}
|
||||||
@ -129,14 +120,6 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
log.Info(" go tool pprof -http=127.0.0.1:8080 'http://localhost:6060/debug/pprof/block'")
|
log.Info(" go tool pprof -http=127.0.0.1:8080 'http://localhost:6060/debug/pprof/block'")
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Called("taxonomy") {
|
|
||||||
taxonomy, err := obitaxformat.LoadTaxonomy(CLISelectedTaxonomy(),
|
|
||||||
!CLIAreAlternativeNamesSelected())
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Loading taxonomy error: %v", err)
|
|
||||||
}
|
|
||||||
taxonomy.SetAsDefault()
|
|
||||||
}
|
|
||||||
// Handle user errors
|
// Handle user errors
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n\n", err)
|
fmt.Fprintf(os.Stderr, "ERROR: %s\n\n", err)
|
||||||
@ -145,30 +128,30 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup the maximum number of CPU usable by the program
|
// Setup the maximum number of CPU usable by the program
|
||||||
if _MaxAllowedCPU == 1 {
|
if obidefault.MaxCPU() == 1 {
|
||||||
log.Warn("Limitating the Maximum number of CPU to 1 is not recommanded")
|
log.Warn("Limitating the Maximum number of CPU to 1 is not recommanded")
|
||||||
log.Warn("The number of CPU requested has been set to 2")
|
log.Warn("The number of CPU requested has been set to 2")
|
||||||
SetMaxCPU(2)
|
obidefault.SetMaxCPU(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Called("force-one-cpu") {
|
if options.Called("force-one-cpu") {
|
||||||
log.Warn("Limitating the Maximum number of CPU to 1 is not recommanded")
|
log.Warn("Limitating the Maximum number of CPU to 1 is not recommanded")
|
||||||
log.Warn("The number of CPU has been forced to 1")
|
log.Warn("The number of CPU has been forced to 1")
|
||||||
log.Warn("This can lead to unexpected behavior")
|
log.Warn("This can lead to unexpected behavior")
|
||||||
SetMaxCPU(1)
|
obidefault.SetMaxCPU(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime.GOMAXPROCS(_MaxAllowedCPU)
|
runtime.GOMAXPROCS(obidefault.MaxCPU())
|
||||||
|
|
||||||
if options.Called("max-cpu") || options.Called("force-one-cpu") {
|
if options.Called("max-cpu") || options.Called("force-one-cpu") {
|
||||||
log.Printf("CPU number limited to %d", _MaxAllowedCPU)
|
log.Printf("CPU number limited to %d", obidefault.MaxCPU())
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Called("no-singleton") {
|
if options.Called("no-singleton") {
|
||||||
log.Printf("No singleton option set")
|
log.Printf("No singleton option set")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Number of workers set %d", CLIParallelWorkers())
|
log.Printf("Number of workers set %d", obidefault.ParallelWorkers())
|
||||||
|
|
||||||
// if options.Called("workers") {
|
// if options.Called("workers") {
|
||||||
|
|
||||||
@ -184,17 +167,17 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
|
|
||||||
func LoadTaxonomyOptionSet(options *getoptions.GetOpt, required, alternatiive bool) {
|
func LoadTaxonomyOptionSet(options *getoptions.GetOpt, required, alternatiive bool) {
|
||||||
if required {
|
if required {
|
||||||
options.StringVar(&__taxonomy__, "taxonomy", "",
|
options.StringVar(obidefault.SelectedTaxonomyPtr(), "taxonomy", obidefault.SelectedTaxonomy(),
|
||||||
options.Alias("t"),
|
options.Alias("t"),
|
||||||
options.Required(),
|
options.Required(),
|
||||||
options.Description("Path to the taxonomy database."))
|
options.Description("Path to the taxonomy database."))
|
||||||
} else {
|
} else {
|
||||||
options.StringVar(&__taxonomy__, "taxonomy", "",
|
options.StringVar(obidefault.SelectedTaxonomyPtr(), "taxonomy", obidefault.SelectedTaxonomy(),
|
||||||
options.Alias("t"),
|
options.Alias("t"),
|
||||||
options.Description("Path to the taxonomy database."))
|
options.Description("Path to the taxonomy database."))
|
||||||
}
|
}
|
||||||
if alternatiive {
|
if alternatiive {
|
||||||
options.BoolVar(&__alternative_name__, "alternative-names", false,
|
options.BoolVar(obidefault.AlternativeNamesSelectedPtr(), "alternative-names", obidefault.AreAlternativeNamesSelected(),
|
||||||
options.Alias("a"),
|
options.Alias("a"),
|
||||||
options.Description("Enable the search on all alternative names and not only scientific names."))
|
options.Description("Enable the search on all alternative names and not only scientific names."))
|
||||||
}
|
}
|
||||||
@ -212,84 +195,6 @@ func CLIIsDebugMode() bool {
|
|||||||
return _Debug
|
return _Debug
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLIParallelWorkers returns the number of parallel workers used for
|
|
||||||
// computing the result.
|
|
||||||
//
|
|
||||||
// The number of parallel workers is determined by the command line option
|
|
||||||
// --max-cpu|-m and the environment variable OBIMAXCPU. This number is
|
|
||||||
// multiplied by the variable _WorkerPerCore.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of parallel workers.
|
|
||||||
func CLIParallelWorkers() int {
|
|
||||||
return int(float64(CLIMaxCPU()) * float64(WorkerPerCore()))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CLIReadParallelWorkers returns the number of parallel workers used for
|
|
||||||
// reading files.
|
|
||||||
//
|
|
||||||
// The number of parallel workers is determined by the command line option
|
|
||||||
// --max-cpu|-m and the environment variable OBIMAXCPU. This number is
|
|
||||||
// multiplied by the variable _ReadWorkerPerCore.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of parallel workers.
|
|
||||||
func CLIReadParallelWorkers() int {
|
|
||||||
if StrictReadWorker() == 0 {
|
|
||||||
n := int(float64(CLIMaxCPU()) * ReadWorkerPerCore())
|
|
||||||
if n == 0 {
|
|
||||||
n = 1
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
} else {
|
|
||||||
return StrictReadWorker()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CLIWriteParallelWorkers returns the number of parallel workers used for
|
|
||||||
// writing files.
|
|
||||||
//
|
|
||||||
// The number of parallel workers is determined by the command line option
|
|
||||||
// --max-cpu|-m and the environment variable OBIMAXCPU. This number is
|
|
||||||
// multiplied by the variable _WriteWorkerPerCore.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of parallel workers.
|
|
||||||
func CLIWriteParallelWorkers() int {
|
|
||||||
if StrictWriteWorker() == 0 {
|
|
||||||
n := int(float64(CLIMaxCPU()) * WriteWorkerPerCore())
|
|
||||||
if n == 0 {
|
|
||||||
n = 1
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
} else {
|
|
||||||
return StrictWriteWorker()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CLIMaxCPU returns the maximum number of CPU cores allowed.
|
|
||||||
//
|
|
||||||
// The maximum number of CPU cores is determined by the command line option
|
|
||||||
// --max-cpu|-m and the environment variable OBIMAXCPU.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the maximum number of CPU cores allowed.
|
|
||||||
func CLIMaxCPU() int {
|
|
||||||
return _MaxAllowedCPU
|
|
||||||
}
|
|
||||||
|
|
||||||
// CLIBatchSize returns the expected size of the sequence batches.
|
|
||||||
//
|
|
||||||
// In Obitools, the sequences are processed in parallel by batches.
|
|
||||||
// The number of sequence in each batch is determined by the command line option
|
|
||||||
// --batch-size and the environment variable OBIBATCHSIZE.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer value.
|
|
||||||
func CLIBatchSize() int {
|
|
||||||
return _BatchSize
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetDebugOn sets the debug mode on.
|
// SetDebugOn sets the debug mode on.
|
||||||
func SetDebugOn() {
|
func SetDebugOn() {
|
||||||
_Debug = true
|
_Debug = true
|
||||||
@ -299,148 +204,3 @@ func SetDebugOn() {
|
|||||||
func SetDebugOff() {
|
func SetDebugOff() {
|
||||||
_Debug = false
|
_Debug = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWorkerPerCore sets the number of workers per CPU core.
|
|
||||||
//
|
|
||||||
// It takes a float64 parameter representing the number of workers
|
|
||||||
// per CPU core and does not return any value.
|
|
||||||
func SetWorkerPerCore(n float64) {
|
|
||||||
_WorkerPerCore = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetReadWorkerPerCore sets the number of worker per CPU
|
|
||||||
// core for reading files.
|
|
||||||
//
|
|
||||||
// n float64
|
|
||||||
func SetReadWorkerPerCore(n float64) {
|
|
||||||
_ReadWorkerPerCore = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// WorkerPerCore returns the number of workers per CPU core.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns a float64 representing the number of workers per CPU core.
|
|
||||||
func WorkerPerCore() float64 {
|
|
||||||
return _WorkerPerCore
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadWorkerPerCore returns the number of worker per CPU core for
|
|
||||||
// computing the result.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns a float64 representing the number of worker per CPU core.
|
|
||||||
func ReadWorkerPerCore() float64 {
|
|
||||||
return _ReadWorkerPerCore
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteWorkerPerCore returns the number of worker per CPU core for
|
|
||||||
// computing the result.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns a float64 representing the number of worker per CPU core.
|
|
||||||
func WriteWorkerPerCore() float64 {
|
|
||||||
return _WriteWorkerPerCore
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetBatchSize sets the size of the sequence batches.
|
|
||||||
//
|
|
||||||
// n - an integer representing the size of the sequence batches.
|
|
||||||
func SetBatchSize(n int) {
|
|
||||||
_BatchSize = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetMaxCPU sets the maximum number of CPU cores allowed.
|
|
||||||
//
|
|
||||||
// n - an integer representing the new maximum number of CPU cores.
|
|
||||||
func SetMaxCPU(n int) {
|
|
||||||
_MaxAllowedCPU = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetReadWorker sets the number of workers for reading files.
|
|
||||||
//
|
|
||||||
// The number of worker dedicated to reading files is determined
|
|
||||||
// as the number of allowed CPU cores multiplied by number of read workers per core.
|
|
||||||
// Setting the number of read workers using this function allows to decouple the number
|
|
||||||
// of read workers from the number of CPU cores.
|
|
||||||
//
|
|
||||||
// n - an integer representing the number of workers to be set.
|
|
||||||
func SetStrictReadWorker(n int) {
|
|
||||||
_StrictReadWorker = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadWorker returns the number of workers for reading files.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of workers.
|
|
||||||
func StrictReadWorker() int {
|
|
||||||
return _StrictReadWorker
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetWriteWorker sets the number of workers for writing files.
|
|
||||||
//
|
|
||||||
// The number of worker dedicated to writing files is determined
|
|
||||||
// as the number of allowed CPU cores multiplied by number of write workers per core.
|
|
||||||
// Setting the number of write workers using this function allows to decouple the number
|
|
||||||
// of write workers from the number of CPU cores.
|
|
||||||
//
|
|
||||||
// n - an integer representing the number of workers to be set.
|
|
||||||
func SetStrictWriteWorker(n int) {
|
|
||||||
_StrictWriteWorker = n
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteWorker returns the number of workers for writing files.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of workers.
|
|
||||||
func StrictWriteWorker() int {
|
|
||||||
return _StrictWriteWorker
|
|
||||||
}
|
|
||||||
|
|
||||||
// ParallelFilesRead returns the number of files to be read in parallel.
|
|
||||||
//
|
|
||||||
// No parameters.
|
|
||||||
// Returns an integer representing the number of files to be read.
|
|
||||||
func ParallelFilesRead() int {
|
|
||||||
if _ParallelFilesRead == 0 {
|
|
||||||
return CLIReadParallelWorkers()
|
|
||||||
} else {
|
|
||||||
return _ParallelFilesRead
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetParallelFilesRead sets the number of files to be read in parallel.
|
|
||||||
//
|
|
||||||
// n - an integer representing the number of files to be set.
|
|
||||||
func SetParallelFilesRead(n int) {
|
|
||||||
_ParallelFilesRead = n
|
|
||||||
}
|
|
||||||
|
|
||||||
func CLISelectedTaxonomy() string {
|
|
||||||
return __taxonomy__
|
|
||||||
}
|
|
||||||
|
|
||||||
func CLIHasSelectedTaxonomy() bool {
|
|
||||||
return __taxonomy__ != ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func CLIAreAlternativeNamesSelected() bool {
|
|
||||||
return __alternative_name__
|
|
||||||
}
|
|
||||||
|
|
||||||
func CLILoadSelectedTaxonomy() (*obitax.Taxonomy, error) {
|
|
||||||
if obitax.IsDefaultTaxonomyDefined() {
|
|
||||||
return obitax.DefaultTaxonomy(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if CLISelectedTaxonomy() != "" {
|
|
||||||
taxonomy, err := obitaxformat.LoadTaxonomy(CLISelectedTaxonomy(),
|
|
||||||
!CLIAreAlternativeNamesSelected())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
taxonomy.SetAsDefault()
|
|
||||||
return taxonomy, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errors.New("no taxonomy selected using option -t|--taxonomy")
|
|
||||||
}
|
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
// corresponds to the last commit, and not the one when the file will be
|
// corresponds to the last commit, and not the one when the file will be
|
||||||
// commited
|
// commited
|
||||||
|
|
||||||
var _Commit = "9acb4a8"
|
var _Commit = "0a567f6"
|
||||||
var _Version = "Release 4.2.0"
|
var _Version = "Release 4.2.0"
|
||||||
|
|
||||||
// Version returns the version of the obitools package.
|
// Version returns the version of the obitools package.
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package csvtaxdump
|
package obitax
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadCSVTaxonomy(path string, onlysn bool) (*obitax.Taxonomy, error) {
|
func LoadCSVTaxonomy(path string, onlysn bool) (*Taxonomy, error) {
|
||||||
|
|
||||||
file, err := obiutils.Ropen(path)
|
file, err := obiutils.Ropen(path)
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ func LoadCSVTaxonomy(path string, onlysn bool) (*obitax.Taxonomy, error) {
|
|||||||
|
|
||||||
name := obiutils.RemoveAllExt(path)
|
name := obiutils.RemoveAllExt(path)
|
||||||
short := obiutils.Basename(path)
|
short := obiutils.Basename(path)
|
||||||
taxonomy := obitax.NewTaxonomy(name, short, obiutils.AsciiAlphaNumSet)
|
taxonomy := NewTaxonomy(name, short, obiutils.AsciiAlphaNumSet)
|
||||||
|
|
||||||
line, err := csvfile.Read()
|
line, err := csvfile.Read()
|
||||||
|
|
@ -1,12 +1,11 @@
|
|||||||
package csvtaxdump
|
package obitax
|
||||||
|
|
||||||
// import (
|
// import (
|
||||||
// "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
// "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
// "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
|
||||||
// )
|
// )
|
||||||
|
|
||||||
// func WriteTaxonomyCSV(iterator obiiter.IBioSequence,
|
// func WriteTaxonomyCSV(iterator obiiter.IBioSequence,
|
||||||
// terminalAction bool, filenames ...string) *obicsv.ICSVRecord {
|
// terminalAction bool, filenames ...string) *obiiter.ICSVRecord {
|
||||||
|
|
||||||
// return nil
|
// return nil
|
||||||
// }
|
// }
|
@ -1,6 +1,9 @@
|
|||||||
package obitax
|
package obitax
|
||||||
|
|
||||||
import log "github.com/sirupsen/logrus"
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
var __defaut_taxonomy__ *Taxonomy
|
var __defaut_taxonomy__ *Taxonomy
|
||||||
|
|
||||||
@ -26,5 +29,20 @@ func IsDefaultTaxonomyDefined() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DefaultTaxonomy() *Taxonomy {
|
func DefaultTaxonomy() *Taxonomy {
|
||||||
|
var err error
|
||||||
|
if __defaut_taxonomy__ == nil {
|
||||||
|
if obidefault.HasSelectedTaxonomy() {
|
||||||
|
__defaut_taxonomy__, err = LoadTaxonomy(
|
||||||
|
obidefault.SelectedTaxonomy(),
|
||||||
|
!obidefault.AreAlternativeNamesSelected(),
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Cannot load default taxonomy: %v", err)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return __defaut_taxonomy__
|
return __defaut_taxonomy__
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package ncbitaxdump
|
package obitax
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ import (
|
|||||||
// The function reads each record from the input, trims whitespace from the taxid, parent, and rank,
|
// The function reads each record from the input, trims whitespace from the taxid, parent, and rank,
|
||||||
// and adds the taxon to the taxonomy. If an error occurs while adding a taxon, the function logs
|
// and adds the taxon to the taxonomy. If an error occurs while adding a taxon, the function logs
|
||||||
// a fatal error and terminates the program.
|
// a fatal error and terminates the program.
|
||||||
func loadNodeTable(reader io.Reader, taxonomy *obitax.Taxonomy) {
|
func loadNodeTable(reader io.Reader, taxonomy *Taxonomy) {
|
||||||
file := csv.NewReader(reader)
|
file := csv.NewReader(reader)
|
||||||
file.Comma = '|'
|
file.Comma = '|'
|
||||||
file.Comment = '#'
|
file.Comment = '#'
|
||||||
@ -66,7 +65,7 @@ func loadNodeTable(reader io.Reader, taxonomy *obitax.Taxonomy) {
|
|||||||
// The number of taxon names successfully loaded into the taxonomy. If a line is too long, -1 is returned.
|
// The number of taxon names successfully loaded into the taxonomy. If a line is too long, -1 is returned.
|
||||||
// The function processes each line, trims whitespace from the taxid, name, and class name, and sets
|
// The function processes each line, trims whitespace from the taxid, name, and class name, and sets
|
||||||
// the name in the taxonomy if the conditions are met.
|
// the name in the taxonomy if the conditions are met.
|
||||||
func loadNameTable(reader io.Reader, taxonomy *obitax.Taxonomy, onlysn bool) int {
|
func loadNameTable(reader io.Reader, taxonomy *Taxonomy, onlysn bool) int {
|
||||||
// file := csv.NewReader(reader)
|
// file := csv.NewReader(reader)
|
||||||
// file.Comma = '|'
|
// file.Comma = '|'
|
||||||
// file.Comment = '#'
|
// file.Comment = '#'
|
||||||
@ -112,7 +111,7 @@ func loadNameTable(reader io.Reader, taxonomy *obitax.Taxonomy, onlysn bool) int
|
|||||||
//
|
//
|
||||||
// The number of alias mappings successfully loaded into the taxonomy. The function processes
|
// The number of alias mappings successfully loaded into the taxonomy. The function processes
|
||||||
// each record, trims whitespace from the old and new taxid, and adds the alias to the taxonomy.
|
// each record, trims whitespace from the old and new taxid, and adds the alias to the taxonomy.
|
||||||
func loadMergedTable(reader io.Reader, taxonomy *obitax.Taxonomy) int {
|
func loadMergedTable(reader io.Reader, taxonomy *Taxonomy) int {
|
||||||
file := csv.NewReader(reader)
|
file := csv.NewReader(reader)
|
||||||
file.Comma = '|'
|
file.Comma = '|'
|
||||||
file.Comment = '#'
|
file.Comment = '#'
|
||||||
@ -143,9 +142,9 @@ func loadMergedTable(reader io.Reader, taxonomy *obitax.Taxonomy) int {
|
|||||||
// Returns:
|
// Returns:
|
||||||
// - A pointer to the obitax.Taxonomy object containing the loaded taxonomy data, or an error
|
// - A pointer to the obitax.Taxonomy object containing the loaded taxonomy data, or an error
|
||||||
// if any of the files cannot be opened or read.
|
// if any of the files cannot be opened or read.
|
||||||
func LoadNCBITaxDump(directory string, onlysn bool) (*obitax.Taxonomy, error) {
|
func LoadNCBITaxDump(directory string, onlysn bool) (*Taxonomy, error) {
|
||||||
|
|
||||||
taxonomy := obitax.NewTaxonomy("NCBI Taxonomy", "taxon", obiutils.AsciiDigitSet)
|
taxonomy := NewTaxonomy("NCBI Taxonomy", "taxon", obiutils.AsciiDigitSet)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load the Taxonomy nodes
|
// Load the Taxonomy nodes
|
@ -1,11 +1,10 @@
|
|||||||
package ncbitaxdump
|
package obitax
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -63,9 +62,9 @@ func IsNCBITarTaxDump(path string) bool {
|
|||||||
return citations && division && gencode && names && delnodes && gc && merged && nodes
|
return citations && division && gencode && names && delnodes && gc && merged && nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadNCBITarTaxDump(path string, onlysn bool) (*obitax.Taxonomy, error) {
|
func LoadNCBITarTaxDump(path string, onlysn bool) (*Taxonomy, error) {
|
||||||
|
|
||||||
taxonomy := obitax.NewTaxonomy("NCBI Taxonomy", "taxon", obiutils.AsciiDigitSet)
|
taxonomy := NewTaxonomy("NCBI Taxonomy", "taxon", obiutils.AsciiDigitSet)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load the Taxonomy nodes
|
// Load the Taxonomy nodes
|
@ -1,26 +1,23 @@
|
|||||||
package obitaxformat
|
package obitax
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitaxformat/csvtaxdump"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitaxformat/ncbitaxdump"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TaxonomyLoader func(path string, onlysn bool) (*obitax.Taxonomy, error)
|
type TaxonomyLoader func(path string, onlysn bool) (*Taxonomy, error)
|
||||||
|
|
||||||
func DetectTaxonomyTarFormat(path string) (TaxonomyLoader, error) {
|
func DetectTaxonomyTarFormat(path string) (TaxonomyLoader, error) {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case ncbitaxdump.IsNCBITarTaxDump(path):
|
case IsNCBITarTaxDump(path):
|
||||||
log.Infof("NCBI Taxdump Tar Archive detected: %s", path)
|
log.Infof("NCBI Taxdump Tar Archive detected: %s", path)
|
||||||
return ncbitaxdump.LoadNCBITarTaxDump, nil
|
return LoadNCBITarTaxDump, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("unknown taxonomy format: %s", path)
|
return nil, fmt.Errorf("unknown taxonomy format: %s", path)
|
||||||
@ -44,7 +41,7 @@ func DetectTaxonomyFormat(path string) (TaxonomyLoader, error) {
|
|||||||
if fileInfo.IsDir() {
|
if fileInfo.IsDir() {
|
||||||
// For the moment, we only support NCBI Taxdump directory format
|
// For the moment, we only support NCBI Taxdump directory format
|
||||||
log.Infof("NCBI Taxdump detected: %s", path)
|
log.Infof("NCBI Taxdump detected: %s", path)
|
||||||
return ncbitaxdump.LoadNCBITaxDump, nil
|
return LoadNCBITaxDump, nil
|
||||||
} else {
|
} else {
|
||||||
file, err := obiutils.Ropen(path)
|
file, err := obiutils.Ropen(path)
|
||||||
|
|
||||||
@ -63,7 +60,7 @@ func DetectTaxonomyFormat(path string) (TaxonomyLoader, error) {
|
|||||||
|
|
||||||
switch mimetype.String() {
|
switch mimetype.String() {
|
||||||
case "text/csv":
|
case "text/csv":
|
||||||
return csvtaxdump.LoadCSVTaxonomy, nil
|
return LoadCSVTaxonomy, nil
|
||||||
case "application/x-tar":
|
case "application/x-tar":
|
||||||
return DetectTaxonomyTarFormat(path)
|
return DetectTaxonomyTarFormat(path)
|
||||||
}
|
}
|
||||||
@ -74,7 +71,7 @@ func DetectTaxonomyFormat(path string) (TaxonomyLoader, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadTaxonomy(path string, onlysn bool) (*obitax.Taxonomy, error) {
|
func LoadTaxonomy(path string, onlysn bool) (*Taxonomy, error) {
|
||||||
loader, err := DetectTaxonomyFormat(path)
|
loader, err := DetectTaxonomyFormat(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obicorazick"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obicorazick"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obigrep"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obigrep"
|
||||||
@ -345,7 +345,7 @@ func CLIAnnotationPipeline() obiiter.Pipeable {
|
|||||||
worker := CLIAnnotationWorker()
|
worker := CLIAnnotationWorker()
|
||||||
|
|
||||||
annotator := obiseq.SeqToSliceConditionalWorker(predicate, worker, false)
|
annotator := obiseq.SeqToSliceConditionalWorker(predicate, worker, false)
|
||||||
f := obiiter.SliceWorkerPipe(annotator, false, obioptions.CLIParallelWorkers())
|
f := obiiter.SliceWorkerPipe(annotator, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
@ -298,7 +298,7 @@ func CLIOBIClean(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
|
|
||||||
BuildSeqGraph(samples,
|
BuildSeqGraph(samples,
|
||||||
DistStepMax(),
|
DistStepMax(),
|
||||||
obioptions.CLIParallelWorkers())
|
obidefault.ParallelWorkers())
|
||||||
|
|
||||||
if RatioMax() < 1.0 {
|
if RatioMax() < 1.0 {
|
||||||
bar := (*progressbar.ProgressBar)(nil)
|
bar := (*progressbar.ProgressBar)(nil)
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
@ -234,9 +234,9 @@ func ICleanDB(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
obichunk.OptionSortOnMemory(),
|
obichunk.OptionSortOnMemory(),
|
||||||
obichunk.OptionSubCategory("taxid"),
|
obichunk.OptionSubCategory("taxid"),
|
||||||
obichunk.OptionsParallelWorkers(
|
obichunk.OptionsParallelWorkers(
|
||||||
obioptions.CLIParallelWorkers()),
|
obidefault.ParallelWorkers()),
|
||||||
obichunk.OptionsBatchSize(
|
obichunk.OptionsBatchSize(
|
||||||
obioptions.CLIBatchSize()),
|
obidefault.BatchSize()),
|
||||||
obichunk.OptionNAValue("NA"),
|
obichunk.OptionNAValue("NA"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -261,22 +261,22 @@ func ICleanDB(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
goodTaxa := obiseq.IsAValidTaxon(taxonomy, CLIUpdateTaxids()).And(rankPredicate)
|
goodTaxa := obiseq.IsAValidTaxon(taxonomy, CLIUpdateTaxids()).And(rankPredicate)
|
||||||
|
|
||||||
usable := unique.FilterOn(goodTaxa,
|
usable := unique.FilterOn(goodTaxa,
|
||||||
obioptions.CLIBatchSize(),
|
obidefault.BatchSize(),
|
||||||
obioptions.CLIParallelWorkers())
|
obidefault.ParallelWorkers())
|
||||||
|
|
||||||
annotated := usable.MakeIWorker(obiseq.MakeSetSpeciesWorker(taxonomy),
|
annotated := usable.MakeIWorker(obiseq.MakeSetSpeciesWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).MakeIWorker(obiseq.MakeSetGenusWorker(taxonomy),
|
).MakeIWorker(obiseq.MakeSetGenusWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).MakeIWorker(obiseq.MakeSetFamilyWorker(taxonomy),
|
).MakeIWorker(obiseq.MakeSetFamilyWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
// .MakeIWorker(SequenceTrust,
|
// .MakeIWorker(SequenceTrust,
|
||||||
// false,
|
// false,
|
||||||
// obioptions.CLIParallelWorkers(),
|
// obidefault.ParallelWorkers(),
|
||||||
// )
|
// )
|
||||||
|
|
||||||
source, references := annotated.Load()
|
source, references := annotated.Load()
|
||||||
@ -284,7 +284,7 @@ func ICleanDB(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
mannwithney := MakeSequenceFamilyGenusWorker(references)
|
mannwithney := MakeSequenceFamilyGenusWorker(references)
|
||||||
|
|
||||||
partof := obiiter.IBatchOver(source, references,
|
partof := obiiter.IBatchOver(source, references,
|
||||||
obioptions.CLIBatchSize())
|
obidefault.BatchSize())
|
||||||
|
|
||||||
// genera_iterator, err := obichunk.ISequenceChunk(
|
// genera_iterator, err := obichunk.ISequenceChunk(
|
||||||
// annotated,
|
// annotated,
|
||||||
|
@ -8,11 +8,11 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obigraph"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obigraph"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obisuffix"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obisuffix"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiannotate"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiannotate"
|
||||||
@ -472,7 +472,7 @@ func CLIOBIMinion(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
CLISampleAttribute(),
|
CLISampleAttribute(),
|
||||||
seqs,
|
seqs,
|
||||||
CLIDistStepMax(),
|
CLIDistStepMax(),
|
||||||
obioptions.CLIParallelWorkers())
|
obidefault.ParallelWorkers())
|
||||||
if bar != nil {
|
if bar != nil {
|
||||||
bar.Add(1)
|
bar.Add(1)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExpandListOfFiles(check_ext bool, filenames ...string) ([]string, error) {
|
func ExpandListOfFiles(check_ext bool, filenames ...string) ([]string, error) {
|
||||||
@ -102,13 +101,13 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
|
|||||||
|
|
||||||
opts = append(opts, obiformats.OptionsReadQualities(obidefault.ReadQualities()))
|
opts = append(opts, obiformats.OptionsReadQualities(obidefault.ReadQualities()))
|
||||||
|
|
||||||
nworkers := obioptions.CLIReadParallelWorkers()
|
nworkers := obidefault.ReadParallelWorkers()
|
||||||
if nworkers < 2 {
|
if nworkers < 2 {
|
||||||
nworkers = 2
|
nworkers = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
||||||
opts = append(opts, obiformats.OptionsBatchSize(obioptions.CLIBatchSize()))
|
opts = append(opts, obiformats.OptionsBatchSize(obidefault.BatchSize()))
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsFullFileBatch(FullFileBatch()))
|
opts = append(opts, obiformats.OptionsFullFileBatch(FullFileBatch()))
|
||||||
|
|
||||||
@ -159,7 +158,7 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
|
|||||||
nreader := 1
|
nreader := 1
|
||||||
|
|
||||||
if CLINoInputOrder() {
|
if CLINoInputOrder() {
|
||||||
nreader = obioptions.ParallelFilesRead()
|
nreader = obidefault.ParallelFilesRead()
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator = obiformats.ReadSequencesBatchFromFiles(
|
iterator = obiformats.ReadSequencesBatchFromFiles(
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func BuildPairedFileNames(filename string) (string, string) {
|
func BuildPairedFileNames(filename string) (string, string) {
|
||||||
@ -53,10 +53,10 @@ func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
|||||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIWriteParallelWorkers()
|
nworkers := obidefault.WriteParallelWorkers()
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
||||||
opts = append(opts, obiformats.OptionsBatchSize(obioptions.CLIBatchSize()))
|
opts = append(opts, obiformats.OptionsBatchSize(obidefault.BatchSize()))
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsCompressed(CLICompressed()))
|
opts = append(opts, obiformats.OptionsCompressed(CLICompressed()))
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package obicsv
|
package obicsv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
)
|
)
|
||||||
|
|
||||||
// __options__ holds configuration options for processing.
|
// __options__ holds configuration options for processing.
|
||||||
@ -53,8 +54,8 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
with_progress_bar: false,
|
with_progress_bar: false,
|
||||||
filename: "-",
|
filename: "-",
|
||||||
buffer_size: 2,
|
buffer_size: 2,
|
||||||
parallel_workers: obioptions.CLIReadParallelWorkers(),
|
parallel_workers: obidefault.ReadParallelWorkers(),
|
||||||
batch_size: obioptions.CLIBatchSize(),
|
batch_size: obidefault.BatchSize(),
|
||||||
no_order: false,
|
no_order: false,
|
||||||
full_file_batch: false,
|
full_file_batch: false,
|
||||||
closefile: false,
|
closefile: false,
|
||||||
@ -69,7 +70,7 @@ func MakeOptions(setters []WithOption) Options {
|
|||||||
csv_quality: false,
|
csv_quality: false,
|
||||||
csv_separator: ",",
|
csv_separator: ",",
|
||||||
csv_navalue: "NA",
|
csv_navalue: "NA",
|
||||||
csv_keys: make(CSVHeader, 0),
|
csv_keys: make(obiiter.CSVHeader, 0),
|
||||||
csv_auto: false,
|
csv_auto: false,
|
||||||
source: "unknown",
|
source: "unknown",
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ package obicsv
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CLIWriteSequenceCSV(iterator obiiter.IBioSequence,
|
func CLIWriteSequenceCSV(iterator obiiter.IBioSequence,
|
||||||
terminalAction bool, filenames ...string) *ICSVRecord {
|
terminalAction bool, filenames ...string) *obiiter.ICSVRecord {
|
||||||
|
|
||||||
if obiconvert.CLIProgressBar() {
|
if obiconvert.CLIProgressBar() {
|
||||||
iterator = iterator.Speed("Writing CSV")
|
iterator = iterator.Speed("Writing CSV")
|
||||||
@ -17,14 +17,14 @@ func CLIWriteSequenceCSV(iterator obiiter.IBioSequence,
|
|||||||
|
|
||||||
opts := make([]WithOption, 0, 10)
|
opts := make([]WithOption, 0, 10)
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers() / 4
|
nworkers := obidefault.ParallelWorkers() / 4
|
||||||
if nworkers < 2 {
|
if nworkers < 2 {
|
||||||
nworkers = 2
|
nworkers = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = append(opts, OptionsParallelWorkers(nworkers))
|
opts = append(opts, OptionsParallelWorkers(nworkers))
|
||||||
opts = append(opts, OptionsBatchSize(obioptions.CLIBatchSize()))
|
opts = append(opts, OptionsBatchSize(obidefault.BatchSize()))
|
||||||
opts = append(opts, OptionsCompressed(obiconvert.CLICompressed()))
|
opts = append(opts, OptionsCompressed(obidefault.CompressOutput()))
|
||||||
|
|
||||||
opts = append(opts, CSVId(CLIPrintId()),
|
opts = append(opts, CSVId(CLIPrintId()),
|
||||||
CSVCount(CLIPrintCount()),
|
CSVCount(CLIPrintCount()),
|
||||||
@ -42,12 +42,12 @@ func CLIWriteSequenceCSV(iterator obiiter.IBioSequence,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func CLICSVWriter(iterator *ICSVRecord,
|
func CLICSVWriter(iterator *obiiter.ICSVRecord,
|
||||||
terminalAction bool,
|
terminalAction bool,
|
||||||
options ...WithOption) *ICSVRecord {
|
options ...WithOption) *obiiter.ICSVRecord {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var newIter *ICSVRecord
|
var newIter *obiiter.ICSVRecord
|
||||||
|
|
||||||
if obiconvert.CLIOutPutFileName() != "-" {
|
if obiconvert.CLIOutPutFileName() != "-" {
|
||||||
options = append(options, OptionFileName(obiconvert.CLIOutPutFileName()))
|
options = append(options, OptionFileName(obiconvert.CLIOutPutFileName()))
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CSVSequenceHeader(opt Options) CSVHeader {
|
func CSVSequenceHeader(opt Options) obiiter.CSVHeader {
|
||||||
keys := opt.CSVKeys()
|
keys := opt.CSVKeys()
|
||||||
record := make(CSVHeader, 0, len(keys)+4)
|
record := make(obiiter.CSVHeader, 0, len(keys)+4)
|
||||||
|
|
||||||
if opt.CSVId() {
|
if opt.CSVId() {
|
||||||
record.AppendField("id")
|
record.AppendField("id")
|
||||||
@ -45,12 +45,12 @@ func CSVSequenceHeader(opt Options) CSVHeader {
|
|||||||
return record
|
return record
|
||||||
}
|
}
|
||||||
|
|
||||||
func CSVBatchFromSequences(batch obiiter.BioSequenceBatch, opt Options) CSVRecordBatch {
|
func CSVBatchFromSequences(batch obiiter.BioSequenceBatch, opt Options) obiiter.CSVRecordBatch {
|
||||||
keys := opt.CSVKeys()
|
keys := opt.CSVKeys()
|
||||||
csvslice := make([]CSVRecord, batch.Len())
|
csvslice := make([]obiiter.CSVRecord, batch.Len())
|
||||||
|
|
||||||
for i, sequence := range batch.Slice() {
|
for i, sequence := range batch.Slice() {
|
||||||
record := make(CSVRecord)
|
record := make(obiiter.CSVRecord)
|
||||||
|
|
||||||
if opt.CSVId() {
|
if opt.CSVId() {
|
||||||
record["id"] = sequence.Id()
|
record["id"] = sequence.Id()
|
||||||
@ -108,10 +108,10 @@ func CSVBatchFromSequences(batch obiiter.BioSequenceBatch, opt Options) CSVRecor
|
|||||||
csvslice[i] = record
|
csvslice[i] = record
|
||||||
}
|
}
|
||||||
|
|
||||||
return MakeCSVRecordBatch(batch.Source(), batch.Order(), csvslice)
|
return obiiter.MakeCSVRecordBatch(batch.Source(), batch.Order(), csvslice)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCSVSequenceIterator(iter obiiter.IBioSequence, options ...WithOption) *ICSVRecord {
|
func NewCSVSequenceIterator(iter obiiter.IBioSequence, options ...WithOption) *obiiter.ICSVRecord {
|
||||||
|
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ func NewCSVSequenceIterator(iter obiiter.IBioSequence, options ...WithOption) *I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newIter := NewICSVRecord()
|
newIter := obiiter.NewICSVRecord()
|
||||||
newIter.SetHeader(CSVSequenceHeader(opt))
|
newIter.SetHeader(CSVSequenceHeader(opt))
|
||||||
|
|
||||||
nwriters := opt.ParallelWorkers()
|
nwriters := opt.ParallelWorkers()
|
||||||
|
@ -7,12 +7,13 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func FormatCVSBatch(batch CSVRecordBatch, header CSVHeader, navalue string) *bytes.Buffer {
|
func FormatCVSBatch(batch obiiter.CSVRecordBatch, header obiiter.CSVHeader, navalue string) *bytes.Buffer {
|
||||||
buff := new(bytes.Buffer)
|
buff := new(bytes.Buffer)
|
||||||
csv := csv.NewWriter(buff)
|
csv := csv.NewWriter(buff)
|
||||||
|
|
||||||
@ -44,14 +45,14 @@ func FormatCVSBatch(batch CSVRecordBatch, header CSVHeader, navalue string) *byt
|
|||||||
return buff
|
return buff
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteCSV(iterator *ICSVRecord,
|
func WriteCSV(iterator *obiiter.ICSVRecord,
|
||||||
file io.WriteCloser,
|
file io.WriteCloser,
|
||||||
options ...WithOption) (*ICSVRecord, error) {
|
options ...WithOption) (*obiiter.ICSVRecord, error) {
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
|
|
||||||
file, _ = obiutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
file, _ = obiutils.CompressStream(file, opt.CompressedFile(), opt.CloseFile())
|
||||||
|
|
||||||
newIter := NewICSVRecord()
|
newIter := obiiter.NewICSVRecord()
|
||||||
|
|
||||||
nwriters := opt.ParallelWorkers()
|
nwriters := opt.ParallelWorkers()
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ func WriteCSV(iterator *ICSVRecord,
|
|||||||
log.Debugf("Writing CSV file done")
|
log.Debugf("Writing CSV file done")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
ff := func(iterator *ICSVRecord) {
|
ff := func(iterator *obiiter.ICSVRecord) {
|
||||||
for iterator.Next() {
|
for iterator.Next() {
|
||||||
|
|
||||||
batch := iterator.Get()
|
batch := iterator.Get()
|
||||||
@ -108,8 +109,8 @@ func WriteCSV(iterator *ICSVRecord,
|
|||||||
// os.Stdout as the output file, and the options slice.
|
// os.Stdout as the output file, and the options slice.
|
||||||
//
|
//
|
||||||
// The function returns the same bio sequence iterator and an error if any occurred.
|
// The function returns the same bio sequence iterator and an error if any occurred.
|
||||||
func WriteCSVToStdout(iterator *ICSVRecord,
|
func WriteCSVToStdout(iterator *obiiter.ICSVRecord,
|
||||||
options ...WithOption) (*ICSVRecord, error) {
|
options ...WithOption) (*obiiter.ICSVRecord, error) {
|
||||||
// options = append(options, OptionDontCloseFile())
|
// options = append(options, OptionDontCloseFile())
|
||||||
options = append(options, OptionCloseFile())
|
options = append(options, OptionCloseFile())
|
||||||
return WriteCSV(iterator, os.Stdout, options...)
|
return WriteCSV(iterator, os.Stdout, options...)
|
||||||
@ -126,9 +127,9 @@ func WriteCSVToStdout(iterator *ICSVRecord,
|
|||||||
// Returns:
|
// Returns:
|
||||||
// - obiiter.IBioSequence: The updated biosequence iterator.
|
// - obiiter.IBioSequence: The updated biosequence iterator.
|
||||||
// - error: Any error that occurred during the writing process.
|
// - error: Any error that occurred during the writing process.
|
||||||
func WriteCSVToFile(iterator *ICSVRecord,
|
func WriteCSVToFile(iterator *obiiter.ICSVRecord,
|
||||||
filename string,
|
filename string,
|
||||||
options ...WithOption) (*ICSVRecord, error) {
|
options ...WithOption) (*obiiter.ICSVRecord, error) {
|
||||||
|
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
flags := os.O_WRONLY | os.O_CREATE
|
flags := os.O_WRONLY | os.O_CREATE
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package obidemerge
|
package obidemerge
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,5 +34,5 @@ func MakeDemergeWorker(key string) obiseq.SeqWorker {
|
|||||||
|
|
||||||
func CLIDemergeSequences(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
func CLIDemergeSequences(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
||||||
worker := MakeDemergeWorker(CLIDemergeSlot())
|
worker := MakeDemergeWorker(CLIDemergeSlot())
|
||||||
return iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers(), 0)
|
return iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers(), 0)
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ package obidistribute
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,13 +25,13 @@ func CLIDistributeSequence(sequences obiiter.IBioSequence) {
|
|||||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers() / 4
|
nworkers := obidefault.ParallelWorkers() / 4
|
||||||
if nworkers < 2 {
|
if nworkers < 2 {
|
||||||
nworkers = 2
|
nworkers = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers),
|
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers),
|
||||||
obiformats.OptionsBatchSize(obioptions.CLIBatchSize()),
|
obiformats.OptionsBatchSize(obidefault.BatchSize()),
|
||||||
obiformats.OptionsAppendFile(CLIAppendSequences()),
|
obiformats.OptionsAppendFile(CLIAppendSequences()),
|
||||||
obiformats.OptionsCompressed(obiconvert.CLICompressed()))
|
obiformats.OptionsCompressed(obiconvert.CLICompressed()))
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ func CLIDistributeSequence(sequences obiiter.IBioSequence) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatcher := sequences.Distribute(CLISequenceClassifier(),
|
dispatcher := sequences.Distribute(CLISequenceClassifier(),
|
||||||
obioptions.CLIBatchSize())
|
obidefault.BatchSize())
|
||||||
|
|
||||||
obiformats.WriterDispatcher(CLIFileNamePattern(),
|
obiformats.WriterDispatcher(CLIFileNamePattern(),
|
||||||
dispatcher, formater, opts...,
|
dispatcher, formater, opts...,
|
||||||
|
@ -3,9 +3,9 @@ package obifind
|
|||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type __options__ struct {
|
type __options__ struct {
|
||||||
@ -38,7 +38,7 @@ type WithOption func(Options)
|
|||||||
// - An Options instance with the specified settings.
|
// - An Options instance with the specified settings.
|
||||||
func MakeOptions(setters []WithOption) Options {
|
func MakeOptions(setters []WithOption) Options {
|
||||||
o := __options__{
|
o := __options__{
|
||||||
batch_size: obioptions.CLIBatchSize(), // Number of items to process in a batch
|
batch_size: obidefault.BatchSize(), // Number of items to process in a batch
|
||||||
with_pattern: true,
|
with_pattern: true,
|
||||||
with_parent: false,
|
with_parent: false,
|
||||||
with_path: false,
|
with_path: false,
|
||||||
@ -192,12 +192,12 @@ func OptionsWithMetadata(values ...string) WithOption {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCSVTaxaIterator(iterator *obitax.ITaxon, options ...WithOption) *obicsv.ICSVRecord {
|
func NewCSVTaxaIterator(iterator *obitax.ITaxon, options ...WithOption) *obiiter.ICSVRecord {
|
||||||
|
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
metakeys := make([]string, 0)
|
metakeys := make([]string, 0)
|
||||||
|
|
||||||
newIter := obicsv.NewICSVRecord()
|
newIter := obiiter.NewICSVRecord()
|
||||||
|
|
||||||
newIter.Add(1)
|
newIter.Add(1)
|
||||||
|
|
||||||
@ -240,11 +240,11 @@ func NewCSVTaxaIterator(iterator *obitax.ITaxon, options ...WithOption) *obicsv.
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
o := 0
|
o := 0
|
||||||
data := make([]obicsv.CSVRecord, 0, batch_size)
|
data := make([]obiiter.CSVRecord, 0, batch_size)
|
||||||
for iterator.Next() {
|
for iterator.Next() {
|
||||||
|
|
||||||
taxon := iterator.Get()
|
taxon := iterator.Get()
|
||||||
record := make(obicsv.CSVRecord)
|
record := make(obiiter.CSVRecord)
|
||||||
|
|
||||||
if opt.WithPattern() {
|
if opt.WithPattern() {
|
||||||
record["query"] = taxon.MetadataAsString("query")
|
record["query"] = taxon.MetadataAsString("query")
|
||||||
@ -282,15 +282,15 @@ func NewCSVTaxaIterator(iterator *obitax.ITaxon, options ...WithOption) *obicsv.
|
|||||||
|
|
||||||
data = append(data, record)
|
data = append(data, record)
|
||||||
if len(data) >= batch_size {
|
if len(data) >= batch_size {
|
||||||
newIter.Push(obicsv.MakeCSVRecordBatch(opt.Source(), o, data))
|
newIter.Push(obiiter.MakeCSVRecordBatch(opt.Source(), o, data))
|
||||||
data = make([]obicsv.CSVRecord, 0, batch_size)
|
data = make([]obiiter.CSVRecord, 0, batch_size)
|
||||||
o++
|
o++
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
newIter.Push(obicsv.MakeCSVRecordBatch(opt.Source(), o, data))
|
newIter.Push(obiiter.MakeCSVRecordBatch(opt.Source(), o, data))
|
||||||
}
|
}
|
||||||
|
|
||||||
newIter.Done()
|
newIter.Done()
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package obifind
|
package obifind
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ func CLIFilterRankRestriction(iterator *obitax.ITaxon) *obitax.ITaxon {
|
|||||||
return iterator
|
return iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
func CLICSVTaxaIterator(iterator *obitax.ITaxon) *obicsv.ICSVRecord {
|
func CLICSVTaxaIterator(iterator *obitax.ITaxon) *obiiter.ICSVRecord {
|
||||||
if iterator == nil {
|
if iterator == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -53,12 +54,12 @@ func CLICSVTaxaIterator(iterator *obitax.ITaxon) *obicsv.ICSVRecord {
|
|||||||
OptionsWithScientificName(CLIWithScientificName()),
|
OptionsWithScientificName(CLIWithScientificName()),
|
||||||
OptionsWithPath(CLIWithPath()),
|
OptionsWithPath(CLIWithPath()),
|
||||||
OptionsRawTaxid(CLIRawTaxid()),
|
OptionsRawTaxid(CLIRawTaxid()),
|
||||||
OptionsSource(obioptions.CLISelectedTaxonomy()),
|
OptionsSource(obidefault.SelectedTaxonomy()),
|
||||||
)
|
)
|
||||||
|
|
||||||
return NewCSVTaxaIterator(iterator, options...)
|
return NewCSVTaxaIterator(iterator, options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CLICSVTaxaWriter(iterator *obitax.ITaxon, terminalAction bool) *obicsv.ICSVRecord {
|
func CLICSVTaxaWriter(iterator *obitax.ITaxon, terminalAction bool) *obiiter.ICSVRecord {
|
||||||
return obicsv.CLICSVWriter(CLICSVTaxaIterator(iterator), terminalAction)
|
return obicsv.CLICSVWriter(CLICSVTaxaIterator(iterator), terminalAction)
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package obigrep
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ func CLIFilterSequence(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
|
|
||||||
log.Printf("Discarded sequences saved in file: %s\n", CLIDiscardedFileName())
|
log.Printf("Discarded sequences saved in file: %s\n", CLIDiscardedFileName())
|
||||||
newIter, discarded = iterator.DivideOn(predicate,
|
newIter, discarded = iterator.DivideOn(predicate,
|
||||||
obioptions.CLIBatchSize())
|
obidefault.BatchSize())
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_, err := obiconvert.CLIWriteBioSequences(discarded,
|
_, err := obiconvert.CLIWriteBioSequences(discarded,
|
||||||
@ -37,8 +37,8 @@ func CLIFilterSequence(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
newIter = iterator.FilterOn(predicate,
|
newIter = iterator.FilterOn(predicate,
|
||||||
obioptions.CLIBatchSize(),
|
obidefault.BatchSize(),
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package obijoin
|
package obijoin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ func CLIJoinSequences(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
|
|
||||||
worker := MakeJoinWorker(keys.Left, index, CLIUpdateId(), CLIUpdateSequence(), CLIUpdateQuality())
|
worker := MakeJoinWorker(keys.Left, index, CLIUpdateId(), CLIUpdateSequence(), CLIUpdateQuality())
|
||||||
|
|
||||||
iterator = iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers())
|
iterator = iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return iterator
|
return iterator
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obifp"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obifp"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ func CLILookForSharedKmers(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
source, references := CLIReference()
|
source, references := CLIReference()
|
||||||
|
|
||||||
if iterator == obiiter.NilIBioSequence {
|
if iterator == obiiter.NilIBioSequence {
|
||||||
iterator = obiiter.IBatchOver(source, references, obioptions.CLIBatchSize())
|
iterator = obiiter.IBatchOver(source, references, obidefault.BatchSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
if CLISelf() {
|
if CLISelf() {
|
||||||
@ -163,7 +163,7 @@ func CLILookForSharedKmers(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
CLIMaxKmerOccurs())
|
CLIMaxKmerOccurs())
|
||||||
|
|
||||||
worker := MakeCountMatchWorker(kmerMatch, CLIMinSharedKmers())
|
worker := MakeCountMatchWorker(kmerMatch, CLIMinSharedKmers())
|
||||||
newIter = iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers())
|
newIter = iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return newIter.FilterEmpty()
|
return newIter.FilterEmpty()
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ func CLIAlignSequences(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
source, references := CLIReference()
|
source, references := CLIReference()
|
||||||
|
|
||||||
if iterator == obiiter.NilIBioSequence {
|
if iterator == obiiter.NilIBioSequence {
|
||||||
iterator = obiiter.IBatchOver(source, references, obioptions.CLIBatchSize())
|
iterator = obiiter.IBatchOver(source, references, obidefault.BatchSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
if CLISelf() {
|
if CLISelf() {
|
||||||
@ -188,7 +188,7 @@ func CLIAlignSequences(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
CLISparseMode(),
|
CLISparseMode(),
|
||||||
CLIMaxKmerOccurs())
|
CLIMaxKmerOccurs())
|
||||||
worker := MakeKmerAlignWorker(kmerMatch, CLIMinSharedKmers(), CLIGap(), CLIScale(), CLIDelta(), CLIFastRelativeScore(), 0.8, true)
|
worker := MakeKmerAlignWorker(kmerMatch, CLIMinSharedKmers(), CLIGap(), CLIScale(), CLIDelta(), CLIFastRelativeScore(), 0.8, true)
|
||||||
newIter = iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers())
|
newIter = iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return newIter.FilterEmpty()
|
return newIter.FilterEmpty()
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package obikmersim
|
package obikmersim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"github.com/DavidGamba/go-getoptions"
|
"github.com/DavidGamba/go-getoptions"
|
||||||
@ -105,7 +105,7 @@ func CLIReference() (string, obiseq.BioSequenceSlice) {
|
|||||||
nreader := 1
|
nreader := 1
|
||||||
|
|
||||||
if obiconvert.CLINoInputOrder() {
|
if obiconvert.CLINoInputOrder() {
|
||||||
nreader = obioptions.StrictReadWorker()
|
nreader = obidefault.StrictReadWorker()
|
||||||
}
|
}
|
||||||
|
|
||||||
source, references := obiformats.ReadSequencesBatchFromFiles(
|
source, references := obiformats.ReadSequencesBatchFromFiles(
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
@ -30,7 +30,7 @@ import (
|
|||||||
// Returns:
|
// Returns:
|
||||||
// - seqworld: A matrix of float64 values representing the mapped coordinates.
|
// - seqworld: A matrix of float64 values representing the mapped coordinates.
|
||||||
func MapOnLandmarkSequences(library obiseq.BioSequenceSlice, landmark_idx []int, sizes ...int) obiutils.Matrix[float64] {
|
func MapOnLandmarkSequences(library obiseq.BioSequenceSlice, landmark_idx []int, sizes ...int) obiutils.Matrix[float64] {
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
@ -154,7 +154,7 @@ func CLISelectLandmarkSequences(iterator obiiter.IBioSequence) obiiter.IBioSeque
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if obioptions.CLIHasSelectedTaxonomy() {
|
if obidefault.HasSelectedTaxonomy() {
|
||||||
taxo := obitax.DefaultTaxonomy()
|
taxo := obitax.DefaultTaxonomy()
|
||||||
if taxo == nil {
|
if taxo == nil {
|
||||||
log.Fatal("No taxonomy available")
|
log.Fatal("No taxonomy available")
|
||||||
@ -191,6 +191,6 @@ func CLISelectLandmarkSequences(iterator obiiter.IBioSequence) obiiter.IBioSeque
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obiiter.IBatchOver(source, library, obioptions.CLIBatchSize())
|
return obiiter.IBatchOver(source, library, obidefault.BatchSize())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
@ -93,7 +93,7 @@ func (data *MatrixData) Update(s *obiseq.BioSequence, mapkey string) *MatrixData
|
|||||||
|
|
||||||
func IMatrix(iterator obiiter.IBioSequence) *MatrixData {
|
func IMatrix(iterator obiiter.IBioSequence) *MatrixData {
|
||||||
|
|
||||||
nproc := obioptions.CLIParallelWorkers()
|
nproc := obidefault.ParallelWorkers()
|
||||||
waiter := sync.WaitGroup{}
|
waiter := sync.WaitGroup{}
|
||||||
|
|
||||||
mapAttribute := CLIMapAttribute()
|
mapAttribute := CLIMapAttribute()
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
)
|
)
|
||||||
@ -168,7 +168,7 @@ func CLIAnnotateMicrosat(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
CLIMinFlankLength(),
|
CLIMinFlankLength(),
|
||||||
CLIReoriented())
|
CLIReoriented())
|
||||||
|
|
||||||
newIter = iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers())
|
newIter = iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return newIter.FilterEmpty()
|
return newIter.FilterEmpty()
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package obimultiplex
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obingslibrary"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obingslibrary"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
)
|
)
|
||||||
@ -19,8 +19,8 @@ func IExtractBarcode(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error
|
|||||||
obingslibrary.OptionAllowedIndel(CLIAllowsIndel()),
|
obingslibrary.OptionAllowedIndel(CLIAllowsIndel()),
|
||||||
obingslibrary.OptionUnidentified(CLIUnidentifiedFileName()),
|
obingslibrary.OptionUnidentified(CLIUnidentifiedFileName()),
|
||||||
obingslibrary.OptionDiscardErrors(!CLIConservedErrors()),
|
obingslibrary.OptionDiscardErrors(!CLIConservedErrors()),
|
||||||
obingslibrary.OptionParallelWorkers(obioptions.CLIParallelWorkers()),
|
obingslibrary.OptionParallelWorkers(obidefault.ParallelWorkers()),
|
||||||
obingslibrary.OptionBatchSize(obioptions.CLIBatchSize()),
|
obingslibrary.OptionBatchSize(obidefault.BatchSize()),
|
||||||
)
|
)
|
||||||
|
|
||||||
ngsfilter, err := CLINGSFIlter()
|
ngsfilter, err := CLINGSFIlter()
|
||||||
@ -35,14 +35,14 @@ func IExtractBarcode(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error
|
|||||||
|
|
||||||
if !CLIConservedErrors() {
|
if !CLIConservedErrors() {
|
||||||
log.Infoln("Discards unassigned sequences")
|
log.Infoln("Discards unassigned sequences")
|
||||||
out = out.FilterOn(obiseq.HasAttribute("obimultiplex_error").Not(), obioptions.CLIBatchSize())
|
out = out.FilterOn(obiseq.HasAttribute("obimultiplex_error").Not(), obidefault.BatchSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
var unidentified obiiter.IBioSequence
|
var unidentified obiiter.IBioSequence
|
||||||
if CLIUnidentifiedFileName() != "" {
|
if CLIUnidentifiedFileName() != "" {
|
||||||
log.Printf("Unassigned sequences saved in file: %s\n", CLIUnidentifiedFileName())
|
log.Printf("Unassigned sequences saved in file: %s\n", CLIUnidentifiedFileName())
|
||||||
unidentified, out = newIter.DivideOn(obiseq.HasAttribute("obimultiplex_error"),
|
unidentified, out = newIter.DivideOn(obiseq.HasAttribute("obimultiplex_error"),
|
||||||
obioptions.CLIBatchSize())
|
obidefault.BatchSize())
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_, err := obiconvert.CLIWriteBioSequences(unidentified,
|
_, err := obiconvert.CLIWriteBioSequences(unidentified,
|
||||||
@ -55,7 +55,7 @@ func IExtractBarcode(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
}
|
}
|
||||||
log.Printf("Sequence demultiplexing using %d workers\n", obioptions.CLIParallelWorkers())
|
log.Printf("Sequence demultiplexing using %d workers\n", obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
@ -222,7 +222,7 @@ func IAssemblePESequencesBatch(iterator obiiter.IBioSequence,
|
|||||||
log.Fatalln("Sequence data must be paired")
|
log.Fatalln("Sequence data must be paired")
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
|
|
||||||
if len(sizes) > 0 {
|
if len(sizes) > 0 {
|
||||||
nworkers = sizes[0]
|
nworkers = sizes[0]
|
||||||
|
@ -2,8 +2,8 @@ package obipcr
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ func CLIPCR(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error) {
|
|||||||
len(CLIReversePrimer()))+min(len(CLIForwardPrimer()),
|
len(CLIReversePrimer()))+min(len(CLIForwardPrimer()),
|
||||||
len(CLIReversePrimer()))/2,
|
len(CLIReversePrimer()))/2,
|
||||||
100,
|
100,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
log.Infof("Fragmenting sequence longer than %dbp into chuncks of %dbp",
|
log.Infof("Fragmenting sequence longer than %dbp into chuncks of %dbp",
|
||||||
CLIMaxLength()*1000,
|
CLIMaxLength()*1000,
|
||||||
@ -59,5 +59,5 @@ func CLIPCR(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error) {
|
|||||||
iterator = iterator.Pipe(frags)
|
iterator = iterator.Pipe(frags)
|
||||||
}
|
}
|
||||||
|
|
||||||
return iterator.LimitMemory(0.5).MakeISliceWorker(worker, false, obioptions.CLIParallelWorkers()), nil
|
return iterator.LimitMemory(0.5).MakeISliceWorker(worker, false, obidefault.ParallelWorkers()), nil
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"github.com/schollz/progressbar/v3"
|
"github.com/schollz/progressbar/v3"
|
||||||
@ -111,7 +111,7 @@ func MakeIndexingSliceWorker(indexslot, idslot string,
|
|||||||
waiting.Done()
|
waiting.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := max(min(obioptions.CLIParallelWorkers(), len(sequences)/10), 1)
|
nworkers := max(min(obidefault.ParallelWorkers(), len(sequences)/10), 1)
|
||||||
|
|
||||||
waiting.Add(nworkers)
|
waiting.Add(nworkers)
|
||||||
|
|
||||||
@ -134,9 +134,9 @@ func IndexFamilyDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
nref := len(references)
|
nref := len(references)
|
||||||
log.Infof("Done. Database contains %d sequences", nref)
|
log.Infof("Done. Database contains %d sequences", nref)
|
||||||
|
|
||||||
taxonomy, error := obioptions.CLILoadSelectedTaxonomy()
|
taxonomy := obitax.DefaultTaxonomy()
|
||||||
if error != nil {
|
if taxonomy == nil {
|
||||||
log.Panicln(error)
|
log.Panicln("No taxonomy available use the --taxonomy option")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infoln("Indexing database kmers...")
|
log.Infoln("Indexing database kmers...")
|
||||||
@ -155,15 +155,15 @@ func IndexFamilyDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
log.Info("done")
|
log.Info("done")
|
||||||
|
|
||||||
partof := obiiter.IBatchOver(source, references,
|
partof := obiiter.IBatchOver(source, references,
|
||||||
obioptions.CLIBatchSize()).MakeIWorker(obiseq.MakeSetSpeciesWorker(taxonomy),
|
obidefault.BatchSize()).MakeIWorker(obiseq.MakeSetSpeciesWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).MakeIWorker(obiseq.MakeSetGenusWorker(taxonomy),
|
).MakeIWorker(obiseq.MakeSetGenusWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).MakeIWorker(obiseq.MakeSetFamilyWorker(taxonomy),
|
).MakeIWorker(obiseq.MakeSetFamilyWorker(taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
|
|
||||||
family_iterator, err := obichunk.ISequenceChunk(
|
family_iterator, err := obichunk.ISequenceChunk(
|
||||||
@ -178,11 +178,11 @@ func IndexFamilyDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
family_iterator.MakeISliceWorker(
|
family_iterator.MakeISliceWorker(
|
||||||
MakeStartClusterSliceWorker("reffamidx", 0.9),
|
MakeStartClusterSliceWorker("reffamidx", 0.9),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).MakeISliceWorker(
|
).MakeISliceWorker(
|
||||||
MakeIndexingSliceWorker("reffamidx_in", "reffamidx_id", &refcounts, taxonomy),
|
MakeIndexingSliceWorker("reffamidx_in", "reffamidx_id", &refcounts, taxonomy),
|
||||||
false,
|
false,
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
).Speed("Family Indexing", nref).Consume()
|
).Speed("Family Indexing", nref).Consume()
|
||||||
|
|
||||||
clusters := obiseq.MakeBioSequenceSlice(0)
|
clusters := obiseq.MakeBioSequenceSlice(0)
|
||||||
@ -240,7 +240,7 @@ func IndexFamilyDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
waiting.Done()
|
waiting.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
waiting.Add(nworkers)
|
waiting.Add(nworkers)
|
||||||
|
|
||||||
for w := 0; w < nworkers; w++ {
|
for w := 0; w < nworkers; w++ {
|
||||||
@ -250,7 +250,7 @@ func IndexFamilyDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
waiting.Wait()
|
waiting.Wait()
|
||||||
|
|
||||||
results := obiiter.IBatchOver(source, references,
|
results := obiiter.IBatchOver(source, references,
|
||||||
obioptions.CLIBatchSize()).Speed("Writing db", nref)
|
obidefault.BatchSize()).Speed("Writing db", nref)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
@ -32,7 +32,7 @@ func GeomIndexSesquence(seqidx int,
|
|||||||
|
|
||||||
iseq_channel := make(chan int)
|
iseq_channel := make(chan int)
|
||||||
|
|
||||||
for k := 0; k < obioptions.CLIParallelWorkers(); k++ {
|
for k := 0; k < obidefault.ParallelWorkers(); k++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
@ -274,7 +274,7 @@ func IndexReferenceDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
indexed.Done()
|
indexed.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
indexed.Add(nworkers)
|
indexed.Add(nworkers)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@ -285,5 +285,5 @@ func IndexReferenceDB(iterator obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
go f()
|
go f()
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexed.Rebatch(obioptions.CLIBatchSize())
|
return indexed.Rebatch(obidefault.BatchSize())
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package obiscript
|
package obiscript
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilua"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obilua"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CLIScriptPipeline() obiiter.Pipeable {
|
func CLIScriptPipeline() obiiter.Pipeable {
|
||||||
|
|
||||||
pipe := obilua.LuaScriptPipe(CLIScriptFilename(), true, obioptions.CLIParallelWorkers())
|
pipe := obilua.LuaScriptPipe(CLIScriptFilename(), true, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return pipe
|
return pipe
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiapat"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ func CLISlitPipeline() obiiter.Pipeable {
|
|||||||
worker := SplitPatternWorker(CLIConfig())
|
worker := SplitPatternWorker(CLIConfig())
|
||||||
|
|
||||||
annotator := obiseq.SeqToSliceWorker(worker, false)
|
annotator := obiseq.SeqToSliceWorker(worker, false)
|
||||||
f := obiiter.SliceWorkerPipe(annotator, false, obioptions.CLIParallelWorkers())
|
f := obiiter.SliceWorkerPipe(annotator, false, obidefault.ParallelWorkers())
|
||||||
|
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package obisummary
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
@ -154,7 +154,7 @@ func (data *DataSummary) Update(s *obiseq.BioSequence) *DataSummary {
|
|||||||
|
|
||||||
func ISummary(iterator obiiter.IBioSequence, summarise []string) map[string]interface{} {
|
func ISummary(iterator obiiter.IBioSequence, summarise []string) map[string]interface{} {
|
||||||
|
|
||||||
nproc := obioptions.CLIParallelWorkers()
|
nproc := obidefault.ParallelWorkers()
|
||||||
waiter := sync.WaitGroup{}
|
waiter := sync.WaitGroup{}
|
||||||
|
|
||||||
summaries := make([]*DataSummary, nproc)
|
summaries := make([]*DataSummary, nproc)
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obistats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
@ -200,5 +200,5 @@ func CLIGeomAssignTaxonomy(iterator obiiter.IBioSequence,
|
|||||||
) obiiter.IBioSequence {
|
) obiiter.IBioSequence {
|
||||||
|
|
||||||
worker := GeomIdentifySeqWorker(&references, taxo)
|
worker := GeomIdentifySeqWorker(&references, taxo)
|
||||||
return iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers(), 0)
|
return iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers(), 0)
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
||||||
@ -266,5 +266,5 @@ func CLIAssignTaxonomy(iterator obiiter.IBioSequence,
|
|||||||
|
|
||||||
worker := IdentifySeqWorker(references, refcounts, taxa, taxo, CLIRunExact())
|
worker := IdentifySeqWorker(references, refcounts, taxa, taxo, CLIRunExact())
|
||||||
|
|
||||||
return iterator.MakeIWorker(worker, false, obioptions.CLIParallelWorkers(), 0)
|
return iterator.MakeIWorker(worker, false, obidefault.ParallelWorkers(), 0)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package obitag
|
|||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
@ -87,15 +88,15 @@ func CLISaveRefetenceDB(db obiseq.BioSequenceSlice) {
|
|||||||
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
opts = append(opts, obiformats.OptionsFastSeqHeaderFormat(obiformats.FormatFastSeqJsonHeader))
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers() / 4
|
nworkers := obidefault.ParallelWorkers() / 4
|
||||||
if nworkers < 2 {
|
if nworkers < 2 {
|
||||||
nworkers = 2
|
nworkers = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
opts = append(opts, obiformats.OptionsParallelWorkers(nworkers))
|
||||||
opts = append(opts, obiformats.OptionsBatchSize(obioptions.CLIBatchSize()))
|
opts = append(opts, obiformats.OptionsBatchSize(obidefault.BatchSize()))
|
||||||
|
|
||||||
opts = append(opts, obiformats.OptionsCompressed(obiconvert.CLICompressed()))
|
opts = append(opts, obiformats.OptionsCompressed(obidefault.CompressOutput()))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obialign"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimultiplex"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimultiplex"
|
||||||
@ -44,7 +44,7 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
|||||||
log.Fatalln("Sequence data must be paired")
|
log.Fatalln("Sequence data must be paired")
|
||||||
}
|
}
|
||||||
|
|
||||||
nworkers := obioptions.CLIParallelWorkers()
|
nworkers := obidefault.ParallelWorkers()
|
||||||
ngsfilter, err := obimultiplex.CLINGSFIlter()
|
ngsfilter, err := obimultiplex.CLINGSFIlter()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -180,14 +180,14 @@ func IPCRTagPESequencesBatch(iterator obiiter.IBioSequence,
|
|||||||
|
|
||||||
if !obimultiplex.CLIConservedErrors() {
|
if !obimultiplex.CLIConservedErrors() {
|
||||||
log.Println("Discards unassigned sequences")
|
log.Println("Discards unassigned sequences")
|
||||||
iout = iout.FilterOn(obiseq.HasAttribute("obimultiplex_error").Not(), obioptions.CLIBatchSize())
|
iout = iout.FilterOn(obiseq.HasAttribute("obimultiplex_error").Not(), obidefault.BatchSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
var unidentified obiiter.IBioSequence
|
var unidentified obiiter.IBioSequence
|
||||||
if obimultiplex.CLIUnidentifiedFileName() != "" {
|
if obimultiplex.CLIUnidentifiedFileName() != "" {
|
||||||
log.Printf("Unassigned sequences saved in file: %s\n", obimultiplex.CLIUnidentifiedFileName())
|
log.Printf("Unassigned sequences saved in file: %s\n", obimultiplex.CLIUnidentifiedFileName())
|
||||||
unidentified, iout = iout.DivideOn(obiseq.HasAttribute("obimultiplex_error"),
|
unidentified, iout = iout.DivideOn(obiseq.HasAttribute("obimultiplex_error"),
|
||||||
obioptions.CLIBatchSize())
|
obidefault.BatchSize())
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_, err := obiconvert.CLIWriteBioSequences(unidentified,
|
_, err := obiconvert.CLIWriteBioSequences(unidentified,
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obichunk"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CLIUnique(sequences obiiter.IBioSequence) obiiter.IBioSequence {
|
func CLIUnique(sequences obiiter.IBioSequence) obiiter.IBioSequence {
|
||||||
@ -50,9 +50,9 @@ func CLIUnique(sequences obiiter.IBioSequence) obiiter.IBioSequence {
|
|||||||
|
|
||||||
options = append(options,
|
options = append(options,
|
||||||
obichunk.OptionsParallelWorkers(
|
obichunk.OptionsParallelWorkers(
|
||||||
obioptions.CLIParallelWorkers()),
|
obidefault.ParallelWorkers()),
|
||||||
obichunk.OptionsBatchSize(
|
obichunk.OptionsBatchSize(
|
||||||
obioptions.CLIBatchSize()),
|
obidefault.BatchSize()),
|
||||||
obichunk.OptionNAValue(CLINAValue()),
|
obichunk.OptionNAValue(CLINAValue()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user