Add a progress bar to chimera detection

This commit is contained in:
Eric Coissac
2025-03-25 08:37:27 +01:00
parent 8b379d30da
commit 2ab6f67d58
4 changed files with 27 additions and 3 deletions

View File

@ -73,10 +73,12 @@ func main() {
var identified obiiter.IBioSequence var identified obiiter.IBioSequence
fsrb := fs.Rebatch(obidefault.BatchSize())
if obitag.CLIGeometricMode() { if obitag.CLIGeometricMode() {
identified = obitag.CLIGeomAssignTaxonomy(fs, references, taxo) identified = obitag.CLIGeomAssignTaxonomy(fsrb, references, taxo)
} else { } else {
identified = obitag.CLIAssignTaxonomy(fs, references, taxo) identified = obitag.CLIAssignTaxonomy(fsrb, references, taxo)
} }
obiconvert.CLIWriteBioSequences(identified, true) obiconvert.CLIWriteBioSequences(identified, true)

View File

@ -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 = "8448783" var _Commit = "8b379d3"
var _Version = "Release 4.4.0" var _Version = "Release 4.4.0"
// Version returns the version of the obitools package. // Version returns the version of the obitools package.

View File

@ -2,10 +2,12 @@ package obiclean
import ( import (
"fmt" "fmt"
"os"
"sort" "sort"
"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/schollz/progressbar/v3"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -119,8 +121,20 @@ func AnnotateChimera(samples map[string]*[]*seqPCR) {
} }
pbopt := make([]progressbar.Option, 0, 5)
pbopt = append(pbopt,
progressbar.OptionSetWriter(os.Stderr),
progressbar.OptionSetWidth(15),
progressbar.OptionShowIts(),
progressbar.OptionSetPredictTime(true),
progressbar.OptionSetDescription("[Chimera detection]"),
)
bar := progressbar.NewOptions(len(samples), pbopt...)
for sn, sqs := range samples { for sn, sqs := range samples {
w(sn, sqs) w(sn, sqs)
bar.Add(1)
} }
} }

View File

@ -33,6 +33,7 @@ var __output_fastobi_format__ = false
var __no_progress_bar__ = false var __no_progress_bar__ = false
var __skip_empty__ = false var __skip_empty__ = false
var __skip_on_error__ = false
var __output_file_name__ = "-" var __output_file_name__ = "-"
var __paired_file_name__ = "" var __paired_file_name__ = ""
@ -97,6 +98,9 @@ func OutputOptionSet(options *getoptions.GetOpt) {
options.BoolVar(&__skip_empty__, "skip-empty", __skip_empty__, options.BoolVar(&__skip_empty__, "skip-empty", __skip_empty__,
options.Description("Sequences of length equal to zero are suppressed from the output")) options.Description("Sequences of length equal to zero are suppressed from the output"))
// options.BoolVar(&__skip_on_error__, "skip-on-error", __skip_on_error__,
// options.Description("Skip sequence with parsing error"))
options.BoolVar(&__output_in_fasta__, "fasta-output", false, options.BoolVar(&__output_in_fasta__, "fasta-output", false,
options.Description("Write sequence in fasta format (default if no quality data available).")) options.Description("Write sequence in fasta format (default if no quality data available)."))
@ -172,6 +176,10 @@ func CLISkipEmpty() bool {
return __skip_empty__ return __skip_empty__
} }
func CLISkipOnError() bool {
return __skip_on_error__
}
func CLIInputFastHeaderFormat() string { func CLIInputFastHeaderFormat() string {
switch { switch {
case __input_fastjson_format__: case __input_fastjson_format__: