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: can't multiply sequence by non-int of type 'Forward' in AF2_model_docking.ipynb of cell 5. #13

Open
rytakahashi opened this issue Jun 6, 2024 · 1 comment

Comments

@rytakahashi
Copy link

Dear Sir,

again, many thank for your work.

when I checked an example notebook
execution of cell 5 gave me the following errors.

However, when I re-executed it, I was able to reproduce it.

My question is why I cannot overwrite this pair_spatial_metrics at the first execution?

Many thanks,

{
	"name": "TypeError",
	"message": "can't multiply sequence by non-int of type 'Forward'",
	"stack": "---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[8], line 7
      5 holo_chainid = 'A' # see the receptor chain ID in poseview
      6 # reverse the input as the residue is on af2 structure and crystal_ligand here is useless
----> 7 results_df = pair_spatial_metrics(
      8     str(af2), str(crystal_ligand), str(holo), 
      9     'A', holo_chainid, 
     10     bs_res_str = flexible_residues.split(','),
     11 )
     12 ca_rmsd = results_df.iloc[0].mean_ca_rmsd
     13 sc_rmsd = results_df.iloc[0].mean_sc_rmsd

File ~/software/DiffBindFR/DiffBindFR/utils/apo_holo.py:845, in pair_spatial_metrics(holo_pdb, lig_file, apo_pdb, holo_chains, apo_chains, return_bs, bs_cutoff, chi, units, debug, bs_res_str)
    843     holo_bindsite = bs_res_finder(ligand_coords, holo_prody, bs_cutoff)
    844 else:
--> 845     holo_bindsite = specific_bs_res(holo_prody, bs_res_str)
    847 # map to alignment and sequence and back to apo_binding residues
    848 apo_holo_mask, holo_bind_res, apo_bind_res = get_apo_bind_indices(
    849     holo_bindsite,
    850     holo_seq, apo_seq,
   (...)
    853     holo_crmap, apo_crmap,
    854 )

File ~/software/DiffBindFR/DiffBindFR/utils/apo_holo.py:186, in specific_bs_res(holo_prody, bs_res_str)
    183     res_sel.append(f'(chain {xs[0]} and resnum {xs[1]} and resname {xs[2]})')
    185 res_sel = ' or '.join(res_sel)
--> 186 pkt = holo_prody.select(res_sel)
    187 holo_bindsite = []
    188 if pkt is None:

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/prody/atomic/atomic.py:232, in Atomic.select(self, selstr, **kwargs)
    228 def select(self, selstr, **kwargs):
    229     \"\"\"Returns atoms matching *selstr* criteria.  See :mod:`~.select` module
    230     documentation for details and usage examples.\"\"\"
--> 232     return SELECT.select(self, selstr, **kwargs)

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/prody/atomic/select.py:894, in Select.select(self, atoms, selstr, **kwargs)
    891 self._replace = False
    893 self._selstr = selstr
--> 894 indices = self.getIndices(atoms, selstr, **kwargs)
    896 self._kwargs = None
    898 if len(indices) == 0:

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/prody/atomic/select.py:952, in Select.getIndices(self, atoms, selstr, **kwargs)
    949         raise SelectionError(selstr, 0, 'is not a valid selection '
    950                              'string', [ss])
    951 else:
--> 952     torf = self.getBoolArray(atoms, selstr, **kwargs)
    953     return torf.nonzero()[0]

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/prody/atomic/select.py:1003, in Select.getBoolArray(self, atoms, selstr, **kwargs)
   1001 selstr = replaceMacros(selstr)
   1002 try:
-> 1003     parser = self._getParser(selstr)
   1004     tokens = parser(selstr, parseAll=True)
   1005 except pp.ParseException as err:

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/prody/atomic/select.py:1102, in Select._getParser(self, selstr)
   1100 parser.setParseAction(self._default)
   1101 parser.leaveWhitespace()
-> 1102 parser.enablePackrat()
   1103 self._parsers[key] = parser, expr, oplist
   1104 return parser.parseString

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/pyparsing/util.py:265, in replaced_by_pep8.<locals>._inner(*args, **kwargs)
    260 @wraps(fn)
    261 def _inner(*args, **kwargs):
    262     # warnings.warn(
    263     #     f\"Deprecated - use {fn.__name__}\", DeprecationWarning, stacklevel=2
    264     # )
--> 265     return fn(*args, **kwargs)

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/pyparsing/core.py:1132, in ParserElement.enable_packrat(cache_size_limit, force)
   1130     ParserElement.packrat_cache = _UnboundedCache()
   1131 else:
-> 1132     ParserElement.packrat_cache = _FifoCache(cache_size_limit)  # type: ignore[assignment]
   1133 ParserElement._parse = ParserElement._parseCache

File ~/miniforge-pypy3/envs/diffbindfr/lib/python3.9/site-packages/pyparsing/util.py:105, in _FifoCache.__init__(self, size)
    103 self.not_in_cache = not_in_cache = object()
    104 cache = {}
--> 105 keyring = [object()] * size
    106 cache_get = cache.get
    107 cache_pop = cache.pop

TypeError: can't multiply sequence by non-int of type 'Forward'"
}
@HBioquant
Copy link
Owner

Hahaha. I also want to know that 😂 😂. As long as the code runs successfully, it's all good.

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

2 participants