Esempio n. 1
0
    def create_protein_hbond_proxies(self, annotation=None, log=sys.stdout):
        # assert as_regular_bond_proxies=True
        if annotation is None:
            annotation = self.actual_sec_str
        remove_outliers = self.params.secondary_structure.protein.remove_outliers

        from scitbx.array_family import flex
        atoms = self.pdb_hierarchy.atoms()
        hbond_counts = flex.int(atoms.size(), 0)

        distance_ideal = self.params.secondary_structure.protein.distance_ideal_n_o
        distance_cut = self.params.secondary_structure.protein.distance_cut_n_o
        if (distance_cut is None):
            distance_cut = -1
        generated_proxies = geometry_restraints.shared_bond_simple_proxy()
        hb_angle_proxies = []
        if self.params.secondary_structure.protein.enabled:
            for helix in self.params.secondary_structure.protein.helix:
                if helix.selection is not None:
                    print >> log, "    Processing helix ", helix.selection
                    proxies, angle_proxies = proteins.create_helix_hydrogen_bond_proxies(
                        params=helix,
                        pdb_hierarchy=self.pdb_hierarchy,
                        selection_cache=self.selection_cache,
                        weight=1.0,
                        hbond_counts=hbond_counts,
                        distance_ideal=distance_ideal,
                        distance_cut=distance_cut,
                        remove_outliers=remove_outliers,
                        restrain_hbond_angles=self.params.secondary_structure.
                        protein.restrain_hbond_angles,
                        log=log)
                    if (proxies.size() == 0):
                        print >> log, "      No H-bonds generated for '%s'" % helix.selection
                        continue
                    else:
                        generated_proxies.extend(proxies)
                        hb_angle_proxies += angle_proxies
            for k, sheet in enumerate(
                    self.params.secondary_structure.protein.sheet):
                print >> log, "    Processing sheet with id=%s, first strand: %s" % (
                    sheet.sheet_id, sheet.first_strand)
                if sheet.first_strand is not None:
                    proxies, angle_proxies = proteins.create_sheet_hydrogen_bond_proxies(
                        sheet_params=sheet,
                        pdb_hierarchy=self.pdb_hierarchy,
                        selection_cache=self.selection_cache,
                        weight=1.0,
                        hbond_counts=hbond_counts,
                        distance_ideal=distance_ideal,
                        distance_cut=distance_cut,
                        remove_outliers=remove_outliers,
                        restrain_hbond_angles=self.params.secondary_structure.
                        protein.restrain_hbond_angles,
                        log=log)
                    if (proxies.size() == 0):
                        print >> log, \
                            "  No H-bonds generated for sheet with id=%s" % sheet.sheet_id
                        continue
                    else:
                        generated_proxies.extend(proxies)
                        hb_angle_proxies += angle_proxies

        n_proxies = generated_proxies.size()
        print >> log, ""
        if (n_proxies == 0):
            print >> log, "    No hydrogen bonds defined for protein."
        else:
            print >> log, "    %d hydrogen bonds defined for protein." % n_proxies
            print >> log, "    %d hydrogen bond angles defined for protein." % len(
                hb_angle_proxies)
        return generated_proxies, geometry_restraints.shared_angle_proxy(
            hb_angle_proxies)
Esempio n. 2
0
  def create_protein_hbond_proxies (self,
                            annotation=None,
                            log=sys.stdout):
    # assert as_regular_bond_proxies=True
    if annotation is None:
      annotation = self.actual_sec_str
    remove_outliers = self.params.secondary_structure.protein.remove_outliers

    from scitbx.array_family import flex
    atoms = self.pdb_hierarchy.atoms()
    hbond_counts = flex.int(atoms.size(), 0)
    selection_cache = self.pdb_hierarchy.atom_selection_cache()

    distance_ideal = self.params.secondary_structure.protein.distance_ideal_n_o
    distance_cut = self.params.secondary_structure.protein.distance_cut_n_o
    if (distance_cut is None) :
      distance_cut = -1
    generated_proxies = geometry_restraints.shared_bond_simple_proxy()
    if self.params.secondary_structure.protein.enabled:
      for helix in self.params.secondary_structure.protein.helix :
        if helix.selection is not None:
          print >> log, "    Processing helix ", helix.selection
          proxies = proteins.create_helix_hydrogen_bond_proxies(
              params=helix,
              pdb_hierarchy=self.pdb_hierarchy,
              selection_cache=selection_cache,
              weight=1.0,
              hbond_counts=hbond_counts,
              distance_ideal=distance_ideal,
              distance_cut=distance_cut,
              remove_outliers=remove_outliers,
              log=log)
          if (proxies.size() == 0) :
            print >> log, "      No H-bonds generated for '%s'" % helix.selection
            continue
          else:
            generated_proxies.extend(proxies)
      for k, sheet in enumerate(self.params.secondary_structure.protein.sheet) :
        print >> log, "    Processing sheet with id=%s, first strand: %s" % (
            sheet.sheet_id, sheet.first_strand)
        if sheet.first_strand is not None:
          proxies = proteins.create_sheet_hydrogen_bond_proxies(
            sheet_params=sheet,
            pdb_hierarchy=self.pdb_hierarchy,
            weight=1.0,
            hbond_counts=hbond_counts,
            distance_ideal=distance_ideal,
            distance_cut=distance_cut,
            remove_outliers=remove_outliers,
            log=log)
          if (proxies.size() == 0) :
            print >> log, \
                "  No H-bonds generated for sheet with id=%s" % sheet.sheet_id
            continue
          else:
            generated_proxies.extend(proxies)

    n_proxies = generated_proxies.size()
    print >> log, ""
    if (n_proxies == 0) :
      print >> log, "    No hydrogen bonds defined for protein."
    else :
      print >> log, "    %d hydrogen bonds defined for protein." % n_proxies
    # reg_proxies = []
    # for hb_p in build_proxies.proxies:
    #   reg_proxy = geometry_restraints.bond_simple_proxy(
    #     i_seqs=hb_p.i_seqs,
    #     distance_ideal=hb_p.distance_ideal,
    #     weight=hb_p.weight,
    #     slack=hb_p.slack,
    #     top_out=hb_p.top_out,
    #     limit=hb_p.limit,
    #     origin_id=1)
    #   reg_proxies.append(reg_proxy)
    # return geometry_restraints.shared_bond_simple_proxy(reg_proxies)
    return generated_proxies