volkamerlab / opencadd

A Python library for structural cheminformatics
https://opencadd.readthedocs.io
MIT License
91 stars 18 forks source link

UnboundLocalError in MMLigner #71

Closed jaimergp closed 2 years ago

jaimergp commented 3 years ago

Hi there, When I am trying to use MMLigner, I get the following error:

mmligner = MMLignerAligner()
results_mm = mmligner.calculate([mol1_protein, mol2_protein])

> Current MMLigner wrappers produces accurate RMSD values but slightly shifted structures!
/home/i-am-curious/.conda/envs/pyscience/lib/python3.7/site-packages/MDAnalysis/coordinates/PDB.py:1028: UserWarning: Found no information for attr: 'tempfactors' Using default value of '0.0'
  "".format(attrname, default))
/home/i-am-curious/.conda/envs/pyscience/lib/python3.7/site-packages/MDAnalysis/core/topologyattrs.py:2011: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  np.array(sorted(unique_bonds)), 4) -------------------------------------------------------------------------- 
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-86-9df85d2189fa> in <module>
1 mmligner = MMLignerAligner()
----> 2 results_mm = mmligner.calculate([mol1_protein, mol2_protein])
~/.conda/envs/pyscience/lib/python3.7/site-packages/opencadd/structure/superposition/engines/base.py in calculate(self, structures, *args, **kwargs)
29         """
30         assert len(structures) == 2
---> 31         return self._calculate(structures, *args, **kwargs)
     32 
     33     def _calculate(self, structures, *args, **kwargs):
~/.conda/envs/pyscience/lib/python3.7/site-packages/opencadd/structure/superposition/engines/mmligner.py in _calculate(self,
structures, *args, **kwargs)
     94             )
     95             # We need access to the temporary files at parse time!
---> 96             result = self._parse_metadata(output.decode())
     97             superposed_models = self._calculate_transformed(structures, result["metadata"])
     98             result["superposed"] = superposed_models
~/.conda/envs/pyscience/lib/python3.7/site-packages/opencadd/structure/superposition/engines/mmligner.py in
_parse_metadata(self, output)
    142         # if the patched mmligner is used (check /devtools/conda-recipes/mmligner)
    143         # -- this will fail in CI for now --
--> 144         translation = fixed_com - moving_com
    145 
    146         alignment = fasta.FastaFile()
UnboundLocalError: local variable 'fixed_com' referenced before assignment

Is there a problem with the installation?

Originally posted by @hovo1990 in https://github.com/volkamerlab/opencadd/issues/16#issuecomment-766168782

dominiquesydow commented 2 years ago

Closing this issue, was fixed by @pipaj97 in PR #91.