From f21f51ae62a5f20b9416f1c5d3926ec88ff86fa1 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Tue, 11 Mar 2025 16:56:02 +0100 Subject: [PATCH] Correct the logic of --update-taxid and --fail-on-taxonomy --- pkg/obioptions/version.go | 2 +- pkg/obiseq/taxonomy_methods.go | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pkg/obioptions/version.go b/pkg/obioptions/version.go index 6d67e4b..a549e7a 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 = "50d11ce" +var _Commit = "3b5d4ba" var _Version = "Release 4.4.0" // Version returns the version of the obitools package. diff --git a/pkg/obiseq/taxonomy_methods.go b/pkg/obiseq/taxonomy_methods.go index c82df82..91bace3 100644 --- a/pkg/obiseq/taxonomy_methods.go +++ b/pkg/obiseq/taxonomy_methods.go @@ -50,18 +50,17 @@ func (s *BioSequence) SetTaxid(taxid string, rank ...string) { } if isAlias { - if obidefault.FailOnTaxonomy() { - log.Fatalf("%s: Taxid: %v is an alias from taxonomy (%v) to %s", - s.Id(), taxid, taxonomy.Name(), taxon.String()) + if obidefault.UpdateTaxid() { + log.Warnf("%s: Taxid: %v is updated to %s", + s.Id(), taxid, taxon.String()) + taxid = taxon.String() } else { - if obidefault.UpdateTaxid() { - log.Warnf("%s: Taxid: %v is updated to %s", - s.Id(), taxid, taxon.String()) - taxid = taxon.String() - } else { - log.Warnf("%s: Taxid %v has to be updated to %s", - s.Id(), taxid, taxon.String()) + if obidefault.FailOnTaxonomy() { + log.Fatalf("%s: Taxid: %v is an alias from taxonomy (%v) to %s", + s.Id(), taxid, taxonomy.Name(), taxon.String()) } + log.Warnf("%s: Taxid %v has to be updated to %s", + s.Id(), taxid, taxon.String()) } } else {