Skip to content

Fix taxonomy check for kingdom in training script#48

Merged
nextgenusfs merged 1 commit intonextgenusfs:mainfrom
edgeemer:patch-1
Apr 2, 2026
Merged

Fix taxonomy check for kingdom in training script#48
nextgenusfs merged 1 commit intonextgenusfs:mainfrom
edgeemer:patch-1

Conversation

@edgeemer
Copy link
Copy Markdown
Contributor

@edgeemer edgeemer commented Apr 1, 2026

First time doing pull requests so don't get angry at me if something is wrong with the submission :)

Minor fix to sometimes absent “kingdom” flag & TypeError related to non-searchable NCBI species names.

non-searchable NCBI species names: for custom names runs were resulting in TypeError:

funannotate2/train.py", line 353, in train
    if taxonomy["kingdom"] == "Fungi":
TypeError: 'bool' object is not subscriptable

absent “kingdom” flag: for some species (like Paramoeba/Perkinsela) kingdom key can be absent, resulting in KeyError: 'kingdom':
{
"superkingdom": "Eukaryota",
"phylum": "Discosea",
...
}
{
"superkingdom": "Eukaryota",
"phylum": "Euglenozoa",
...
}

Fix to sometimes absent “kingdom” flag & bugs related to non-searchable NCBI species names
@nextgenusfs nextgenusfs merged commit b59e01e into nextgenusfs:main Apr 2, 2026
@nextgenusfs
Copy link
Copy Markdown
Owner

Thanks so much for the fix! This perfectly resolves the TypeError and KeyError issues during training for organisms like Paramoeba where JGI taxonomy lacks a kingdom.

We've merged this PR and will also be applying the same .get() safeguard over in predict.py to ensure the entire pipeline handles these edge cases gracefully. Great catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants