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

TypeError: unsupported operand type(s) for *: 'object' and 'Forward' #101

Closed
HaoLan-compchem opened this issue Apr 21, 2024 · 5 comments
Closed

Comments

@HaoLan-compchem
Copy link

HaoLan-compchem commented Apr 21, 2024

Dear Meeko developer,

I tried to generate pdbqt file for a covalent ligand following the tutorial. The example was from https://autodock.scripps.edu/resources/covalent-docking/ (those are based on old python2 scripts... so I am seeking help from Meeko)

My command is:

mk_prepare_ligand.py
-i ligand.sdf
--receptor 3upo_protein.pdb
--rec_residue "B:SER:222"
--tether_smarts "C(=O)-O-C"
--tether_smarts_indices 4 3
-o prepared.pdbqt

However I got such error:

CovalentBuilder> searching for residue: chid B and resname SER and resnum 222 and (name CA or name CB)
Traceback (most recent call last):
File "/home/haolan/miniconda3/bin/mk_prepare_ligand.py", line 312, in
covalent_builder = CovalentBuilder(rec_prody_mol, args.rec_residue)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/meeko/covalentbuilder.py", line 63, in init
out = self._generate_prody_selection(selection_tuple)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/meeko/covalentbuilder.py", line 80, in _generate_prody_selection
found = self.rec.select( sel_string )
File "/home/haolan/miniconda3/lib/python3.10/site-packages/prody/atomic/atomic.py", line 232, in select
return SELECT.select(self, selstr, **kwargs)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/prody/atomic/select.py", line 895, in select
indices = self.getIndices(atoms, selstr, **kwargs)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/prody/atomic/select.py", line 953, in getIndices
torf = self.getBoolArray(atoms, selstr, **kwargs)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/prody/atomic/select.py", line 1004, in getBoolArray
parser = self._getParser(selstr)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/prody/atomic/select.py", line 1103, in _getParser
parser.enablePackrat()
File "/home/haolan/miniconda3/lib/python3.10/site-packages/pyparsing/util.py", line 265, in _inner
return fn(*args, **kwargs)
File "/home/haolan/miniconda3/lib/python3.10/site-packages/pyparsing/core.py", line 1132, in enable_packrat
ParserElement.packrat_cache = _FifoCache(cache_size_limit) # type: ignore[assignment]
File "/home/haolan/miniconda3/lib/python3.10/site-packages/pyparsing/util.py", line 105, in init
keyring = [object()] * size
TypeError: can't multiply sequence by non-int of type 'Forward'

I also tried the example from Meeko (bash script as provided), the exact same error was given...

Any solutions for this? Thank you very much

@rwxayheee
Copy link
Contributor

Hi @HaoLan-compchem
According to the README. For --tether_smarts_indices, the first index defines the C-alpha, and the second index defines the C-beta.

Is your ligand connected to the serine residue through an acyl group? Try this:

--tether_smarts "C(=O)OCC" \
--tether_smarts_indices 5 4 \

And make sure your ligand contains this substructure. In this substructure, the 5th atom corresponds to C-alpha and the 4th atom corresponds to C-beta

@HaoLan-compchem
Copy link
Author

Hi @HaoLan-compchem According to the README. For --tether_smarts_indices, the first index defines the C-alpha, and the second index defines the C-beta.

Is your ligand connected to the serine residue through an acyl group? Try this:

--tether_smarts "C(=O)OCC" \
--tether_smarts_indices 5 4 \

And make sure your ligand contains this substructure. In this substructure, the 5th atom corresponds to C-alpha and the 4th atom corresponds to C-beta

Not working, same error...

Here is my ligand sdf file containing Ca and Cb:

Penicillin
PyMOL2.5 3D 0

