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

SMILES strings with a \ need to be escaped in input.json file #110

Open
smg3d opened this issue Nov 23, 2024 · 0 comments
Open

SMILES strings with a \ need to be escaped in input.json file #110

smg3d opened this issue Nov 23, 2024 · 0 comments

Comments

@smg3d
Copy link

smg3d commented Nov 23, 2024

Some SMILES strings use the \ character, which is not supported in the input.json. Note that rdkit supports these SMILES string without escaping the \, but I guess .json does not. It may be worth mentioning in the input doc that all \ must be escaped in the SMILES definitions in input.json.

The following SMILES string :

"smiles": "[O-]P(OCC[N+](C)(C)C)(OC[C@]([H])(OC(CCCCCCC/C=C\CCCCCCCC)=O)COC(CCCCCCC/C=C\CCCCCCCC)=O)=O"

results in :

Traceback (most recent call last):
  File "/app/alphafold/run_alphafold.py", line 674, in <module>
    app.run(main)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/app/alphafold/run_alphafold.py", line 580, in main
    fold_inputs = folding_input.load_fold_inputs_from_path(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 1022, in load_fold_inputs_from_path
    raw_json = json.loads(json_str)
               ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Invalid \escape: line 19 column 68 (char 1278628)

The fix to the above error is to use :

"smiles": "[O-]P(OCCN+(C)C)(OCC@(OC(CCCCCCC/C=C\CCCCCCCC)=O)COC(CCCCCCC/C=C\CCCCCCCC)=O)=O"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant