Repository navigation
Examine the unexamined providers against MATLAB; port what differed (#11 item 2) - #16
Merged
Merged
Conversation
#11 item 2) Shared OLS path (CL, CHEBI, PATO, EFO, SNOMED, Uberon, NCIT, STATO, MICRO, MCO, OBI, ZECO, WBls, and OM's fallback): port ontology.m's preprocessLookupInput, searchOLSAndPerformIRILookup and performIriLookup under their MATLAB names. A lookup is now MATLAB's two requests: a search that must name exactly one term, then that term's own record by IRI. Python took the first hit where MATLAB requires a unique one, read its fields from the search result (so synonyms were always empty), and swallowed every error into "not found". NCIm, PubChem: a name matching several concepts/CIDs raises rather than taking the first; errors raise; NCIm keeps the CUI asked for; PubChem keeps all synonyms, tolerates a failed title request and, as MATLAB does, rejects 'cid:962'. RRID: errors raise, the RRID is URL-encoded, and lookupSpecies is ported. NCBITaxon: errors raise; an esearch with no ids is "not found" only when NCBI says so. lookup() trims the prefix and remainder, as getOntologyNameFromPrefix does. The bridge records each provider as examined, with what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH
…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.
Addresses item 2 of #11. EMPTY is item 3, which merged separately as #14, and is untouched here.
Summary
I read every provider the bridge marked NOT EXAMINED against its MATLAB source, plus the parts of OM and NCBITaxon that were still unexamined, and ported what differed. The bridge now records each one as examined, with what changed.
Changes
Shared OLS path
This affects CL, CHEBI, PATO, EFO, SNOMED, Uberon, NCIT, STATO, MICRO, MCO, OBI, ZECO, WBls, and OM's fallback.
Each of these MATLAB classes sets only a prefix and an OLS ontology id, then defers to three helpers in
ontology.m. Those helpers are now ported onOLSProviderunder their MATLAB names:preprocessLookupInput,searchOLSAndPerformIRILookupandperformIriLookup. A lookup is now MATLAB's two requests: an OLS search that must name exactly one term, then that term's own record, fetched by its IRI from OLS's term API.NotUnique)obo_synonymnames, the first non-empty description, and MATLAB's id ruleslookup()NCIT is the one OLS class that differs from the template.
NCIT.mrunspreprocessLookupInput, then always does an exactobo_idsearch for'NCIT:' + search_query. #15 added an override for this, which called the old_search_ols. That call would have crashed after this PR, and git doesn't flag it, so the override is rebuilt on the ported helpers. Codes likeC3262resolve; names don't, as in MATLAB.Other providers
include=minimal, as MATLAB doesurlencodedoeslookupSpecies, a public MATLAB method, is now portedlookup()main, and the merge keepsmain's version.Behaviour changes callers may notice
lookup()already raised in both cases, but a transport failure now comes with its real cause attached.PubChem:cid:962now raises, as it does in MATLAB, which accepts only digits aftercid.cid 962and962still work. The same rule means neither language can look up a compound whose name starts with "cid", such as cidofovir; that's an upstream question.Upstream MATLAB bug, mirrored rather than fixed on one side
NCBITaxon.m's esearch regex spans the whole<IdList>, so it only ever captures the first id, and itsNameNotUniquebranch can never fire. Python keeps "first id" for parity, and the bridge records it.Tests
obo_idandshort_formlookupSpecies.main,black,ruffand the offline suite pass: 195 passed, 3 skipped.36d7814, run through the ported two-request path. EBI, NCI EVS, PubChem and SciCrunch are all blocked from the sandbox this was written in, so CI is the live check. All 18 OM cases also pass locally against the real OM file.Generated by Claude Code