Repository navigation
lookup(): set prefix, synonyms and shortName as MATLAB does - #12
Merged
Merged
Conversation
…item 1)
MATLAB's ndi.ontology.lookup sets three outputs itself after the provider
returns: prefix as typed (ontology.m:295), synonyms flattened with empties
dropped (:316-327) and shortName = name2variableName(name) (:332). Python
left them to each provider, and they disagreed: OLS-backed providers
returned OLS's short_form ('CL_0000540') as shortName, nine others ''
and several a canonical prefix ('NDIC' for 'ndic:8').
NDI-python names treatment columns in its subject tables from
shortName, so the same dataset got different columns in each language.
The shared-case runner now asserts prefix and shortName too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH
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.
Fixes item 1 of #11. Items 2–4 stay open there.
Summary
MATLAB's
ndi.ontology.lookupsets three of its outputs itself, after the provider returns, so every ontology answers the same way. Python left all three to each provider, and the providers disagreed.lookup()now sets them as MATLAB does:short_namename2variableName(name)(ontology.m:332)short_form(CL_0000540); NDIC, NCIm, NCBITaxon, RRID, PubChem, WormBase, EDAM, IAO and schema returned''prefix:295):ndic:8→ndic,taxonomy:9606→taxonomyNDIC,NCBITaxon,EDAM, …synonyms:316-327)Why it matters
NDI-python's subject tables (
ndi/fun/doc_table.py) name treatment columns fromlookup(...).short_name, following MATLAB'streatment.m. Before this change, the same dataset got different column names in each language. A CHEBI treatment becameCHEBI_15377in Python butWaterin MATLAB. An NDIC treatment got''from the lookup, so Python fell back to the treatment's own name.Callers comparing
prefixwill see the prefix they typed (ndic,taxonomy,format) rather than the canonical one, which is what MATLAB has always returned.Tests
TestLookupSetsMatlabFields(offline) checks five things:short_formis replaced byname2variableName(name)short_namegets filled inprefixandshort_namefor every success case.black,ruffand the offline suite pass: 153 passed, 3 skipped.Generated by Claude Code