50 51 0 0 0 0 0 0 0 0999 V2000
5.3493 2.9414 -2.0384 H 0 0 0 0 0 0 0 0 0 0 0 0
5.9239 4.3300 -1.0838 H 0 0 0 0 0 0 0 0 0 0 0 0
6.7379 2.7539 -0.9413 H 0 0 0 0 0 0 0 0 0 0 0 0
5.7779 3.2498 -1.0848 C 0 0 0 0 0 0 0 0 0 0 0 0
5.1379 -2.7870 0.2309 N 0 3 0 0 0 0 0 0 0 0 0 0
2.8211 -1.2229 1.0721 N 0 0 0 0 0 0 0 0 0 0 0 0
5.8407 -3.2810 1.4152 C 0 0 0 0 0 0 0 0 0 0 0 0
4.8231 2.8589 0.0585 C 0 0 0 0 0 0 0 0 0 0 0 0
4.1151 0.8346 1.1599 C 0 0 0 0 0 0 0 0 0 0 0 0
4.1608 -0.6775 1.2522 C 0 0 0 0 0 0 0 0 0 0 0 0
5.1976 -1.3147 0.2726 C 0 0 0 0 0 0 0 0 0 0 0 0
7.2100 -2.5510 1.4556 C 0 0 0 0 0 0 0 0 0 0 0 0
8.2617 -3.1880 0.5245 C 0 0 0 0 0 0 0 0 0 0 0 0
7.7493 -2.4908 2.8948 C 0 0 0 0 0 0 0 0 0 0 0 0
5.9244 -4.7949 1.4451 C 0 0 0 0 0 0 0 0 0 0 0 0
2.0787 -1.0716 -0.0606 C 0 0 0 0 0 0 0 0 0 0 0 0
0.6891 -1.6658 -0.1020 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0478 -1.4272 -1.3975 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4334 -1.9719 -2.6005 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.2624 -1.7614 -3.7953 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.4398 -1.0080 -3.7976 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.9247 -0.4644 -2.6052 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2343 -0.6733 -1.4080 C 0 0 0 0 0 0 0 0 0 0 0 0
4.8533 1.4904 0.2249 O 0 0 0 0 0 0 0 0 0 0 0 0
3.3922 1.4582 1.9255 O 0 0 0 0 0 0 0 0 0 0 0 0
6.4244 -5.3622 2.4028 O 0 0 0 0 0 0 0 0 0 0 0 0
2.5193 -0.4503 -1.0172 O 0 0 0 0 0 0 0 0 0 0 0 0
5.4335 -5.5269 0.4252 O 0 5 0 0 0 0 0 0 0 0 0 0
6.8837 -0.8575 0.8372 S 0 0 0 0 0 0 0 0 0 0 0 0
4.4789 -0.9224 2.2883 H 0 0 0 0 0 0 0 0 0 0 0 0
5.0201 -0.9443 -0.7612 H 0 0 0 0 0 0 0 0 0 0 0 0
5.1528 3.3672 0.9898 H 0 0 0 0 0 0 0 0 0 0 0 0
3.7958 3.1892 -0.2072 H 0 0 0 0 0 0 0 0 0 0 0 0
7.9135 -3.2171 -0.5279 H 0 0 0 0 0 0 0 0 0 0 0 0
8.5019 -4.2235 0.8459 H 0 0 0 0 0 0 0 0 0 0 0 0
9.2038 -2.5992 0.5552 H 0 0 0 0 0 0 0 0 0 0 0 0
7.0153 -1.9917 3.5639 H 0 0 0 0 0 0 0 0 0 0 0 0
8.6954 -1.9103 2.9309 H 0 0 0 0 0 0 0 0 0 0 0 0
7.9509 -3.5077 3.2905 H 0 0 0 0 0 0 0 0 0 0 0 0
2.4095 -1.7434 1.8615 H 0 0 0 0 0 0 0 0 0 0 0 0
0.1197 -1.2233 0.7440 H 0 0 0 0 0 0 0 0 0 0 0 0
0.7562 -2.7614 0.0699 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3422 -2.5612 -2.6083 H 0 0 0 0 0 0 0 0 0 0 0 0
0.1099 -2.1843 -4.7193 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.9776 -0.8469 -4.7227 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.8372 0.1176 -2.6076 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.6234 -0.2484 -0.4909 H 0 0 0 0 0 0 0 0 0 0 0 0
5.2390 -2.9858 2.3027 H 0 0 0 0 0 0 0 0 0 0 0 0
4.1558 -3.1425 0.1782 H 0 0 0 0 0 0 0 0 0 0 0 0
5.6397 -3.1109 -0.6295 H 0 0 0 0 0 0 0 0 0 0 0 0
1 4 1 0 0 0 0
2 4 1 0 0 0 0
3 4 1 0 0 0 0
5 7 1 0 0 0 0
5 11 1 0 0 0 0
5 49 1 0 0 0 0
5 50 1 0 0 0 0
6 10 1 0 0 0 0
6 16 1 0 0 0 0
6 40 1 0 0 0 0
7 12 1 0 0 0 0
7 15 1 0 0 0 0
7 48 1 0 0 0 0
4 8 1 0 0 0 0
8 24 1 0 0 0 0
8 32 1 0 0 0 0
8 33 1 0 0 0 0
9 10 1 0 0 0 0
9 24 1 0 0 0 0
9 25 2 0 0 0 0
10 11 1 0 0 0 0
10 30 1 0 0 0 0
11 29 1 0 0 0 0
11 31 1 0 0 0 0
12 13 1 0 0 0 0
12 14 1 0 0 0 0
12 29 1 0 0 0 0
13 34 1 0 0 0 0
13 35 1 0 0 0 0
13 36 1 0 0 0 0
14 37 1 0 0 0 0
14 38 1 0 0 0 0
14 39 1 0 0 0 0
15 26 4 0 0 0 0
15 28 4 0 0 0 0
16 17 1 0 0 0 0
16 27 2 0 0 0 0
17 18 1 0 0 0 0
17 41 1 0 0 0 0
17 42 1 0 0 0 0
18 19 4 0 0 0 0
18 23 4 0 0 0 0
19 20 4 0 0 0 0
19 43 1 0 0 0 0
20 21 4 0 0 0 0
20 44 1 0 0 0 0
21 22 4 0 0 0 0
21 45 1 0 0 0 0
22 23 4 0 0 0 0
22 46 1 0 0 0 0
23 47 1 0 0 0 0
M END
$$$$

