Skip to content

Commit

Permalink
adding mechanism to add specific link
Browse files Browse the repository at this point in the history
  • Loading branch information
nwmoriarty committed Nov 15, 2024
1 parent c67571d commit 796849d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
4 changes: 4 additions & 0 deletions cctbx/geometry_restraints/standard_cif_links.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from __future__ import absolute_import, division, print_function
#
# regenerate using python <PHENIX>/modules/cctbx_project/mmtbx/monomer_library/populate_auto_linking_origin_ids.py
#
standard_cif_links = [
['link_ACE_C-N', 'ACE_C-N from Monomer Library or GeoStd'],
['link_AHT-ALA', 'AHT-ALA from Monomer Library or GeoStd'],
Expand All @@ -8,6 +11,7 @@
['link_ALPHA1-6', 'ALPHA1-6 from Monomer Library or GeoStd'],
['link_ALPHA2-3', 'ALPHA2-3 from Monomer Library or GeoStd'],
['link_ALPHA2-6', 'ALPHA2-6 from Monomer Library or GeoStd'],
['link_ASP_CG-ANY_N', 'ASP_CG-ANY_N from Monomer Library or GeoStd'],
['link_BETA1-2', 'BETA1-2 from Monomer Library or GeoStd'],
['link_BETA1-3', 'BETA1-3 from Monomer Library or GeoStd'],
['link_BETA1-4', 'BETA1-4 from Monomer Library or GeoStd'],
Expand Down
5 changes: 5 additions & 0 deletions mmtbx/monomer_library/linking_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def check_for_peptide_links(atom1,
other = atom_group2
else:
other = atom_group1
#
# only for AA to other
#
if linking_utils.get_class(other.resname) not in ["other"]:
return None
# sulfur bridge
Expand Down Expand Up @@ -758,6 +761,7 @@ def _nonbonded_pair_objects(max_bonded_cutoff=3., i_seqs=None):
atom2,
classes1.important_only,
classes2.important_only,
self.mon_lib_srv,
)
if link=='TRANS':
key=link
Expand All @@ -783,6 +787,7 @@ def _nonbonded_pair_objects(max_bonded_cutoff=3., i_seqs=None):
return_none_if_absent=True,
)
if verbose: print('apply standard link', key, origin_id)
assert origin_id
if origin_id is None:
# user defined links should not be applied here
continue
Expand Down
44 changes: 28 additions & 16 deletions mmtbx/monomer_library/linking_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,13 @@ def is_atom_group_pair_linked(atom_group1,
#
# look in link list for atom group links
#
simple_key = "%s-%s" % (
atom_group1.resname,
atom_group2.resname,
)
if simple_key in mon_lib_srv.link_link_id_dict:
return mon_lib_srv.link_link_id_dict[simple_key], False, simple_key
simple_key = "%s-%s" % (
atom_group2.resname,
atom_group1.resname,
)
if simple_key in mon_lib_srv.link_link_id_dict:
return mon_lib_srv.link_link_id_dict[simple_key], True, simple_key
key_data = [
["%s-%s" % (atom_group1.resname, atom_group2.resname), False],
["%s-%s" % (atom_group2.resname, atom_group1.resname), True],
]
for i, (simple_key, swap) in enumerate(key_data):
if simple_key in mon_lib_srv.link_link_id_dict:
return mon_lib_srv.link_link_id_dict[simple_key], swap, simple_key
return None, None, None

def is_atom_metal_coordinated(lookup,
Expand Down Expand Up @@ -363,15 +358,32 @@ def allow_cis_trans(classes1, classes2):
def is_atom_pair_linked_tuple(atom1,
atom2,
class_important_1,
class_important_2):
# if class_important_1=='common_amino_acid' and class_important_2==class_important_1:
class_important_2,
mon_lib_srv,
):
#
# atom name specific links
#
if allow_cis_trans_important(class_important_1, class_important_2):
if atom1.name==' N ' and atom2.name==' C ':
return _get_cis_trans(), False, '?'
elif atom1.name==' C ' and atom2.name==' N ':
return _get_cis_trans(), True, '?'
# else:
# print('amino acid link not found',atom1.quote(),atom2.quote())
atom_group1 = atom1.parent()
atom_group2 = atom2.parent()
key_data = [
# ['%s_%s-%s_%s' % (atom_group1.resname, atom1.name.strip(),
# atom_group2.resname, atom2.name.strip()), False],
# ['%s_%s-%s_%s' % (atom_group2.resname, atom2.name.strip(),
# atom_group1.resname, atom1.name.strip()), True],
['%s_%s-%s_%s' % (atom_group1.resname, atom1.name.strip(),
'ANY', atom2.name.strip()), False],
['%s_%s-%s_%s' % (atom_group2.resname, atom2.name.strip(),
'ANY', atom1.name.strip()), True],
]
for i, (simple_key, swap) in enumerate(key_data):
if simple_key in mon_lib_srv.link_link_id_dict:
return mon_lib_srv.link_link_id_dict[simple_key], swap, simple_key
return None, None, None

def is_atom_pair_linked(atom1,
Expand Down

0 comments on commit 796849d

Please sign in to comment.