several small changes

Former-commit-id: c1cdb95885e44fd6ee7d1c963860d7ab41230c96
This commit is contained in:
2023-06-07 17:50:10 +02:00
parent 49fa1a76cb
commit d46f6b06c5
6 changed files with 32 additions and 8 deletions

View File

@ -39,6 +39,10 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
options.GetEnv("OBIMAXCPU"),
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 {
o(options)
}
@ -100,7 +104,6 @@ func CLIReadParallelWorkers() int {
return int(float64(_MaxAllowedCPU) * float64(_ReadWorkerPerCore))
}
// CLIParallelWorkers returns the number of parallel workers requested by
// the command line option --workers|-w.
func CLIMaxCPU() int {

View File

@ -198,3 +198,7 @@ func (s *BioSequence) OBITagRefIndex() map[int]string {
return val
}
func (s *BioSequence) SetOBITagRefIndex(idx map[int]string) {
s.SetAttribute("obitag_ref_index", idx)
}

View File

@ -155,6 +155,10 @@ var OBILang = gval.NewLanguage(
text := fmt.Sprintf(args[0].(string), args[1:]...)
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) {
text := strings.ReplaceAll(args[0].(string), " ", "_")
return text, nil

View File

@ -81,6 +81,7 @@ func EvalAttributeWorker(expression map[string]string) obiseq.SeqWorker {
return w
}
func AddTaxonAtRankWorker(taxonomy *obitax.Taxonomy, ranks ...string) obiseq.SeqWorker {
f := func(s *obiseq.BioSequence) *obiseq.BioSequence {
for _, r := range ranks {
@ -111,6 +112,11 @@ func CLIAnnotationWorker() obiseq.SeqWorker {
annotator = annotator.ChainWorkers(w)
}
if CLIHasSetId() {
w := obiseq.EditIdWorker(CLSetIdExpression())
annotator = annotator.ChainWorkers(w)
}
if CLIHasAttibuteToDelete() {
w := DeleteAttributesWorker(CLIAttibuteToDelete())
annotator = annotator.ChainWorkers(w)

View File

@ -24,6 +24,7 @@ var _uniqueID = false
var _ahoCorazick = ""
var _lcaSlot = ""
var _lcaError = 0.0
var _setId = ""
func SequenceAnnotationOptionSet(options *getoptions.GetOpt) {
// 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 "+
"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.ArgName("#.###"),
options.Description("Error rate tolerated on the taxonomical discription during the lowest common "+
@ -123,6 +128,15 @@ func OptionSet(options *getoptions.GetOpt) {
// --uniq-id
// Forces sequence record ids to be unique.
func CLIHasSetId() bool {
return _setId != ""
}
func CLSetIdExpression() string {
return _setId
}
func CLIHasAttributeToBeRenamed() bool {
return len(_toBeRenamed) > 0
}

View File

@ -36,13 +36,6 @@ func LoadTaxonomyOptionSet(options *getoptions.GetOpt, required, alternatiive bo
options.Alias("a"),
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) {