Skip to content

Commit

Permalink
Merge pull request #143 from martimunicoy/devel
Browse files Browse the repository at this point in the history
1.3.1 Release
  • Loading branch information
martimunicoy committed Jun 9, 2021
2 parents 377862a + 0896d1c commit d21a852
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
15 changes: 15 additions & 0 deletions docs/releasehistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 <https:/
* ``minor`` increments add features but do not break API compatibility
* ``micro`` increments represent bugfix releases or improvements in documentation


1.3.1 - PELE Platform support
-----------------------------

This is a micro release of peleffy that includes minor adjustments for the PELE Platform and other small fixes.

New features
""""""""""""
- `PR #142 <https://github.com/martimunicoy/peleffy/pull/142>`_: Minor adjustments to facilitate platform compatibility.

Bugfixes
""""""""
- Minor error when parsing Impact templates.


1.3.0 - BCE conformations and automatic heteromolecules extraction
------------------------------------------------------------------

Expand Down
6 changes: 5 additions & 1 deletion peleffy/forcefield/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ def reindex_atom_idx(list_params, dict_index):
with open(impact_template_path, 'r') as fd:
type_info = 'tag'
for line in fd.readlines():
if len(line.strip()) == 0: # Skip empty lines
continue
if not line.startswith('*'):
if 'NBON' in line:
type_info = 'nbon'
Expand All @@ -517,6 +519,8 @@ def reindex_atom_idx(list_params, dict_index):
type_info = 'phi'
elif 'IPHI' in line:
type_info = 'iphi'
elif 'END' in line:
break
else:
if type_info == 'tag':
tag.append(line)
Expand Down Expand Up @@ -594,7 +598,7 @@ def reindex_atom_idx(list_params, dict_index):

# Impropers
impropers_list = []
for line in iphi[:-1]:
for line in iphi:
info = line.split()
case = {'atom1_idx': index(info[0]),
'atom2_idx': index(info[1]),
Expand Down
7 changes: 0 additions & 7 deletions peleffy/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,6 @@ def test_generate_OPLS2005ParameterWrapper(molecule,
test_generate_OPLS2005ParameterWrapper(molecule,
impact_template_path)

# Test with molecule with phase different than 0 or 180
# Load molecule, parameterize and generate Impact template
molecule = Molecule(smiles='c1c(c(n(n1)S(=O)(=O)C))O')
impact_template_path = get_data_file_path('tests/unlz')
test_generate_OpenForceFieldParameterWrapper(molecule,
impact_template_path)

# The molecule and Impact template do no represent the same chemical
# entity
with pytest.raises(ValueError):
Expand Down
29 changes: 18 additions & 11 deletions peleffy/topology/conformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

class BCEConformations(object):
"""
A class to produce a library of conformations from the output
of the BCE server.
A class to produce a library of conformations from a set of ligand PDB files.
"""
def __init__(self, topology_obj, bce_output_path):
def __init__(self, topology_obj, bce_output_path, from_bce=True):
"""
Initializes a BCEConformations object.
Expand All @@ -29,11 +28,15 @@ def __init__(self, topology_obj, bce_output_path):
A Topology object that contains the ligand's information
bce_output_path: str
Path where the output from the BCE server is stored
from_bce : bool
Whether the ligand clusters originate from the BCE server or not. Affects cluster search path in
_calculate_all_conformations method.
"""
self._topology = topology_obj
self._molecule = topology_obj.molecule
self.bce_path = bce_output_path
self.conformations_library = {}
self.from_bce = from_bce

def calculate(self):
"""
Expand All @@ -44,9 +47,11 @@ def calculate(self):
self._calculate_all_conformations()

def _calculate_all_conformations(self):
clusters = sorted(glob.glob(os.path.join(self.bce_path,
"CLUSTERS", "CL*",
"cluster*.min.imaged.pdb")))
if self.from_bce:
clusters = sorted(glob.glob(os.path.join(self.bce_path, "CLUSTERS", "CL*", "cluster*.min.imaged.pdb")))
else:
clusters = sorted(glob.glob(os.path.join(self.bce_path, "*.pdb")))

if not clusters:
raise ValueError("Path to the BCE output does not contain a "
+ "CLUSTERS folder, please check if the path "
Expand All @@ -56,7 +61,6 @@ def _calculate_all_conformations(self):
for cluster in ordered_clusters:
self.calculate_cluster_offsets(cluster)


def calculate_cluster_offsets(self, cluster_pdb):
"""
Calculate dihedral angles from PDB.
Expand All @@ -71,7 +75,8 @@ def calculate_cluster_offsets(self, cluster_pdb):
# Use the input molecule as template since the cluster structures
# probably will not have proper stereochemistry
mol = molecule.Molecule(
cluster_pdb, connectivity_template=self._molecule.rdkit_molecule)
cluster_pdb, connectivity_template=self._molecule.rdkit_molecule,
allow_undefined_stereo=self._molecule.allow_undefined_stereo)
cluster_coordinates = mol.get_conformer()
topology_to_cluster = {
i: x for i, x
Expand Down Expand Up @@ -136,7 +141,8 @@ def order_clusters_min_distances(self, clusters):
# probably will not have proper stereochemistry
cluster_molecules.append(molecule.Molecule(
cluster,
connectivity_template=self._molecule.rdkit_molecule))
connectivity_template=self._molecule.rdkit_molecule,
allow_undefined_stereo=self._molecule.allow_undefined_stereo))
for i, cluster_mol in enumerate(cluster_molecules):
for j, cluster_mol_2 in enumerate(cluster_molecules[i+1:],
start=i+1):
Expand Down Expand Up @@ -179,6 +185,7 @@ def find_optimal_path_from_matrix(distances):

return min_path


def find_heuristic_path(graph, distances, start_node):
"""
Given a graph, the corresponding distances matrix and a starting node,
Expand Down Expand Up @@ -222,13 +229,13 @@ def find_heuristic_path(graph, distances, start_node):
def find_index_root(sorted_topology, topology):
"""
It finds the index of the root atom in the original topology
that matches with the one from the topology that fullfills the Impact
that matches with the one from the topology that fulfills the Impact
template rules.
Parameters
----------
sorted_topology : a peleffy.topology.Topology object
The topology sorted to fullfill the Impact template format
The topology sorted to fulfill the Impact template format
topology : a peleffy.topology.Topology object
The original topology object
Expand Down

0 comments on commit d21a852

Please sign in to comment.