mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
obimultiplex saves unassigned sequence
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obingslibrary"
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obioptions"
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"
|
||||
)
|
||||
|
||||
func IExtractBarcodeBatches(iterator obiseq.IBioSequenceBatch) (obiseq.IBioSequenceBatch, error) {
|
||||
@@ -31,9 +32,27 @@ func IExtractBarcodeBatches(iterator obiseq.IBioSequenceBatch) (obiseq.IBioSeque
|
||||
newIter := iterator.MakeISliceWorker(worker)
|
||||
|
||||
if !CLIConservedErrors() {
|
||||
log.Println("Discards unassigned sequences")
|
||||
newIter = newIter.Rebatch(obioptions.CLIBatchSize())
|
||||
}
|
||||
|
||||
var unidentified obiseq.IBioSequenceBatch
|
||||
if CLIUnidentifiedFileName() != "" {
|
||||
log.Printf("Unassigned sequences saved in file: %s\n", CLIUnidentifiedFileName())
|
||||
unidentified, newIter = newIter.DivideOn(obiseq.HasAttribute("demultiplex_error"),
|
||||
obioptions.CLIBatchSize())
|
||||
|
||||
go func() {
|
||||
_, err := obiconvert.WriteBioSequencesBatch(unidentified,
|
||||
true,
|
||||
CLIUnidentifiedFileName())
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("%v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
log.Printf("Sequence demultiplexing using %d workers\n", obioptions.CLIParallelWorkers())
|
||||
|
||||
return newIter, nil
|
||||
|
||||
Reference in New Issue
Block a user