Skip to content

Commit

Permalink
Merge pull request #169 from martimunicoy/mae_compatibility
Browse files Browse the repository at this point in the history
Mae compatibility
  • Loading branch information
martimunicoy committed Jun 13, 2022
2 parents 5c041ed + 9471905 commit 5ee3484
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
7 changes: 6 additions & 1 deletion docs/releasehistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 <https:/
1.4.2 - Compatibility fixes for latest RDKit and Schrodinger versions
---------------------------------------------------------------------

This is a micro release of peleffy that fixes several bugs related with latest versions of RDKit and Schrodinger. Affected modules are rotamer libraries, the runner and parser of the ffld server, and the alchemistry package.
This is a micro release of peleffy that fixes several bugs related with latest versions of RDKit and Schrodinger. Affected modules are rotamer libraries, the runner and parser of the ffld server, and the alchemistry package. It also adds some minor improvements to log handlers.

New features
""""""""""""
- `PR #166 <https://github.com/martimunicoy/peleffy/pull/166>`_: New options for log handlers.

Bugfixes
""""""""
- `PR #167 <https://github.com/martimunicoy/peleffy/pull/167>`_: Bug fixes for rotamer libraries and affected tests
- `PR #168 <https://github.com/martimunicoy/peleffy/pull/168>`_: Compatibility changes for the ffld server shipped with latest Schrodinger version
- `PR #169 <https://github.com/martimunicoy/peleffy/pull/169>`_: Support new RDKit versions.


1.4.1 - Bug fixes for heteromolecules extraction
Expand Down
6 changes: 3 additions & 3 deletions peleffy/data/tests/alchemical_structure.pdb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ CONECT 3 12 13 14
CONECT 4 15 16 17
CONECT 5 6 18 19
CONECT 6 7 7 8
CONECT 20 21 25
CONECT 20 21 21 25
CONECT 21 22 26
CONECT 22 23 27
CONECT 22 23 23 27
CONECT 23 24 28
CONECT 24 25 29
CONECT 24 25 25 29
CONECT 25 30
END
4 changes: 4 additions & 0 deletions peleffy/utils/toolkits.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ def alchemical_combination(self, mol1, mol2, atom_mapping,
for atom in mol_combo.GetAtoms():
atom.SetIsAromatic(False)

# Sanitize it
Chem.SanitizeMol(mol_combo,
Chem.SANITIZE_ALL ^ Chem.SANITIZE_KEKULIZE ^ Chem.SANITIZE_SETAROMATICITY)

return mol_combo


Expand Down
16 changes: 11 additions & 5 deletions peleffy/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def parse_charges_from_mae(path, parameters):
import re

# Read external file containing the partial charges information
params_info, params_list = ([] for i in range(2))
params_info, params_list = ([], [])
copy = False
with open(path, 'r') as file:
for line in file.readlines():
Expand All @@ -333,15 +333,21 @@ def parse_charges_from_mae(path, parameters):
params_list = [l.replace('"', '').split() for l in params_list[1:-1]]

# Get the index of the atom name and charge from the parameter's list
idx_charges, idx_atom_name = (None for i in range(2))
idx_charges, idx_atom_name = (None, None)
for idx, line in enumerate(params_info):
# Get PDB atom name
if 's_m_pdb_atom_name' in line:
idx_atom_name = idx

# Get precomputed charges
if 'r_m_charge1' in line:
idx_charges = idx
if idx_charges is None or idx_atom_name is None:
raise ValueError(
" {} does not contain charges information. ".format(path))

if idx_charges is None:
raise ValueError(f"{path} does not contain charges information")

if idx_atom_name is None:
raise ValueError(f"{path} does not contain PDB atom names information")

# Creates a charges by atom name dictionary
d = {}
Expand Down

0 comments on commit 5ee3484

Please sign in to comment.