diff --git a/cctbx/geometry_restraints/standard_cif_links.py b/cctbx/geometry_restraints/standard_cif_links.py index 486c18501b..5f3776b3c4 100644 --- a/cctbx/geometry_restraints/standard_cif_links.py +++ b/cctbx/geometry_restraints/standard_cif_links.py @@ -1,4 +1,7 @@ from __future__ import absolute_import, division, print_function +# +# regenerate using python /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'], @@ -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'], diff --git a/mmtbx/monomer_library/linking_mixins.py b/mmtbx/monomer_library/linking_mixins.py index 7e2f2d424a..13a8b33a87 100644 --- a/mmtbx/monomer_library/linking_mixins.py +++ b/mmtbx/monomer_library/linking_mixins.py @@ -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 @@ -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 @@ -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 diff --git a/mmtbx/monomer_library/linking_utils.py b/mmtbx/monomer_library/linking_utils.py index d58302880b..00e3d06547 100644 --- a/mmtbx/monomer_library/linking_utils.py +++ b/mmtbx/monomer_library/linking_utils.py @@ -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, @@ -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,