Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to cache ontologies #62

Open
cthoyt opened this issue Mar 2, 2020 · 1 comment
Open

Option to cache ontologies #62

cthoyt opened this issue Mar 2, 2020 · 1 comment
Assignees
Labels
enhancement An issue to request an enhancement, or a pull request implementing one.
Milestone

Comments

@cthoyt
Copy link

cthoyt commented Mar 2, 2020

I've been debugging the CHIRO (CHEBI Integrated Role Ontology) OBO export, and it had a few issues. First, I had to manually add some Typedef stanzas for its ad-hoc relations. Second, I had to switch the imports from its slimmed versions to the originals since the slim versions were missing several entities.

This lead me to the problem that it has to download each ontology file each time, and this takes a loooong time. Therefore, I'd like to request an option to cache OBO files (either the source .obo or a pre-compiled version as a pickle or OBO JSON)

I understand there could be problems to keeping the caches up-to-date, but maybe there's a simple way to add a dictionary argument to Ontology.__init__ so I can specify where I have my own copies like

from pronto import Ontology

Ontology.from_obo_library('chiro.obo', cache_files={
    'http://purl.obolibrary.org/obo/chiro/imports/chebi_import.owl': '/Users/cthoyt/obo/chebi.owl',
    'http://purl.obolibrary.org/obo/chiro/imports/envo_import.owl' : '/Users/cthoyt/obo/envo.owl',
    ...
})

Or alternatively, maybe you have an idea that could take care of this kind of caching for me so I don't have to look into the imports of the OBO file specifically.

@althonos
Copy link
Owner

althonos commented Mar 2, 2020

Hi @cthoyt ,

you currently have a (hacky) workaround if you replace import: http://purl.obolibrary.org/obo/chiro/imports/chebi_import.owl with import: chebi_import.owl in the source OBO; then pronto will try to use a local file named chebi_import.owl.

I could add something to provide a source as a interface (like an SourceProvider interface), it would indeed be a better way to let the user implement it, plus the current code could benefit from refactoring.

@althonos althonos added the enhancement An issue to request an enhancement, or a pull request implementing one. label Mar 2, 2020
@althonos althonos self-assigned this Mar 2, 2020
@althonos althonos added this to the v2.3.0 milestone Jul 18, 2020
@althonos althonos modified the milestones: v2.3.0, v2.4.0 Sep 21, 2020
@althonos althonos modified the milestones: v2.4.0, v3.0.0 Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue to request an enhancement, or a pull request implementing one.
Projects
None yet
Development

No branches or pull requests

2 participants