HBioquant / DiffBindFR

Diffusion model based protein-ligand flexible docking method
BSD 3-Clause Clear License
91 stars 12 forks source link

Cannot append item without units into list with units #9

Open stan1233 opened 6 months ago

stan1233 commented 6 months ago

Hi!

At that time, I tried to execute "relax the structure" and encountered the following issues. python pl_1.py ../app/test/reverse/structures -nb 12 -v

INFO: Pandarallel will run on 12 workers.
INFO: Pandarallel will use Memory file system to transfer data between the main process and workers.
   0.00%                                          |        0 /        1 |
   0.00%                                          |        0 /        1 |
   0.00%                                          |        0 /        1 |
   0.00%                                          |        0 /        1 |
   0.00%                                          |        0 /        1 |
   0.00%                                          |        0 /        1 |                                    multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandarallel/core.py", line 95, in __call__
    result = self.work_function(
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandarallel/data_types/dataframe.py", line 32, in work
    return data.apply(
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandas/core/frame.py", line 10374, in apply
    return op.apply().__finalize__(self, method="apply")
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandas/core/apply.py", line 916, in apply
    return self.apply_standard()
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandas/core/apply.py", line 1063, in apply_standard
    results, res_index = self.apply_series_generator()
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandas/core/apply.py", line 1081, in apply_series_generator
    results[i] = self.func(v, *self.args, **self.kwargs)
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandarallel/progress_bars.py", line 214, in closure
    return user_defined_function(
  File "/home/XXX/DiffBindFR/DiffBindFR/relax/pl_1.py", line 695, in process
    relax_pl(
  File "/home/XXX/DiffBindFR/DiffBindFR/relax/pl_1.py", line 527, in relax_pl
    modeller.add(lig_top.to_openmm(), positions_with_units)
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/openmm/app/modeller.py", line 132, in add
    newPositions.append(deepcopy(addPositions[atom.index]))
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/openmm/unit/quantity.py", line 773, in append
    raise TypeError("Cannot append item without units into list with units")
TypeError: Cannot append item without units into list with units
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/XXX/DiffBindFR/DiffBindFR/relax/pl_1.py", line 764, in <module>
    minimizer(
  File "/home/XXX/DiffBindFR/DiffBindFR/relax/pl_1.py", line 707, in minimizer
    df.parallel_apply(process, axis=1)
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/site-packages/pandarallel/core.py", line 333, in closure
    results_promise.get()
  File "/home/XXX/mambaforge/envs/dbfr/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
TypeError: Cannot append item without units into list with units

I attempted to make modifications to line 526 of pl.py. But it doesn't work.

positions_with_units = [position * mm_unit.nanometers for position in ligand_mol.conformers[0]]
modeller.add(lig_top.to_openmm(), positions_with_units)

BTW, I would like to ask two questions:

Thank you very much for providing such a great tool!

HBioquant commented 1 month ago

Hi,

I don't know what caused this error (TypeError: Cannot append item without units into list with units), and I can't reproduce it. It is worth emphasizing that the maintenance of openff and its dependent libraries is unstable. Make sure your openff and its dependencies are the same as the version I requested, this error probably won't happen.

1. what do lig_final_ec.sdf and lig_final.sdf represent in the docking results? lig_final.sdf is raw pose directly from model sampling, while lig_final_ec.sdf is the pose from lig_final.sdf after local energy minimization, which has stronger physical plausibility. We strongly recommend that users use lig_final_ec.sdf. Also, you can see more details in our paper about the error correction.

2. How to do blind docking? Indeed, blind docking can be delineated into two steps: pocket detection followed by pocket-based docking. I strongly recommend using the CavityPlus developed by our group to detect potential pockets and determine which candidate is the ideal functional pocket based on the score and even your expert knowledge of the protein. Then, you can take the center of the pocket and prepare a [protein_name]_box.csv with "x,y,z".