mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-13 18:50:26 +00:00
add the --skip-empty option
Former-commit-id: ec9cb0ecaf90a61bf9289cf4c089b5cc2fcb65a5
This commit is contained in:
@@ -285,7 +285,7 @@ func Weight(sequence *obiseq.BioSequence) map[string]int {
|
||||
return weight
|
||||
}
|
||||
|
||||
func IOBIClean(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
||||
func CLIOBIClean(itertator obiiter.IBioSequence) obiiter.IBioSequence {
|
||||
|
||||
db := itertator.Load()
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ var __output_solexa_quality__ = false
|
||||
|
||||
var __no_progress_bar__ = false
|
||||
var __compressed__ = false
|
||||
var __skip_empty__ = false
|
||||
|
||||
var __output_file_name__ = "-"
|
||||
var __paired_file_name__ = ""
|
||||
@@ -70,6 +71,9 @@ func OutputModeOptionSet(options *getoptions.GetOpt) {
|
||||
options.Alias("Z"),
|
||||
options.Description("Output is compressed"))
|
||||
|
||||
options.BoolVar(&__skip_empty__, "skip-empty", __skip_empty__,
|
||||
options.Description("Sequences of length equal to zero are suppressed from the output"))
|
||||
|
||||
options.StringVar(&__output_file_name__, "out", __output_file_name__,
|
||||
options.Alias("o"),
|
||||
options.ArgName("FILENAME"),
|
||||
@@ -141,6 +145,10 @@ func CLICompressed() bool {
|
||||
return __compressed__
|
||||
}
|
||||
|
||||
func CLISkipEmpty() bool {
|
||||
return __skip_empty__
|
||||
}
|
||||
|
||||
func CLIInputFastHeaderFormat() string {
|
||||
switch {
|
||||
case __input_fastjson_format__:
|
||||
|
||||
@@ -80,6 +80,8 @@ func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
||||
var reverse string
|
||||
fn, reverse = BuildPairedFileNames(fn)
|
||||
opts = append(opts, obiformats.WritePairedReadsTo(reverse))
|
||||
} else {
|
||||
opts = append(opts, obiformats.OptionsSkipEmptySequence(CLISkipEmpty()))
|
||||
}
|
||||
|
||||
switch CLIOutputFormat() {
|
||||
@@ -91,6 +93,7 @@ func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
||||
newIter, err = obiformats.WriteSequencesToFile(iterator, fn, opts...)
|
||||
}
|
||||
} else {
|
||||
opts = append(opts, obiformats.OptionsSkipEmptySequence(CLISkipEmpty()))
|
||||
switch CLIOutputFormat() {
|
||||
case "fastq":
|
||||
newIter, err = obiformats.WriteFastqToStdout(iterator, opts...)
|
||||
@@ -99,6 +102,7 @@ func CLIWriteBioSequences(iterator obiiter.IBioSequence,
|
||||
default:
|
||||
newIter, err = obiformats.WriteSequencesToStdout(iterator, opts...)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user