mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds the --template option to obimultiplex
Former-commit-id: 349e9f278abd6a6c258f31d99ea04853a79c62de
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -31,6 +32,16 @@ func main() {
|
|||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
if obimultiplex.CLIAskConfigTemplate() {
|
||||||
|
fmt.Print(obimultiplex.CLIConfigTemplate())
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !obimultiplex.CLIHasNGSFilterFile() {
|
||||||
|
log.Error("You must provide a tag list file following the NGSFilter format")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _NGSFilterFile = ""
|
var _NGSFilterFile = ""
|
||||||
|
var _askTemplate = false
|
||||||
var _UnidentifiedFile = ""
|
var _UnidentifiedFile = ""
|
||||||
var _AllowedMismatch = int(2)
|
var _AllowedMismatch = int(2)
|
||||||
var _AllowsIndel = false
|
var _AllowsIndel = false
|
||||||
@ -30,7 +31,6 @@ var _ConservedError = false
|
|||||||
func MultiplexOptionSet(options *getoptions.GetOpt) {
|
func MultiplexOptionSet(options *getoptions.GetOpt) {
|
||||||
options.StringVar(&_NGSFilterFile, "tag-list", _NGSFilterFile,
|
options.StringVar(&_NGSFilterFile, "tag-list", _NGSFilterFile,
|
||||||
options.Alias("t"),
|
options.Alias("t"),
|
||||||
options.Required("You must provide a tag list file following the NGSFilter format"),
|
|
||||||
options.Description("File name of the NGSFilter file describing PCRs."))
|
options.Description("File name of the NGSFilter file describing PCRs."))
|
||||||
|
|
||||||
options.BoolVar(&_ConservedError, "keep-errors", _ConservedError,
|
options.BoolVar(&_ConservedError, "keep-errors", _ConservedError,
|
||||||
@ -47,6 +47,10 @@ func MultiplexOptionSet(options *getoptions.GetOpt) {
|
|||||||
options.Alias("e"),
|
options.Alias("e"),
|
||||||
options.Description("Used to specify the number of errors allowed for matching primers."))
|
options.Description("Used to specify the number of errors allowed for matching primers."))
|
||||||
|
|
||||||
|
options.BoolVar(&_askTemplate, "template", _askTemplate,
|
||||||
|
options.Description("Print on the standard output an example of CSV configuration file."),
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func OptionSet(options *getoptions.GetOpt) {
|
func OptionSet(options *getoptions.GetOpt) {
|
||||||
@ -69,6 +73,10 @@ func CLIConservedErrors() bool {
|
|||||||
return _UnidentifiedFile != "" || _ConservedError
|
return _UnidentifiedFile != "" || _ConservedError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CLIHasNGSFilterFile() bool {
|
||||||
|
return _NGSFilterFile != ""
|
||||||
|
}
|
||||||
|
|
||||||
func CLINGSFIlter() (obingslibrary.NGSLibrary, error) {
|
func CLINGSFIlter() (obingslibrary.NGSLibrary, error) {
|
||||||
file, err := os.Open(_NGSFilterFile)
|
file, err := os.Open(_NGSFilterFile)
|
||||||
|
|
||||||
@ -85,3 +93,16 @@ func CLINGSFIlter() (obingslibrary.NGSLibrary, error) {
|
|||||||
|
|
||||||
return ngsfiler, nil
|
return ngsfiler, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CLIAskConfigTemplate() bool {
|
||||||
|
return _askTemplate
|
||||||
|
}
|
||||||
|
|
||||||
|
func CLIConfigTemplate() string {
|
||||||
|
return `experiment,sample,sample_tag,forward_primer,reverse_primer
|
||||||
|
wolf_diet,13a_F730603,aattaac,TTAGATACCCCACTATGC,TAGAACAGGCTCCTCTAG
|
||||||
|
wolf_diet,15a_F730814,gaagtag:gaatatc,TTAGATACCCCACTATGC,TAGAACAGGCTCCTCTAG
|
||||||
|
wolf_diet,26a_F040644,gaatatc:-,TTAGATACCCCACTATGC,TAGAACAGGCTCCTCTAG
|
||||||
|
wolf_diet,29a_F260619,-:-,TTAGATACCCCACTATGC,TAGAACAGGCTCCTCTAG
|
||||||
|
`
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user