mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
several small changes
Former-commit-id: c1cdb95885e44fd6ee7d1c963860d7ab41230c96
This commit is contained in:
@ -39,6 +39,10 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
|||||||
options.GetEnv("OBIMAXCPU"),
|
options.GetEnv("OBIMAXCPU"),
|
||||||
options.Description("Number of parallele threads computing the result"))
|
options.Description("Number of parallele threads computing the result"))
|
||||||
|
|
||||||
|
options.IntVar(&_BatchSize, "batch-size", _BatchSize,
|
||||||
|
options.GetEnv("OBIBATCHSIZE"),
|
||||||
|
options.Description("Number of sequence per batch for paralelle processing"))
|
||||||
|
|
||||||
for _, o := range optionset {
|
for _, o := range optionset {
|
||||||
o(options)
|
o(options)
|
||||||
}
|
}
|
||||||
@ -100,7 +104,6 @@ func CLIReadParallelWorkers() int {
|
|||||||
return int(float64(_MaxAllowedCPU) * float64(_ReadWorkerPerCore))
|
return int(float64(_MaxAllowedCPU) * float64(_ReadWorkerPerCore))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CLIParallelWorkers returns the number of parallel workers requested by
|
// CLIParallelWorkers returns the number of parallel workers requested by
|
||||||
// the command line option --workers|-w.
|
// the command line option --workers|-w.
|
||||||
func CLIMaxCPU() int {
|
func CLIMaxCPU() int {
|
||||||
|
@ -198,3 +198,7 @@ func (s *BioSequence) OBITagRefIndex() map[int]string {
|
|||||||
|
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *BioSequence) SetOBITagRefIndex(idx map[int]string) {
|
||||||
|
s.SetAttribute("obitag_ref_index", idx)
|
||||||
|
}
|
@ -155,6 +155,10 @@ var OBILang = gval.NewLanguage(
|
|||||||
text := fmt.Sprintf(args[0].(string), args[1:]...)
|
text := fmt.Sprintf(args[0].(string), args[1:]...)
|
||||||
return text, nil
|
return text, nil
|
||||||
}),
|
}),
|
||||||
|
gval.Function("gsub", func(args ...interface{}) (interface{}, error) {
|
||||||
|
text := strings.ReplaceAll(args[0].(string), args[1].(string), args[2].(string))
|
||||||
|
return text, nil
|
||||||
|
}),
|
||||||
gval.Function("subspc", func(args ...interface{}) (interface{}, error) {
|
gval.Function("subspc", func(args ...interface{}) (interface{}, error) {
|
||||||
text := strings.ReplaceAll(args[0].(string), " ", "_")
|
text := strings.ReplaceAll(args[0].(string), " ", "_")
|
||||||
return text, nil
|
return text, nil
|
||||||
|
@ -81,6 +81,7 @@ func EvalAttributeWorker(expression map[string]string) obiseq.SeqWorker {
|
|||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func AddTaxonAtRankWorker(taxonomy *obitax.Taxonomy, ranks ...string) obiseq.SeqWorker {
|
func AddTaxonAtRankWorker(taxonomy *obitax.Taxonomy, ranks ...string) obiseq.SeqWorker {
|
||||||
f := func(s *obiseq.BioSequence) *obiseq.BioSequence {
|
f := func(s *obiseq.BioSequence) *obiseq.BioSequence {
|
||||||
for _, r := range ranks {
|
for _, r := range ranks {
|
||||||
@ -111,6 +112,11 @@ func CLIAnnotationWorker() obiseq.SeqWorker {
|
|||||||
annotator = annotator.ChainWorkers(w)
|
annotator = annotator.ChainWorkers(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if CLIHasSetId() {
|
||||||
|
w := obiseq.EditIdWorker(CLSetIdExpression())
|
||||||
|
annotator = annotator.ChainWorkers(w)
|
||||||
|
}
|
||||||
|
|
||||||
if CLIHasAttibuteToDelete() {
|
if CLIHasAttibuteToDelete() {
|
||||||
w := DeleteAttributesWorker(CLIAttibuteToDelete())
|
w := DeleteAttributesWorker(CLIAttibuteToDelete())
|
||||||
annotator = annotator.ChainWorkers(w)
|
annotator = annotator.ChainWorkers(w)
|
||||||
|
@ -24,6 +24,7 @@ var _uniqueID = false
|
|||||||
var _ahoCorazick = ""
|
var _ahoCorazick = ""
|
||||||
var _lcaSlot = ""
|
var _lcaSlot = ""
|
||||||
var _lcaError = 0.0
|
var _lcaError = 0.0
|
||||||
|
var _setId = ""
|
||||||
|
|
||||||
func SequenceAnnotationOptionSet(options *getoptions.GetOpt) {
|
func SequenceAnnotationOptionSet(options *getoptions.GetOpt) {
|
||||||
// options.BoolVar(&_addRank, "seq-rank", _addRank,
|
// options.BoolVar(&_addRank, "seq-rank", _addRank,
|
||||||
@ -47,6 +48,10 @@ func SequenceAnnotationOptionSet(options *getoptions.GetOpt) {
|
|||||||
"a new slot named <SLOT_NAME> is added with the taxid of the lowest common ancester corresponding "+
|
"a new slot named <SLOT_NAME> is added with the taxid of the lowest common ancester corresponding "+
|
||||||
"to the current annotation."))
|
"to the current annotation."))
|
||||||
|
|
||||||
|
options.StringVar(&_setId, "set-identifier", _setId,
|
||||||
|
options.ArgName("EXPRESSION"),
|
||||||
|
options.Description("An expression used to assigned the new id of the sequence"))
|
||||||
|
|
||||||
options.Float64Var(&_lcaError, "lca-error", _lcaError,
|
options.Float64Var(&_lcaError, "lca-error", _lcaError,
|
||||||
options.ArgName("#.###"),
|
options.ArgName("#.###"),
|
||||||
options.Description("Error rate tolerated on the taxonomical discription during the lowest common "+
|
options.Description("Error rate tolerated on the taxonomical discription during the lowest common "+
|
||||||
@ -123,6 +128,15 @@ func OptionSet(options *getoptions.GetOpt) {
|
|||||||
// --uniq-id
|
// --uniq-id
|
||||||
// Forces sequence record ids to be unique.
|
// Forces sequence record ids to be unique.
|
||||||
|
|
||||||
|
func CLIHasSetId() bool {
|
||||||
|
return _setId != ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func CLSetIdExpression() string {
|
||||||
|
return _setId
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func CLIHasAttributeToBeRenamed() bool {
|
func CLIHasAttributeToBeRenamed() bool {
|
||||||
return len(_toBeRenamed) > 0
|
return len(_toBeRenamed) > 0
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,6 @@ func LoadTaxonomyOptionSet(options *getoptions.GetOpt, required, alternatiive bo
|
|||||||
options.Alias("a"),
|
options.Alias("a"),
|
||||||
options.Description("Enable the search on all alternative names and not only scientific names."))
|
options.Description("Enable the search on all alternative names and not only scientific names."))
|
||||||
}
|
}
|
||||||
options.BoolVar(&__rank_list__, "rank-list", false,
|
|
||||||
options.Alias("l"),
|
|
||||||
options.Description("List every taxonomic rank available in the taxonomy."))
|
|
||||||
|
|
||||||
options.IntSliceVar(&__taxonomical_restriction__, "restrict-to-taxon", 1, 1,
|
|
||||||
options.Alias("r"),
|
|
||||||
options.Description("Restrict output to some subclades."))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func FilterTaxonomyOptionSet(options *getoptions.GetOpt) {
|
func FilterTaxonomyOptionSet(options *getoptions.GetOpt) {
|
||||||
|
Reference in New Issue
Block a user