Adds possibility to extract a taxonomy from taxonomic path included in sequence files

This commit is contained in:
Eric Coissac
2025-01-30 11:18:21 +01:00
parent 2452aef7a9
commit 0df082da06
20 changed files with 460 additions and 173 deletions

View File

@@ -248,15 +248,15 @@ func CLIRestrictTaxonomyPredicate() obiseq.SequencePredicate {
if len(_BelongTaxa) > 0 {
taxonomy := obitax.DefaultTaxonomy()
taxon := taxonomy.Taxon(_BelongTaxa[0])
if taxon == nil {
taxon, err := taxonomy.Taxon(_BelongTaxa[0])
if err != nil {
p = obiseq.IsSubCladeOfSlot(taxonomy, _BelongTaxa[0])
} else {
p = obiseq.IsSubCladeOf(taxonomy, taxon)
}
for _, staxid := range _BelongTaxa[1:] {
taxon := taxonomy.Taxon(staxid)
if taxon == nil {
taxon, err := taxonomy.Taxon(staxid)
if err != nil {
p2 = obiseq.IsSubCladeOfSlot(taxonomy, staxid)
} else {
p2 = obiseq.IsSubCladeOf(taxonomy, taxon)
@@ -278,16 +278,16 @@ func CLIAvoidTaxonomyPredicate() obiseq.SequencePredicate {
if len(_NotBelongTaxa) > 0 {
taxonomy := obitax.DefaultTaxonomy()
taxon := taxonomy.Taxon(_NotBelongTaxa[0])
if taxon == nil {
taxon, err := taxonomy.Taxon(_NotBelongTaxa[0])
if err != nil {
p = obiseq.IsSubCladeOfSlot(taxonomy, _NotBelongTaxa[0])
} else {
p = obiseq.IsSubCladeOf(taxonomy, taxon)
}
for _, taxid := range _NotBelongTaxa[1:] {
taxon := taxonomy.Taxon(taxid)
if taxon == nil {
taxon, err := taxonomy.Taxon(taxid)
if err != nil {
p2 = obiseq.IsSubCladeOfSlot(taxonomy, taxid)
} else {
p2 = obiseq.IsSubCladeOf(taxonomy, taxon)