mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a bug in obitag when some reference sequences have taxid absent from the taxonomy
This commit is contained in:
@ -27,7 +27,7 @@ type Taxon struct {
|
||||
// Returns:
|
||||
// - A formatted string representing the Taxon in the form "taxonomy_code:taxon_id [scientific_name]".
|
||||
func (taxon *Taxon) String() string {
|
||||
if taxon == nil {
|
||||
if taxon == nil || taxon.Node == nil {
|
||||
return "NA"
|
||||
}
|
||||
return taxon.Node.String(taxon.Taxonomy.code)
|
||||
|
@ -145,3 +145,18 @@ func (slice *TaxonSlice) Set(index int, taxon *Taxon) *TaxonSlice {
|
||||
|
||||
return slice
|
||||
}
|
||||
|
||||
func (slice *TaxonSlice) Push(taxon *Taxon) *TaxonSlice {
|
||||
if slice.taxonomy != taxon.Taxonomy {
|
||||
log.Panic("Cannot add taxon from a different taxonomy")
|
||||
}
|
||||
|
||||
slice.slice = append(slice.slice, taxon.Node)
|
||||
|
||||
return slice
|
||||
}
|
||||
|
||||
func (slice *TaxonSlice) ReduceToSize(size int) *TaxonSlice {
|
||||
slice.slice = slice.slice[:size]
|
||||
return slice
|
||||
}
|
||||
|
Reference in New Issue
Block a user