Correct the logic of --update-taxid and --fail-on-taxonomy

This commit is contained in:
Eric Coissac
2025-03-11 16:56:02 +01:00
parent 3b5d4ba455
commit f21f51ae62
2 changed files with 10 additions and 11 deletions

View File

@ -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.

View File

@ -50,19 +50,18 @@ 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())
} else {
if obidefault.UpdateTaxid() {
log.Warnf("%s: Taxid: %v is updated to %s",
s.Id(), taxid, taxon.String())
taxid = taxon.String()
} else {
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 {
if taxon != nil {