mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Change obiclean algorithm for a better evaluation of ratio
This commit is contained in:
@ -2,6 +2,8 @@ package obitax
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (taxon *TaxNode) Path() (*TaxonSlice, error) {
|
||||
@ -22,6 +24,34 @@ func (taxon *TaxNode) Path() (*TaxonSlice, error) {
|
||||
return &path, nil
|
||||
}
|
||||
|
||||
func (taxon *TaxNode) TaxonAtRank(rank string) *TaxNode {
|
||||
for taxon.rank != rank && taxon != taxon.pparent {
|
||||
taxon = taxon.pparent
|
||||
|
||||
if taxon == nil {
|
||||
log.Panicln("Taxonomy must be reindexed")
|
||||
}
|
||||
}
|
||||
|
||||
if taxon == taxon.pparent {
|
||||
taxon = nil
|
||||
}
|
||||
|
||||
return taxon
|
||||
}
|
||||
|
||||
func (taxon *TaxNode) Species() *TaxNode {
|
||||
return taxon.TaxonAtRank("species")
|
||||
}
|
||||
|
||||
func (taxon *TaxNode) Genus() *TaxNode {
|
||||
return taxon.TaxonAtRank("genus")
|
||||
}
|
||||
|
||||
func (taxon *TaxNode) Family() *TaxNode {
|
||||
return taxon.TaxonAtRank("family")
|
||||
}
|
||||
|
||||
// Returns a TaxonSet listing the requested taxon and all
|
||||
// its ancestors in the taxonomy down to the root.
|
||||
func (taxonomy *Taxonomy) Path(taxid int) (*TaxonSlice, error) {
|
||||
|
Reference in New Issue
Block a user