MolecularAI / maize

A graph-based workflow manager for computational chemistry pipelines
https://molecularai.github.io/maize/
Apache License 2.0
32 stars 1 forks source link

Error running `maize workflow.yml` #1

Open cyan-moma opened 1 month ago

cyan-moma commented 1 month ago

Hi, I am interested in using maize for docking as a scoring function for molecular generation using REINVENT4. I got an error message when calling maize from CLI, even through I can run through the same workflow with success from jupyter notebook (although the docking score is found to be "nan" in out.json).

$maize --config ./docking_config.toml workflow.yml
Could not find a config file
Could not find a config file
Traceback (most recent call last):
  File "/home/cyan/miniforge3/envs/maize/bin/maize", line 8, in <module>
    sys.exit(main())
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/maize.py", line 85, in main
    graph.check()
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/workflow.py", line 726, in check
    super().check_dependencies()
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/graph.py", line 360, in check_dependencies
    node.check_dependencies()
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/node.py", line 266, in check_dependencies
    run_single_process(self._prepare, name=self.name, executable=self.python.filepath)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/utilities/execution.py", line 189, in run_single_process
    raise queue.get_nowait()
  File "/usr/share/lmod/lmod/init/env_modules_python.py", line 6
    exec commands
    ^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'exec'. Did you mean exec(...)?

Here is the workflow.yml file

channels:
- receiving:
    gypsum: inp
  sending:
    reinvententry: out
- receiving:
    vina: inp
  sending:
    gypsum: out
- receiving:
    reinventexit: inp
  sending:
    vina: out
- receiving:
    void: inp
  sending:
    reinvententry: out_metadata
description: null
level: INFO
name: Docking
nodes:
- description: null
  fail_ok: false
  n_attempts: 1
  name: reinvententry
  parameters:
    data: !!python/object/apply:pathlib.PosixPath
    - /
    - home
    - cyan
    - tmp
    - input.json
  status: COMPLETED
  type: ReinventEntry
- description: null
  fail_ok: false
  n_attempts: 1
  name: gypsum
  parameters:
    n_variants: 4
  status: COMPLETED
  type: Gypsum
- description: null
  fail_ok: false
  n_attempts: 1
  name: vina
  parameters:
    receptor: !!python/object/apply:pathlib.PosixPath
    - /
    - home
    - cyan
    - tmp
    - 1iep_receptorH.pdbqt
    search_center: !!python/tuple
    - 15.107
    - 53.977
    - 17.143
    search_range: !!python/tuple
    - 20.0
    - 20.0
    - 20.0
  status: COMPLETED
  type: Vina
- description: null
  fail_ok: false
  n_attempts: 1
  name: reinventexit
  parameters:
    data: !!python/object/apply:pathlib.PosixPath
    - /
    - home
    - cyan
    - tmp
    - out.json
  status: COMPLETED
  type: ReinventExit
- description: null
  fail_ok: false
  n_attempts: 1
  name: void
  parameters: {}
  status: STOPPED
  type: Void
parameters: []

I got a different error when running the same workflow in toml format:

$maize --config ./docking_config.toml workflow.toml 
Could not find a config file
Could not find a config file
Traceback (most recent call last):
  File "/home/cyan/miniforge3/envs/maize/bin/maize", line 8, in <module>
    sys.exit(main())
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/maize.py", line 72, in main
    graph = Workflow.from_file(args.file)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/workflow.py", line 373, in from_file
    return cls.from_dict(data)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/workflow.py", line 270, in from_dict
    graph.add(**init_data, component=node_type)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/graph.py", line 419, in add
    comp.update_parameters(**parameters)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/component.py", line 534, in update_parameters
    self.all_parameters[key].set(value)
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/interface.py", line 425, in set
    super().set(cast(P, path))
  File "/home/cyan/miniforge3/envs/maize/lib/python3.10/site-packages/maize/core/interface.py", line 364, in set
    raise ValueError(
ValueError: Error validating value '/home/cyan/tmp/PosixPath('/home/cyan/tmp/input.json')' of type '<class 'pathlib.PosixPath'>' against parameter type 'typing.Annotated[pathlib.Path, Suffix(json)]'

I also attached all the input and output files maize_vina_workflow.zip

I installed the conda environment of maize and maize-contrib following instructions from https://github.com/MolecularAI/maize-contrib/tree/public.

Thank you in advance for your help! Please let me know if you need additional information.

eyesurge commented 1 month ago

Hi cyan-moma, I'm afraid I can't be of much help with your yaml/toml issues. But I did find your comment on the docking score being returned as 'nan' noteworthy, as I've been struggling with exactly that issue. Please see here: https://github.com/MolecularAI/maize-contrib/issues/1

marco-chimfarm commented 3 weeks ago

Regarding the last issue, there was a fix in maize 0.5.0 about a "- Temporary fix for paths not being parsed from YAML files". Maybe it's connected?

I am finding setting up docking with maize to be quite difficult tbf, especially since the last version of REINVENT has completely different configuration syntax if comapred to the 3.2 that was used for maize examples.

halx commented 3 weeks ago

@tlhr Can you please have a look into this and comment?

tlhr commented 2 weeks ago

Hi! Sorry for the late reply. I have updated both maize and maize-contrib now, this should resolve some of those issues. Can you try with the new versions for both?