aqlaboratory / openfold

Trainable, memory-efficient, and GPU-friendly PyTorch reproduction of AlphaFold 2
Apache License 2.0
2.8k stars 542 forks source link

ValueError: The number of positions must match the number of atoms #233

Open liweiqing1997 opened 2 years ago

liweiqing1997 commented 2 years ago

Can someone help me. Why am I getting this error when I run inference:

Traceback (most recent call last): File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path pkg_name=pkg_name, script_name=fname) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/data/lwq/openfold-1.0.0/run_pretrained_openfold.py", line 477, in main(args) File "/data/lwq/openfold-1.0.0/run_pretrained_openfold.py", line 353, in main relaxed_pdbstr, , _ = amber_relaxer.process(prot=unrelaxed_protein) File "/data/lwq/openfold-1.0.0/openfold/np/relax/relax.py", line 82, in process min_pdb = utils.overwrite_pdb_coordinates(pdb_str, min_pos) File "/data/lwq/openfold-1.0.0/openfold/np/relax/utils.py", line 30, in overwrite_pdb_coordinates openmm_app.PDBFile.writeFile(topology, pos, f) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/site-packages/simtk/openmm/app/pdbfile.py", line 283, in writeFile PDBFile.writeModel(topology, positions, file, keepIds=keepIds, extraParticleIdentifier=extraParticleIdentifier) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/site-packages/simtk/openmm/app/pdbfile.py", line 331, in writeModel raise ValueError('The number of positions must match the number of atoms') ValueError: The number of positions must match the number of atoms (openfold_venv) [lwq@alphafold2-1 openfold-1.0.0]$ cd /data/lwq/openfold-1.0.0 ; /usr/bin/env /data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/bin/python /data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 44073 -- /data/lwq/openfold-1.0.0/run_pretrained_openfold.py INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Using config preset model_1_ptm... INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Loaded OpenFold parameters at /data/database/openfold_params/finetuning_ptm_2.pt... INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Running inference for 1BQL_1|Chain-1BQL_2|Chain-1BQL_3|Chain... Running inference for 1BQL_1|Chain-1BQL_2|Chain-1BQL_3|Chain... INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Inference time: 184.35416803136468 Inference time: 184.35440937802196 INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Output written to /data/lwq/data/output/predictions/1BQL_1|Chain-1BQL_2|Chain-1BQL_3|Chain_model_1_ptm_unrelaxed.pdb... INFO:/data/lwq/openfold-1.0.0/run_pretrained_openfold.py:Running relaxation on /data/lwq/data/output/predictions/1BQL_1|Chain-1BQL_2|Chain-1BQL_3|Chain_model_1_ptm_unrelaxed.pdb... Traceback (most recent call last): File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path pkg_name=pkg_name, script_name=fname) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/data/lwq/.vscode-server/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/data/lwq/openfold-1.0.0/run_pretrained_openfold.py", line 477, in main(args) File "/data/lwq/openfold-1.0.0/run_pretrained_openfold.py", line 353, in main relaxed_pdbstr, , _ = amber_relaxer.process(prot=unrelaxed_protein) File "/data/lwq/openfold-1.0.0/openfold/np/relax/relax.py", line 82, in process min_pdb = utils.overwrite_pdb_coordinates(pdb_str, min_pos) File "/data/lwq/openfold-1.0.0/openfold/np/relax/utils.py", line 30, in overwrite_pdb_coordinates openmm_app.PDBFile.writeFile(topology, pos, f) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/site-packages/simtk/openmm/app/pdbfile.py", line 283, in writeFile PDBFile.writeModel(topology, positions, file, keepIds=keepIds, extraParticleIdentifier=extraParticleIdentifier) File "/data/lwq/openfold-1.0.0/lib/conda/envs/openfold_venv/lib/python3.7/site-packages/simtk/openmm/app/pdbfile.py", line 331, in writeModel raise ValueError('The number of positions must match the number of atoms') ValueError: The number of positions must match the number of atoms

yamule commented 2 years ago

Do you have unrelaxed pdb? And does it have many atom clashes? In alphafold code, I thought that was caused by newly created or discarded disulfide bonds during relaxation (so the number of H atoms became different). https://github.com/deepmind/alphafold/issues/246#issuecomment-1048938896 Therefore, I don't think it can be solved without changing the pipeline strategy. (One solution is to relax unrelaxed pdb by other software (or other script with openmm). In that case, adding "--skip_relaxation" is recommended.)

liweiqing1997 commented 2 years ago

Do you have unrelaxed pdb? And does it have many atom clashes? In alphafold code, I thought that was caused by newly created or discarded disulfide bonds during relaxation (so the number of H atoms became different). deepmind/alphafold#246 (comment) Therefore, I don't think it can be solved without changing the pipeline strategy. (One solution is to relax unrelaxed pdb by other software (or other script with openmm).)

ok, thanks