mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 08:40:26 +00:00
Changes to be committed:
modified: .gitignore new file: pkg/obitax/default_taxonomy.go modified: pkg/obitax/taxon.go modified: pkg/obitax/taxonnode.go modified: pkg/obitax/taxonomy.go modified: pkg/obitax/taxonset.go modified: pkg/obitax/taxonslice.go modified: pkg/obitools/obifind/iterator.go modified: pkg/obitools/obifind/options.go
This commit is contained in:
@@ -35,10 +35,17 @@ type TaxNode struct {
|
||||
// Returns:
|
||||
// - A formatted string representing the TaxNode in the form "taxonomyCode:id [scientificName]".
|
||||
func (node *TaxNode) String(taxonomyCode string) string {
|
||||
return fmt.Sprintf("%s:%v [%s]",
|
||||
if node.HasScientificName() {
|
||||
return fmt.Sprintf("%s:%v [%s]",
|
||||
taxonomyCode,
|
||||
*node.id,
|
||||
node.ScientificName())
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s:%v",
|
||||
taxonomyCode,
|
||||
*node.id,
|
||||
node.ScientificName())
|
||||
*node.id)
|
||||
|
||||
}
|
||||
|
||||
// Id returns the unique identifier of the TaxNode.
|
||||
@@ -59,6 +66,10 @@ func (node *TaxNode) ParentId() *string {
|
||||
return node.parent
|
||||
}
|
||||
|
||||
func (node *TaxNode) HasScientificName() bool {
|
||||
return node != nil && node.scientificname != nil
|
||||
}
|
||||
|
||||
// ScientificName returns the scientific name of the TaxNode.
|
||||
// It dereferences the pointer to the scientific name string associated with the taxon node.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user