Patch rev complement and first implementation of --auto in obicsv

Former-commit-id: f3020e81283b1073c4d1c2d2ff0887e3998e6764
This commit is contained in:
2023-11-07 09:37:07 +02:00
parent 6a6a6f6f2c
commit 61c30f9b6a
21 changed files with 270 additions and 107 deletions

View File

@ -12,7 +12,6 @@ type __options__ struct {
buffer_size int
batch_size int
full_file_batch bool
quality_shift int
parallel_workers int
closefile bool
appendfile bool
@ -27,6 +26,7 @@ type __options__ struct {
csv_keys []string
csv_separator string
csv_navalue string
csv_auto bool
paired_filename string
source string
}
@ -43,7 +43,6 @@ func MakeOptions(setters []WithOption) Options {
fastseq_header_writer: FormatFastSeqJsonHeader,
with_progress_bar: false,
buffer_size: 2,
quality_shift: 33,
parallel_workers: obioptions.CLIReadParallelWorkers(),
batch_size: obioptions.CLIBatchSize(),
full_file_batch: false,
@ -60,6 +59,7 @@ func MakeOptions(setters []WithOption) Options {
csv_separator: ",",
csv_navalue: "NA",
csv_keys: make([]string, 0),
csv_auto: false,
paired_filename: "",
source: "",
}
@ -73,10 +73,6 @@ func MakeOptions(setters []WithOption) Options {
return opt
}
func (opt Options) QualityShift() int {
return opt.pointer.quality_shift
}
func (opt Options) BatchSize() int {
return opt.pointer.batch_size
}
@ -153,6 +149,10 @@ func (opt Options) CSVNAValue() string {
return opt.pointer.csv_navalue
}
func (opt Options) CSVAutoColumn() bool {
return opt.pointer.csv_auto
}
func (opt Options) HaveToSavePaired() bool {
return opt.pointer.paired_filename != ""
}
@ -217,31 +217,6 @@ func OptionsNewFile() WithOption {
return f
}
// Allows to specify the ascii code corresponding to
// a quality of 0 in fastq encoded quality scores.
func OptionsQualityShift(shift int) WithOption {
f := WithOption(func(opt Options) {
opt.pointer.quality_shift = shift
})
return f
}
// Allows to specify a quality shift of 33, corresponding
// to a FastQ file qualities encoded following Sanger
// convention. This corresponds to Illumina produced FastQ
// files.
func OptionsQualitySanger() WithOption {
return OptionsQualityShift(33)
}
// Allows to specify a quality shift of 64, corresponding
// to a FastQ file qualities encoded following the Solexa
// convention.
func OptionsQualitySolexa() WithOption {
return OptionsQualityShift(64)
}
func OptionsFastSeqHeaderParser(parser obiseq.SeqAnnotator) WithOption {
f := WithOption(func(opt Options) {
opt.pointer.fastseq_header_parser = parser
@ -403,3 +378,11 @@ func CSVNAValue(navalue string) WithOption {
return f
}
func CSVAutoColumn(auto bool) WithOption {
f := WithOption(func(opt Options) {
opt.pointer.csv_auto = auto
})
return f
}