biocypher / clinical-knowledge-graph

GNU General Public License v3.0
12 stars 4 forks source link

Error in instantiating OntologyAdapter for biolink-model.owl.ttl #7

Closed axh24 closed 2 months ago

axh24 commented 3 months ago

Hi,

Thank you for developing this wonderful project. I have the CKG running in neo4j and would like to run the script to import CKG to BioCypher. There's an error looks like biolink-model.owl.ttl couldn't be reached. Please see the error log below. Could you please help me fix it? Thanks!

(ckg-py3.9) (base) xliu27@MACYWNJ0W4YYJ CKG-BioCypher % poetry run python scripts/full_ckg_script.py INFO -- This is BioCypher v0.5.6. INFO -- Logging into biocypher-log/biocypher-20240313-195751.log. [2024-03-13 19:57:51.548] [neo4ju.read_config] [WARNING] No config available, falling back to defaults. INFO -- Loading ontologies... INFO -- Instantiating OntologyAdapter class for https://github.com/biolink/biolink-model/raw/master/biolink-model.owl.ttl. Traceback (most recent call last): File "/Users/xliu27/Projects/CKG-BioCypher/scripts/full_ckg_script.py", line 22, in adapter.write_nodes() File "/Users/xliu27/Projects/CKG-BioCypher/ckgb/adapter.py", line 59, in write_nodes session.read_transaction( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/neo4j/work/simple.py", line 404, in read_transaction return self._run_transaction(READ_ACCESS, transaction_function, *args, *kwargs) File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/neo4j/work/simple.py", line 327, in _run_transaction result = transaction_function(tx, args, *kwargs) File "/Users/xliu27/Projects/CKG-BioCypher/ckgb/adapter.py", line 137, in _get_node_ids_and_write_batches_tx self._write_nodes(id_batch, label) File "/Users/xliu27/Projects/CKG-BioCypher/ckgb/adapter.py", line 208, in _write_nodes self.biocypher_driver.write_nodes( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_core.py", line 227, in write_nodes self._get_writer() File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_core.py", line 200, in _get_writer ontology=self._get_ontology(), File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_core.py", line 182, in _get_ontology self._ontology = Ontology( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_ontology.py", line 275, in init self._main() File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_ontology.py", line 284, in _main self._load_ontologies() File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_ontology.py", line 308, in _load_ontologies self._head_ontology = OntologyAdapter( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_ontology.py", line 81, in init self._rdf_graph = self._load_rdf_graph(ontology_file) File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/biocypher/_ontology.py", line 190, in _load_rdf_graph g.parse(ontology_file, format=self._get_format(ontology_file)) File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/rdflib/graph.py", line 1306, in parse source = create_input_source( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/rdflib/parser.py", line 404, in create_input_source ) = _create_input_source_from_location( File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/rdflib/parser.py", line 458, in _create_input_source_from_location input_source = URLInputSource(absolute_location, format) File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/rdflib/parser.py", line 282, in init response: HTTPResponse = _urlopen(req) File "/Users/xliu27/Library/Caches/pypoetry/virtualenvs/ckg-MZLciW2Z-py3.9/lib/python3.9/site-packages/rdflib/parser.py", line 270, in _urlopen return urlopen(req) File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 523, in open response = meth(req, response) File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 632, in http_response response = self.parent.error( File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 561, in error return self._call_chain(args) File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/opt/miniconda3/lib/python3.9/urllib/request.py", line 641, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

slobentanzer commented 3 months ago

Hi @axh24, thanks a lot for the report. Seems the folks at Biolink have changed the paths. The OWL is now at https://raw.githubusercontent.com/biolink/biolink-model/master/project/owl/biolink_model.owl.ttl, apparently. You can adjust your biocypher_config.yaml to make this work short-term, but I will push a fix to the BioCypher package immediately (which would require you to update the BioCypher version to the newest once this is done). I am also transferring this issue to the core library, because this is not an issue with the CKG adapter. :)

slobentanzer commented 3 months ago

Actually, after looking into it, it may be a problem that the CKG implementation uses an older BioCypher version; the current BioCypher does not have this problem because it references a fixed Biolink version. Transferring back until we decide what to do (but most likely we should first use the most recent BioCypher version in the CKG pipeline).

axh24 commented 3 months ago

Hi @slobentanzer,

Thanks for looking into this issue. I tried a newer version of biocypher 0.5.37 in CKG pipeline and the problem was solved. It's an easy fix. Thanks so much!