mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
patch multiple -Z options
This commit is contained in:
@ -66,10 +66,6 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
|
||||
options.GetEnv("OBISOLEXA"),
|
||||
options.Description("Decodes quality string according to the Solexa specification."))
|
||||
|
||||
options.BoolVar(obidefault.CompressedPtr(), "compressed", obidefault.CompressOutput(),
|
||||
options.Alias("Z"),
|
||||
options.Description("Compress all the result using gzip"))
|
||||
|
||||
for _, o := range optionset {
|
||||
o(options)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// corresponds to the last commit, and not the one when the file will be
|
||||
// commited
|
||||
|
||||
var _Commit = "8a28c9a"
|
||||
var _Commit = "3379545"
|
||||
var _Version = "Release 4.2.0"
|
||||
|
||||
// Version returns the version of the obitools package.
|
||||
|
@ -1,11 +1,14 @@
|
||||
package obitax
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var __defaut_taxonomy__ *Taxonomy
|
||||
var __defaut_taxonomy_mutex__ sync.Mutex
|
||||
|
||||
func (taxonomy *Taxonomy) SetAsDefault() {
|
||||
log.Infof("Set as default taxonomy %s", taxonomy.Name())
|
||||
@ -32,14 +35,18 @@ func DefaultTaxonomy() *Taxonomy {
|
||||
var err error
|
||||
if __defaut_taxonomy__ == nil {
|
||||
if obidefault.HasSelectedTaxonomy() {
|
||||
__defaut_taxonomy__, err = LoadTaxonomy(
|
||||
obidefault.SelectedTaxonomy(),
|
||||
!obidefault.AreAlternativeNamesSelected(),
|
||||
)
|
||||
__defaut_taxonomy_mutex__.Lock()
|
||||
defer __defaut_taxonomy_mutex__.Unlock()
|
||||
if __defaut_taxonomy__ == nil {
|
||||
__defaut_taxonomy__, err = LoadTaxonomy(
|
||||
obidefault.SelectedTaxonomy(),
|
||||
!obidefault.AreAlternativeNamesSelected(),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Cannot load default taxonomy: %v", err)
|
||||
if err != nil {
|
||||
log.Fatalf("Cannot load default taxonomy: %v", err)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,3 +196,29 @@ func (set *TaxonSet) Contains(id *string) bool {
|
||||
node := set.Get(id)
|
||||
return node != nil
|
||||
}
|
||||
|
||||
func (set *TaxonSet) Sort() *TaxonSlice {
|
||||
if set == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
taxonomy := set.Taxonomy()
|
||||
taxa := taxonomy.NewTaxonSlice(0, set.Len())
|
||||
parent := make(map[*TaxNode]bool, set.Len())
|
||||
|
||||
pushed := true
|
||||
|
||||
for pushed {
|
||||
pushed = false
|
||||
for _, node := range set.set {
|
||||
if !parent[node] && (parent[set.Get(node.parent).Node] ||
|
||||
!set.Contains(node.parent)) {
|
||||
pushed = true
|
||||
taxa.slice = append(taxa.slice, node)
|
||||
parent[node] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return taxa
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package obiconvert
|
||||
import (
|
||||
"os"
|
||||
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
@ -76,9 +77,10 @@ func OutputModeOptionSet(options *getoptions.GetOpt, compressed bool) {
|
||||
options.Description("Disable the progress bar printing"))
|
||||
|
||||
if compressed {
|
||||
options.BoolVar(&__compressed__, "compress", false,
|
||||
options.BoolVar(obidefault.CompressedPtr(), "compressed", obidefault.CompressOutput(),
|
||||
options.Alias("Z"),
|
||||
options.Description("Output is compressed"))
|
||||
options.Description("Compress all the result using gzip"))
|
||||
|
||||
}
|
||||
|
||||
options.StringVar(&__output_file_name__, "out", __output_file_name__,
|
||||
|
Reference in New Issue
Block a user