Skip to content

Add converter with configurable pre-processing#171

Merged
cthoyt merged 26 commits into
mainfrom
add-wrapped-converter
Apr 23, 2025
Merged

Add converter with configurable pre-processing#171
cthoyt merged 26 commits into
mainfrom
add-wrapped-converter

Conversation

@cthoyt
Copy link
Copy Markdown
Member

@cthoyt cthoyt commented Apr 14, 2025

This PR adds an extension to the curies.Converter that allows for pre-configuring string processing.

This is necessary in many places where what;s possible with simple contraction and expansion isn't enough to parse CURIEs, URIs, or other strings that might appear in places where CURIEs or URIs are supposed to be.

The idea and draft code for this PR existed already in PyOBO, but this PR generalizes and makes it fully reusable. Here's the inspiration:

@cthoyt cthoyt marked this pull request as ready for review April 22, 2025 20:22
@cthoyt cthoyt force-pushed the add-wrapped-converter branch from e2528d1 to be74a4e Compare April 22, 2025 20:30
Copy link
Copy Markdown
Collaborator

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Massive pr, will be super useful even if it contains some mild scope violations for a curies library. But who cares if it is useful

Comment thread src/curies/preprocessing.py Outdated
full={"is_a": "rdf:type"},
prefix={
"OMIM:PS": "omim.ps:",
"omim:PS": "omim.ps:",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So useful..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI all of this existed in PyOBO already, but I'm making it fully reusable and configurable

},
resource_prefix={
"clo": {
"j": "NCIT:",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes a bit far but whyyyy not 😂

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to appreciate how many string processing rules I have curated to deal with the nonsense of non-standardized OBO ontologies

@cthoyt cthoyt enabled auto-merge (squash) April 23, 2025 07:16
@cthoyt cthoyt disabled auto-merge April 23, 2025 07:17
@cthoyt cthoyt merged commit 9316511 into main Apr 23, 2025
10 checks passed
@cthoyt cthoyt deleted the add-wrapped-converter branch April 23, 2025 07:17
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