diff --git a/Release-notes.md b/Release-notes.md index ed4eb2b..2ff8161 100644 --- a/Release-notes.md +++ b/Release-notes.md @@ -16,6 +16,12 @@ - A new option **--csv** is added to every obitools to indicate that the input format is CSV +- The new version of obitools are now printing the taxids in a fancy way + including the scientific name and the taxonomic rank (`"taxon:9606 [Homo + sapiens]@species"`). But if you need the old fashion raw taxid, a new option + **--raw-taxid** has been added to get obitools printing the taxids without any + decorations (`"9606"`). + ## March 1st, 2025. Release 4.4.0 diff --git a/pkg/obidefault/taxonomy.go b/pkg/obidefault/taxonomy.go index f21852b..d03d850 100644 --- a/pkg/obidefault/taxonomy.go +++ b/pkg/obidefault/taxonomy.go @@ -4,6 +4,15 @@ var __taxonomy__ = "" var __alternative_name__ = false var __fail_on_taxonomy__ = false var __update_taxid__ = false +var __raw_taxid__ = false + +func UseRawTaxids() bool { + return __raw_taxid__ +} + +func UseRawTaxidsPtr() *bool { + return &__raw_taxid__ +} func SelectedTaxonomy() string { return __taxonomy__ diff --git a/pkg/obioptions/options.go b/pkg/obioptions/options.go index a1250c5..888344b 100644 --- a/pkg/obioptions/options.go +++ b/pkg/obioptions/options.go @@ -186,6 +186,10 @@ func LoadTaxonomyOptionSet(options *getoptions.GetOpt, required, alternatiive bo options.BoolVar(obidefault.UpdateTaxidPtr(), "update-taxid", obidefault.UpdateTaxid(), options.Description("Make obitools automatically updating the taxid that are declared merged to a newest one."), ) + + options.BoolVar(obidefault.UseRawTaxidsPtr(), "raw-taxid", obidefault.UseRawTaxids(), + options.Description("When set, taxids are printed in files with any supplementary information (taxon name and rank)"), + ) } // CLIIsDebugMode returns whether the CLI is in debug mode. diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index ac18caf..f6fa64d 100644 --- a/pkg/obioptions/version.go +++ b/pkg/obioptions/version.go @@ -8,7 +8,7 @@ import ( // corresponds to the last commit, and not the one when the file will be // commited -var _Commit = "706b44c" +var _Commit = "78df7db" var _Version = "Release 4.4.0" // Version returns the version of the obitools package. diff --git a/pkg/obitax/taxonnode.go b/pkg/obitax/taxonnode.go index 5e3e7ec..e38566c 100644 --- a/pkg/obitax/taxonnode.go +++ b/pkg/obitax/taxonnode.go @@ -5,6 +5,7 @@ import ( "regexp" "strings" + "git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault" log "github.com/sirupsen/logrus" ) @@ -37,6 +38,10 @@ type TaxNode struct { // Returns: // - A formatted string representing the TaxNode in the form "taxonomyCode:id [scientificName]@rank". func (node *TaxNode) String(taxonomyCode string) string { + if obidefault.UseRawTaxids() { + return *node.id + } + if node.HasScientificName() { return fmt.Sprintf("%s:%v [%s]@%s", taxonomyCode,