Refactoring of some code

This commit is contained in:
2022-08-23 11:07:39 +02:00
parent 62968aaa26
commit abaede48b5
4 changed files with 71 additions and 36 deletions

View File

@ -2,8 +2,6 @@ package obitax
import (
"regexp"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
)
type TaxNode struct {
@ -72,17 +70,6 @@ func (node *TaxNode) HasRankDefined(rank string) bool {
for node.rank != rank && node.parent != node.taxid {
node = node.pparent
}
return node.rank == rank
}
func HasRankDefined(taxonomy Taxonomy, rank string) obiseq.SequencePredicate {
f := func(sequence *obiseq.BioSequence) bool {
taxon, err := taxonomy.Taxon(sequence.Taxid())
return err == nil && taxon.HasRankDefined(rank)
}
return f
}