Repository navigation
lookup(): trim the prefix and remainder as MATLAB does - #17
Merged
Merged
Conversation
getOntologyNameFromPrefix (ontology.m:493) strtrims both halves of the lookup string before mapping the prefix and calling lookupTermOrID. Python matched the untrimmed prefix and passed the untrimmed remainder, so 'CL: 0000540' and ' CL:0000540' failed in Python and resolved in MATLAB. The cache stays keyed on the string as typed, as MATLAB's is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UaMQ8AiBeK9Bj7tZ7U1CS2
stevevanhooser
pushed a commit
that referenced
this pull request
Oct 21, 2026
…ed helpers main brought #14 (EMPTY), #15 (NCIT codes by obo_id), #17 (lookup trimming, the same fix as this branch's) and #18 (known_gaps). #15's NCITProvider.lookup_term called OLSProvider._search_ols, which this branch replaces; git merged it cleanly, and every NCIT lookup would have raised AttributeError. It now does what NCIT.m does on the ported helpers: preprocessLookupInput, then searchOLSAndPerformIRILookup on obo_id for ['NCIT:', search_query]. Its tests move to FakeOLS, plus one for the prefixed and numeric forms. 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.
getOntologyNameFromPrefix(ontology.m:493, read at ndi-ontology-matlab44efcec) trims both halves of the lookup string. It does this before it maps the prefix and before it callslookupTermOrID.Python did neither:
As a result,
CL: 0000540,CL:0000540andNDIC :8failed in Python but resolved in MATLAB. This affects every provider.Change
lookup()now trims both parts right after the split.result.prefix = prefix.strip()becomesresult.prefix = prefix, since the prefix is already trimmed.lookupentry records the fix. Its sync hash is unchanged because I examined only this path ofontology.m, not the whole file.Tests
NDIC:8resolve, with no network needed.black,ruffandpytest -m "not live"pass: 171 passed.Generated by Claude Code