pengxingang / Pocket2Mol

Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
MIT License
258 stars 70 forks source link

Initialization failed issue #38

Open NiteshGit123 opened 7 months ago

NiteshGit123 commented 7 months ago

Hello @pengxingang ,I hope you are doing well.I am trying to sample some molecules for a target protein using the pdb file.But I am getting the following error:"Initilization failed" repeatedly. Actually there are some messages such as applying np.mean to an empty slice and divide by a zero or nan value but the error message doesn't specify the line of code sample_for_pdb.py so that I can try to debug and they are always there if the model samples molecules so I think that is not a severe warning. Also If I change the y_coordinate of the ligand box from -3.10 to -2.61 for this protein(1lqf), model is able to sample molecules. If you are aware of such issue,can you please tell me how to work around it. For your reference, I am providing the error information below:

(pmol) root@a5a5e5d:/workspace/pocketmol# taskset -c 0 python3 sample_for_pdb.py --pdb_path ./example/1lqf.pdb --center " 17.01,-3.1,27.47" --device "cpu" random_seed is 9424 config is {'model': {'checkpoint': './ckpt/pretrained_Pocket2Mol.pt'}, 'sample': {'seed': 9424, 'num_samples': 100, 'beam_size': 100, 'max_steps': 50, 'threshold': {'focal_threshold': 0.5, 'pos_threshold': 0.25, 'element_threshold': 0.3, 'hasatom_threshold': 0.6, 'bond_threshold': 0.4}}} [2024-03-03 20:13:21,574::sample::INFO] Namespace(bbox_size=23.0, center=[17.01, -3.1, 27.47], config='./configs/sample_for_pdb.yml', device='cpu', outdir='./outputs', pdb_path='./example/1lqf.pdb') [2024-03-03 20:13:21,574::sample::INFO] {'model': {'checkpoint': './ckpt/pretrained_Pocket2Mol.pt'}, 'sample': {'seed': 9424, 'num_samples': 100, 'beam_size': 100, 'max_steps': 50, 'threshold': {'focal_threshold': 0.5, 'pos_threshold': 0.25, 'element_threshold': 0.3, 'hasatom_threshold': 0.6, 'bond_threshold': 0.4}}} [2024-03-03 20:13:21,575::sample::INFO] Loading data... [2024-03-03 20:13:21,909::sample::INFO] Loading main model... [2024-03-03 20:13:22,003::sample::INFO] Initialization InitSample: 0%| | 0/100 [00:00<?, ?it/s]/opt/conda/envs/pmol/lib/python3.7/site-packages/numpy/core/fromnumeric.py:3441: RuntimeWarning: Mean of empty slice. out=out, **kwargs) /opt/conda/envs/pmol/lib/python3.7/site-packages/numpy/core/_methods.py:189: RuntimeWarning: invalid value encountered in true_divide ret = ret.dtype.type(ret / rcount) Initialization failed. Initialization failed. Initialization failed. Initialization failed. Initialization failed.

Thankyou

pengxingang commented 6 months ago

Hi, thanks for your interest in our work. According to your description, I guess the pocket is not well specified, i.e. the box defined by your input coordinates might not cover the protein pocket.

The model defines the pocket by building a box with your input coordinates as the center. If the box covers the wrong pocket atoms, e.g., an empty pocket, the model cannot generate molecules. So please check whether the box can cover the pocket that you want the model to sample from.