Add _ to allowed in taxid

This commit is contained in:
Eric Coissac
2025-06-06 14:37:57 +02:00
parent d31e677304
commit 7b23985693
3 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,7 @@ import (
// corresponds to the last commit, and not the one when the file will be // corresponds to the last commit, and not the one when the file will be
// commited // commited
var _Commit = "6cb7a5a" var _Commit = "d31e677"
var _Version = "Release 4.4.0" var _Version = "Release 4.4.0"
// Version returns the version of the obitools package. // Version returns the version of the obitools package.

View File

@ -42,6 +42,8 @@ type Taxonomy struct {
index map[*string]*TaxonSet index map[*string]*TaxonSet
} }
var DefaultTaxidAlphabet = obiutils.AsciiAlphaNumSet.Union(obiutils.AsciiUnderScore)
// NewTaxonomy creates and initializes a new Taxonomy instance with the specified name and code. // NewTaxonomy creates and initializes a new Taxonomy instance with the specified name and code.
// It sets up the necessary internal structures, including ranks, nodes, aliases, and an index. // It sets up the necessary internal structures, including ranks, nodes, aliases, and an index.
// //
@ -365,7 +367,7 @@ func (taxonomy *Taxonomy) InsertPathString(path []string) (*Taxonomy, error) {
code, taxid, scientific_name, rank, err := ParseTaxonString(path[0]) code, taxid, scientific_name, rank, err := ParseTaxonString(path[0])
if taxonomy == nil { if taxonomy == nil {
taxonomy = NewTaxonomy(code, code, obiutils.AsciiAlphaNumSet) taxonomy = NewTaxonomy(code, code, DefaultTaxidAlphabet)
} }
if err != nil { if err != nil {

View File

@ -8,6 +8,7 @@ import (
type AsciiSet [256]bool type AsciiSet [256]bool
var AsciiSpaceSet = AsciiSetFromString("\t\n\v\f\r ") var AsciiSpaceSet = AsciiSetFromString("\t\n\v\f\r ")
var AsciiUnderScore = AsciiSetFromString("_")
var AsciiDigitSet = AsciiSetFromString("0123456789") var AsciiDigitSet = AsciiSetFromString("0123456789")
var AsciiUpperSet = AsciiSetFromString("ABCDEFGHIJKLMNOPQRSTUVWXYZ") var AsciiUpperSet = AsciiSetFromString("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
var AsciiLowerSet = AsciiSetFromString("abcdefghijklmnopqrstuvwxyz") var AsciiLowerSet = AsciiSetFromString("abcdefghijklmnopqrstuvwxyz")