ReinV / SCOPE

Search and Chemical Ontology Plotting Environment
Other
1 stars 2 forks source link

Error when chebi.obo not in 'files' folder #11

Closed magnuspalmblad closed 4 years ago

magnuspalmblad commented 4 years ago

When no chebi.obo file is present in the 'files' folder, the update_chebis.py script crashes. A better behavior would be that it fetches the latest chebi.obo file from ftp://ftp.ebi.ac.uk/pub/databases/chebi/ontology/chebi.obo and checks if the predictions are up-to-date.

This is the current behavior:

Importing latest ontology...
Traceback (most recent call last):
  File "update_chebis.py", line 384, in <module>
    main()
  File "update_chebis.py", line 357, in main
    latest_version, graph = return_latest_ontology() # graph = ontology
  File "update_chebis.py", line 21, in return_latest_ontology
    file = open('files/chebi.obo', encoding = 'utf8')
FileNotFoundError: [Errno 2] No such file or directory: 'files/chebi.obo'
magnuspalmblad commented 4 years ago

Related to this, if the ChEBI release that was used to make the predictions is in the folder, update_chebis.py compares this with the predictions and concludes these are up-to-date, even though the OBO file is old! A more logical behavior would be to first check if the ChEBI file is current, and if not download the latest version. Then check if there are any new entries that needs to be predicted.

(base) C:\Users\Magnus Palmblad\Downloads\SCOPE>python update_chebis.py
Importing latest ontology...
ChEBI version used to update files: 180
ChEBI latest version: 180
Files are up-to-date
magnuspalmblad commented 4 years ago

We identified the culprit was the NetworkX Python library, SCOPE not working with the latest version I used (2.4). Close when fixed.

ReinV commented 4 years ago

Ideal behaviour would be that the script checks if ChEBI obo file is in the files folder, and if so, checks if its version is up-to-date. If not, it can download the latest version and save the obo file in the files folder.

However, I'm currently still looking for an easy version check without downloading the whole ontology.

magnuspalmblad commented 4 years ago

This has now been fixed, automatically downloading the latest OBO file when none exists in the 'files' folder.