Patch a bug in obitag when some reference sequences have taxid absent from the taxonomy

This commit is contained in:
Eric Coissac
2025-03-27 16:45:02 +01:00
parent 2d52322876
commit 03b5ce9397
5 changed files with 27 additions and 11 deletions

View File

@@ -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
}