Fisrt functional version

This commit is contained in:
Eric Coissac
2024-11-14 19:10:23 +01:00
parent 9471fedfa1
commit 03f4e88a17
26 changed files with 908 additions and 307 deletions

View File

@ -1,6 +1,6 @@
package obitax
import "log"
import log "github.com/sirupsen/logrus"
func (taxon *Taxon) IsSubCladeOf(parent *Taxon) bool {
@ -20,3 +20,18 @@ func (taxon *Taxon) IsSubCladeOf(parent *Taxon) bool {
return false
}
func (taxon *Taxon) IsBelongingSubclades(clades *TaxonSet) bool {
ok := clades.Contains(taxon.Node.id)
for !ok && !taxon.IsRoot() {
taxon = taxon.Parent()
ok = clades.Contains(taxon.Node.id)
}
if taxon.IsRoot() {
ok = clades.Contains(taxon.Node.id)
}
return ok
}