And the command:

mk_prepare_ligand.py -i ligand_1.sdf --receptor 3upo_protein.pdb --rec_residue "B:SER:222" --tether_smarts "C(=O)OCC" --tether_smarts_indices 5 4 -o prepared.pdbqt

@rwxayheee
Copy link
Contributor

Hi @HaoLan-compchem

Not sure if this is what you need but I was able to generate a prepared.pdbqt:

BEGIN_RES B SER 222
REMARK SMILES CCOC(=O)[C@@H](NC(=O)Cc1ccccc1)[C@@H]1[NH2+][C@@H](C(:O):[O-])C(C)(C)S1
REMARK SMILES IDX 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 10 10 11 11 12 12 13 16 14
REMARK SMILES IDX 13 15 15 16 14 17 17 18 18 19 26 20 19 21 23 24 24 25 25 26
REMARK SMILES IDX 20 27 21 28 22 29
REMARK H PARENT 7 9 18 22 18 23
REMARK Flexibility Score: inf
ROOT
ATOM      1  CA  UNL     1      17.947 -69.887   9.246  1.00  0.00     0.049 C 
ENDROOT
BRANCH   1   2
ATOM      2  CB  UNL     1      17.494 -68.558   8.615  1.00  0.00     0.229 C 
BRANCH   2   3
ATOM      3  O   UNL     1      18.553 -67.996   7.933  1.00  0.00    -0.464 OA
BRANCH   3   4
ATOM      4  C   UNL     1      18.470 -66.815   7.266  1.00  0.00     0.335 C 
ATOM      5  O   UNL     1      17.412 -66.200   7.227  1.00  0.00    -0.249 OA
BRANCH   4   6
ATOM      6  C   UNL     1      19.690 -66.233   6.580  1.00  0.00     0.262 C 
BRANCH   6   7
ATOM      7  N   UNL     1      19.975 -64.910   7.121  1.00  0.00    -0.337 N 
ATOM      8  C   UNL     1      20.291 -64.668   8.425  1.00  0.00     0.225 C 
ATOM      9  H   UNL     1      19.919 -64.109   6.474  1.00  0.00     0.164 HD
ATOM     10  O   UNL     1      20.356 -65.584   9.232  1.00  0.00    -0.275 OA
BRANCH   8  11
ATOM     11  C   UNL     1      20.536 -63.241   8.859  1.00  0.00     0.135 C 
BRANCH  11  12
ATOM     12  C   UNL     1      20.865 -63.087  10.324  1.00  0.00    -0.039 A 
ATOM     13  C   UNL     1      22.036 -63.656  10.854  1.00  0.00     0.004 A 
ATOM     14  C   UNL     1      20.010 -62.356  11.168  1.00  0.00     0.004 A 
ATOM     15  C   UNL     1      22.344 -63.496  12.209  1.00  0.00     0.000 A 
ATOM     16  C   UNL     1      20.322 -62.202  12.522  1.00  0.00     0.000 A 
ATOM     17  C   UNL     1      21.488 -62.771  13.042  1.00  0.00     0.000 A 
ENDBRANCH  11  12
ENDBRANCH   8  11
ENDBRANCH   6   7
BRANCH   6  18
ATOM     18  C   UNL     1      20.930 -67.180   6.641  1.00  0.00     0.277 C 
ATOM     19  N   UNL     1      22.166 -66.562   6.127  1.00  0.00    -0.325 N 
ATOM     20  S   UNL     1      20.587 -68.652   5.600  1.00  0.00    -0.084 SA
ATOM     21  C   UNL     1      22.101 -66.620   4.666  1.00  0.00     0.246 C 
ATOM     22  H   UNL     1      22.297 -65.586   6.478  1.00  0.00     0.347 HD
ATOM     23  H   UNL     1      22.980 -67.132   6.459  1.00  0.00     0.347 HD
ATOM     24  C   UNL     1      21.740 -68.083   4.295  1.00  0.00     0.073 C 
ATOM     25  C   UNL     1      22.958 -69.028   4.311  1.00  0.00     0.030 C 
ATOM     26  C   UNL     1      21.049 -68.139   2.922  1.00  0.00     0.030 C 
BRANCH  21  27
ATOM     27  C   UNL     1      23.362 -66.089   4.012  1.00  0.00     0.101 C 
ATOM     28  O   UNL     1      23.436 -66.010   2.797  1.00  0.00    -0.544 OA
ATOM     29  O   UNL     1      24.404 -65.684   4.766  1.00  0.00    -0.544 OA
ENDBRANCH  21  27
ENDBRANCH   6  18
ENDBRANCH   4   6
ENDBRANCH   3   4
ENDBRANCH   2   3
ENDBRANCH   1   2
END_RES B SER 222

