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

sync torsion tree update from nashtools #43

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions unidock_tools/unidock_tools/ligand_prepare/rotatable_bond.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ def __init__(self,
max_breaks=4):

self.rotatable_bond_smarts = '[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]'
self.amide_bond_smarts = '[C&$(C=O)]-[N&$(NC=O);v3;H1,H2;0]'
self.conjugate_bond_smarts = '*=*[*]=,#,:[*]'
self.rotatable_bond_pattern = Chem.MolFromSmarts(self.rotatable_bond_smarts)
self.amide_bond_pattern = Chem.MolFromSmarts(self.amide_bond_smarts)
self.conjugate_bond_pattern = Chem.MolFromSmarts(self.conjugate_bond_smarts)

self.min_macrocycle_size = min_macrocycle_size
Expand All @@ -19,4 +21,13 @@ def __init__(self,

def identify_rotatable_bonds(self, mol):
default_rotatable_bond_info_list = list(mol.GetSubstructMatches(self.rotatable_bond_pattern))
amide_rotatable_bond_info_list = list(mol.GetSubstructMatches(self.amide_bond_pattern))

for amide_rotatable_bond_info in amide_rotatable_bond_info_list:
amide_rotatable_bond_info_reversed = tuple(reversed(amide_rotatable_bond_info))
if amide_rotatable_bond_info in default_rotatable_bond_info_list:
default_rotatable_bond_info_list.remove(amide_rotatable_bond_info)
elif amide_rotatable_bond_info_reversed in default_rotatable_bond_info_list:
default_rotatable_bond_info_list.remove(amide_rotatable_bond_info_reversed)

return default_rotatable_bond_info_list
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ def build_molecular_graph(self):
if bond_info in rotatable_bond_info_list or bond_info_reversed in rotatable_bond_info_list:
rotatable_bond_idx_list.append(bond.GetIdx())

splitted_mol = FragmentOnBonds(mol, rotatable_bond_idx_list, addDummies=False)
splitted_mol_list = list(GetMolFrags(splitted_mol, asMols=True, sanitizeFrags=False))
if len(rotatable_bond_idx_list) != 0:
splitted_mol = FragmentOnBonds(mol, rotatable_bond_idx_list, addDummies=False)
splitted_mol_list = list(GetMolFrags(splitted_mol, asMols=True, sanitizeFrags=False))
else:
splitted_mol_list = [mol]

num_fragments = len(splitted_mol_list)

Expand Down