fix: don't abort make_adata when ontology translation fails#51
Merged
jkobject merged 1 commit intoMay 20, 2026
Merged
Conversation
make_adata calls translate() to fill the cosmetic conv_* columns with human-readable names. translate() can raise on ids it cannot resolve (e.g. comma-joined CellxGene ethnicity terms a model may predict), which aborts the entire prediction/embedding run. Wrap the translate() calls so an unresolved id warns and skips the conv_* column instead of crashing. The actual predictions (pred_*) are unaffected. The root cause is also fixed upstream in scdataloader's translate() (jkobject/scDataLoader#33); this keeps scPRINT robust regardless of the installed scdataloader version. Closes cantinilab#49
This was referenced May 20, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
- Coverage 41.34% 41.28% -0.07%
==========================================
Files 27 27
Lines 2854 2863 +9
==========================================
+ Hits 1180 1182 +2
- Misses 1674 1681 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary 📝
make_adatacallstranslate()to populate the cosmeticconv_*columns with human-readable ontology names.translate()can raise on an id it cannot resolve — notably comma-joined CellxGene terms likeself_reported_ethnicity_ontology_term_id = "HANCESTRO:0005,HANCESTRO:0008", which a model legitimately predicts because such labels are in the training vocabulary. When that happens, the entire prediction/embedding run aborts (#49).Details
translate()calls inmake_adataso a translation failure emits awarnings.warnand skips the affectedconv_*column instead of raising.pred_*columns) and embeddings are untouched — only the optional human-readable convenience columns are affected.translate()(fix: handle compound ontology ids in translate() jkobject/scDataLoader#33, which resolves compound ids properly). This scPRINT-side change is defense-in-depth: it keepsmake_adatarobust regardless of the installed scdataloader version.Bugfixes 🐛
make_adatano longer crashes the whole run when an ontology id (e.g. a compound CellxGene ethnicity term) can't be translated.Checks