Using your input (but I formatted it to be able to visualize it):

Penicillin
  PyMOL2.5 3D 0

 50 51  0  0  0  0  0  0  0  0999 V2000
    5.3493    2.9414   -2.0384 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.9239    4.3300   -1.0838 H   0  0  0  0  0  0  0  0  0  0  0  0
    6.7379    2.7539   -0.9413 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.7779    3.2498   -1.0848 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.1379   -2.7870    0.2309 N   0  3  0  0  0  0  0  0  0  0  0  0
    2.8211   -1.2229    1.0721 N   0  0  0  0  0  0  0  0  0  0  0  0
    5.8407   -3.2810    1.4152 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.8231    2.8589    0.0585 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.1151    0.8346    1.1599 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.1608   -0.6775    1.2522 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.1976   -1.3147    0.2726 C   0  0  0  0  0  0  0  0  0  0  0  0
    7.2100   -2.5510    1.4556 C   0  0  0  0  0  0  0  0  0  0  0  0
    8.2617   -3.1880    0.5245 C   0  0  0  0  0  0  0  0  0  0  0  0
    7.7493   -2.4908    2.8948 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.9244   -4.7949    1.4451 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.0787   -1.0716   -0.0606 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.6891   -1.6658   -0.1020 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.0478   -1.4272   -1.3975 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.4334   -1.9719   -2.6005 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.2624   -1.7614   -3.7953 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.4398   -1.0080   -3.7976 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.9247   -0.4644   -2.6052 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.2343   -0.6733   -1.4080 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.8533    1.4904    0.2249 O   0  0  0  0  0  0  0  0  0  0  0  0
    3.3922    1.4582    1.9255 O   0  0  0  0  0  0  0  0  0  0  0  0
    6.4244   -5.3622    2.4028 O   0  0  0  0  0  0  0  0  0  0  0  0
    2.5193   -0.4503   -1.0172 O   0  0  0  0  0  0  0  0  0  0  0  0
    5.4335   -5.5269    0.4252 O   0  5  0  0  0  0  0  0  0  0  0  0
    6.8837   -0.8575    0.8372 S   0  0  0  0  0  0  0  0  0  0  0  0
    4.4789   -0.9224    2.2883 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.0201   -0.9443   -0.7612 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.1528    3.3672    0.9898 H   0  0  0  0  0  0  0  0  0  0  0  0
    3.7958    3.1892   -0.2072 H   0  0  0  0  0  0  0  0  0  0  0  0
    7.9135   -3.2171   -0.5279 H   0  0  0  0  0  0  0  0  0  0  0  0
    8.5019   -4.2235    0.8459 H   0  0  0  0  0  0  0  0  0  0  0  0
    9.2038   -2.5992    0.5552 H   0  0  0  0  0  0  0  0  0  0  0  0
    7.0153   -1.9917    3.5639 H   0  0  0  0  0  0  0  0  0  0  0  0
    8.6954   -1.9103    2.9309 H   0  0  0  0  0  0  0  0  0  0  0  0
    7.9509   -3.5077    3.2905 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.4095   -1.7434    1.8615 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.1197   -1.2233    0.7440 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.7562   -2.7614    0.0699 H   0  0  0  0  0  0  0  0  0  0  0  0
    1.3422   -2.5612   -2.6083 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.1099   -2.1843   -4.7193 H   0  0  0  0  0  0  0  0  0  0  0  0
   -1.9776   -0.8469   -4.7227 H   0  0  0  0  0  0  0  0  0  0  0  0
   -2.8372    0.1176   -2.6076 H   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6234   -0.2484   -0.4909 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.2390   -2.9858    2.3027 H   0  0  0  0  0  0  0  0  0  0  0  0
    4.1558   -3.1425    0.1782 H   0  0  0  0  0  0  0  0  0  0  0  0
    5.6397   -3.1109   -0.6295 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  4  1  0  0  0  0
  2  4  1  0  0  0  0
  3  4  1  0  0  0  0
  5  7  1  0  0  0  0
  5 11  1  0  0  0  0
  5 49  1  0  0  0  0
  5 50  1  0  0  0  0
  6 10  1  0  0  0  0
  6 16  1  0  0  0  0
  6 40  1  0  0  0  0
  7 12  1  0  0  0  0
  7 15  1  0  0  0  0
  7 48  1  0  0  0  0
  4  8  1  0  0  0  0
  8 24  1  0  0  0  0
  8 32  1  0  0  0  0
  8 33  1  0  0  0  0
  9 10  1  0  0  0  0
  9 24  1  0  0  0  0
  9 25  2  0  0  0  0
 10 11  1  0  0  0  0
 10 30  1  0  0  0  0
 11 29  1  0  0  0  0
 11 31  1  0  0  0  0
 12 13  1  0  0  0  0
 12 14  1  0  0  0  0
 12 29  1  0  0  0  0
 13 34  1  0  0  0  0
 13 35  1  0  0  0  0
 13 36  1  0  0  0  0
 14 37  1  0  0  0  0
 14 38  1  0  0  0  0
 14 39  1  0  0  0  0
 15 26  4  0  0  0  0
 15 28  4  0  0  0  0
 16 17  1  0  0  0  0
 16 27  2  0  0  0  0
 17 18  1  0  0  0  0
 17 41  1  0  0  0  0
 17 42  1  0  0  0  0
 18 19  4  0  0  0  0
 18 23  4  0  0  0  0
 19 20  4  0  0  0  0
 19 43  1  0  0  0  0
 20 21  4  0  0  0  0
 20 44  1  0  0  0  0
 21 22  4  0  0  0  0
 21 45  1  0  0  0  0
 22 23  4  0  0  0  0
 22 46  1  0  0  0  0
 23 47  1  0  0  0  0
M  END
$$$$

My command is the same. The version of Meeko I used was:

0.5.0

Input and output in command prompt:

(my-rdkit-env) amyhe@Amys-MBP Downloads % mk_prepare_ligand.py -i Penicillin.sdf --receptor 3upo_protein.pdb --rec_residue "B:SER:222" --tether_smarts "C(=O)OCC" --tether_smarts_indices 5 4 -o prepared.pdbqt
/opt/homebrew/anaconda3/envs/my-rdkit-env/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
  EPOCH = datetime.datetime.utcfromtimestamp(0)
@> 6464 atoms and 1 coordinate set(s) were parsed in 0.03s.
CovalentBuilder> searching for residue: chid B and resname SER and resnum 222 and (name CA or name CB)
[10:51:25] Warning: molecule is tagged as 2D, but at least one Z coordinate is not zero. Marking the mol as 3D.

@yipy0005
Copy link

I'm having the same problem as well. I'm using meeko 0.5.0 and prody 2.4.1. I have tried the same thing on a Linux machine, it's the same error too.

@diogomart
Copy link
Contributor

It is caused by some incompatibility between prody and pyparsing, downgrading pyparsing to <3.1 fixes the issue.

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

4 participants