mims-harvard / TDC

Therapeutics Commons: Artificial Intelligence Foundation for Therapeutic Science

Home Page:https://tdcommons.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MoleculeOne wrapper dysfunctional

jannisborn opened this issue · comments

Describe the bug

Mismatch in keyword arguments when running the m1wrapper Oracle

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/tdc/oracles.py", line 424, in __call__
    return self.evaluator_func(*args, **kwargs)
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/tdc/chem_utils/oracle/oracle.py", line 1579, in __call__
    parameters={"exploratory_search": False, "detail_level": "score"},
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/m1wrapper/m1wrapper.py", line 80, in run_batch_search
    starting_materials=starting_materials
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/m1wrapper/search.py", line 51, in __init__
    starting_materials=starting_materials
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/m1wrapper/search.py", line 89, in __run
    maybe_handle_error(response)
  File "/Users/jab/miniconda3/envs/gt4sd_37/lib/python3.7/site-packages/m1wrapper/errors.py", line 15, in maybe_handle_error
    raise requests.exceptions.HTTPError(error)
requests.exceptions.HTTPError: Data does not match schema: ["'parameters' should NOT have additional properties", "'parameters' should NOT have additional properties"]

To Reproduce
Steps to reproduce the behavior:

from tdc import Oracle
smiles = ['O1C(N2C(=O)N=C(NO)C=C2)C(O)C(O)C1COC(=O)C(C)C']
m1 = Oracle(name = 'Molecule One Synthesis', api_token="XZY")
m1(smiles)

NOTE: The error only occurs upon fresh installation of m1wrapper into your env.

Expected behavior
Return of the result:

Finished... Returning Results...
[{'targetSmiles': 'O1C(N2C(=O)N=C(NO)C=C2)C(O)C(O)C1COC(=O)C(C)C', 'result': '10.000'}]
{'O1C(N2C(=O)N=C(NO)C=C2)C(O)C(O)C1COC(=O)C(C)C': '10.000'}

Problem:
The problem is caused by a deviation with respect to the m1wrapper package. You simply install from source from the main branch, see:

install('git+https://github.com/molecule-one/m1wrapper-python')

That's quite error prone since the package advanced since TdC was build

Solution:
Two solutions are possible:

  1. Hotfix: Changing L1394 to:install("git+https://github.com/molecule-one/m1wrapper-python@v1"). This ensures that the v1 tag is installed which is functional.
  2. Adapting the paramters arg to be compatible with recent m1wrapper:
    parameters={'exploratory_search': False, 'detail_level': 'score'}

Environment:

  • OS: MacOS
  • Python version: 3.7
  • TDC version: latest
  • Any other relevant information: