Example #1
0
def exercise():
    mon_lib_srv = monomer_library.server.server()
    ener_lib = monomer_library.server.ener_lib()
    processed_pdb_file = monomer_library.pdb_interpretation.process(
        mon_lib_srv=mon_lib_srv,
        ener_lib=ener_lib,
        file_name=None,
        raw_records=pdb_str,
        force_symmetry=True)
    pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy
    xray_structure = processed_pdb_file.xray_structure()

    geometry_restraints = processed_pdb_file.geometry_restraints_manager(
        show_energies=False)

    sites_cart = xray_structure.sites_cart()
    atoms = pdb_hierarchy.atoms()

    riding_h_manager = riding.manager(pdb_hierarchy=pdb_hierarchy,
                                      geometry_restraints=geometry_restraints)

    h_parameterization = riding_h_manager.h_parameterization

    diagnostics = parameterization.diagnostics_parameterization(
        connectivity_obj=riding_h_manager.connectivity_obj,
        h_parameterization=h_parameterization,
        sites_cart=sites_cart,
        threshold=0.05)

    h_distances = diagnostics.h_distances
    unk_list = diagnostics.unk_list

    # There are 90 H atoms in the pdb_string, check if all of them are recognized
    assert (len(
        h_parameterization.keys()) == 90), 'Not all H atoms are parameterized'

    # For each H atom, check if distance between computed H and that in input model is
    # not too large
    type_list = []
    for ih in h_distances:
        labels = atoms[ih].fetch_labels()
        hp = h_parameterization[ih]
        type_list.append(hp.htype)
        assert (h_distances[ih] < 0.03), 'distance too large: %s  atom: %s (%s) residue: %s ' \
          % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())

# Check if there are atoms with unknown parameterization
    assert (len(unk_list) == 0), 'Some H atoms are not recognized'

    # Check that parameterization types are correct
    assert (len(h_parameterization) == 90), 'Fewer H atoms than expected'
    for type1, type2 in zip(type_list, type_list_known):
        assert (type1 == type2)
def exercise(pdb_str):
    mon_lib_srv = monomer_library.server.server()
    ener_lib = monomer_library.server.ener_lib()
    processed_pdb_file = monomer_library.pdb_interpretation.process(
        mon_lib_srv=mon_lib_srv,
        ener_lib=ener_lib,
        file_name=None,
        raw_records=pdb_str,
        restraints_loading_flags={"use_neutron_distances": True},
        force_symmetry=True)
    pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy
    xray_structure = processed_pdb_file.xray_structure()

    geometry_restraints = processed_pdb_file.geometry_restraints_manager(
        show_energies=False)

    sites_cart = xray_structure.sites_cart()
    atoms = pdb_hierarchy.atoms()

    riding_h_manager = riding.manager(pdb_hierarchy=pdb_hierarchy,
                                      geometry_restraints=geometry_restraints)

    h_parameterization = riding_h_manager.h_parameterization

    diagnostics = parameterization.diagnostics_parameterization(
        connectivity_obj=riding_h_manager.connectivity_obj,
        h_parameterization=h_parameterization,
        sites_cart=sites_cart,
        threshold=0.05)

    h_distances = diagnostics.h_distances
    unk_list = diagnostics.unk_list
    number_h = diagnostics.number_h

    # For each H atom, check if distance between computed H and that in input model is
    # not too large
    type_list = []
    for ih in h_distances:
        labels = atoms[ih].fetch_labels()
        hp = h_parameterization[ih]
        type_list.append(hp.htype)
        assert (h_distances[ih] < 0.1), 'distance too large: %s  atom: %s (%s) residue: %s ' \
          % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())


#
    assert (len(unk_list) == 0), 'Some H atoms are not recognized'
    if (pdb_str != pdb_str_02):
        assert (number_h == len(h_parameterization.keys())), \
          'Not all H atoms are parameterized'
def exercise():
  mon_lib_srv = monomer_library.server.server()
  ener_lib = monomer_library.server.ener_lib()
  processed_pdb_file = monomer_library.pdb_interpretation.process(
    mon_lib_srv    = mon_lib_srv,
    ener_lib       = ener_lib,
    file_name      = None,
    raw_records    = pdb_str,
    force_symmetry = True)
  pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy
  xray_structure = processed_pdb_file.xray_structure()

  geometry_restraints = processed_pdb_file.geometry_restraints_manager(
    show_energies = False)

  sites_cart = xray_structure.sites_cart()
  atoms = pdb_hierarchy.atoms()

  riding_h_manager = riding.manager(
    pdb_hierarchy           = pdb_hierarchy,
    geometry_restraints = geometry_restraints)

  h_parameterization = riding_h_manager.h_parameterization
  diagnostics = parameterization.diagnostics_parameterization(
    connectivity_obj   = riding_h_manager.connectivity_obj,
    h_parameterization = h_parameterization,
    sites_cart         = sites_cart,
    threshold          = 0.05)

  h_distances        = diagnostics.h_distances
  unk_list           = diagnostics.unk_list

# There are 53 H atoms in the pdb_string, check if all of them are recognized
# Note: one H atom (VAL 7 HA) is bound to two CA atoms at once
  assert (len(h_parameterization.keys()) == 68), \
    'Not all H atoms are parameterized'

  type_list = []
  for ih in h_distances:
    labels = atoms[ih].fetch_labels()
    hp = h_parameterization[ih]
    type_list.append(hp.htype)
    assert (h_distances[ih] < 0.2), \
      'distance too large: %s  atom: %s (%s) residue: %s ' \
      % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())

  assert(len(unk_list) == 0), 'Some H atoms are not recognized'

  for type1, type2 in zip(type_list, type_list_known):
    assert (type1 == type2)
Example #4
0
def exercise(pdb_str, use_ideal_bonds_angles):
    # --------------------------------------------------------------
    #          code to switch off CDL
    # --------------------------------------------------------------
    #params_line = grand_master_phil_str
    #params = iotbx.phil.parse(
    #    input_string=params_line, process_includes=True).extract()
    #params.pdb_interpretation.restraints_library.cdl=False
    # ---------------------------------------------------------------
    mon_lib_srv = monomer_library.server.server()
    ener_lib = monomer_library.server.ener_lib()
    processed_pdb_file = monomer_library.pdb_interpretation.process(
        mon_lib_srv=mon_lib_srv,
        ener_lib=ener_lib,
        file_name=None,
        raw_records=pdb_str,
        force_symmetry=True)
    pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy
    xray_structure = processed_pdb_file.xray_structure()
    #
    geometry_restraints = processed_pdb_file.geometry_restraints_manager(
        show_energies=False)
    sites_cart = xray_structure.sites_cart()
    atoms = pdb_hierarchy.atoms()

    #  #mol = mmtbx.model.manager(
    #  #  restraints_manager = restraints_manager,
    #  #  xray_structure     = xray_structure,
    #  #  pdb_hierarchy      = pdb_hierarchy)
    #  #mol.geometry_minimization(nonbonded=True)
    #
    grf = cctbx.geometry_restraints.flags.flags(default=True)
    minimized = mmtbx.refinement.geometry_minimization.lbfgs(
        sites_cart=sites_cart,
        correct_special_position_tolerance=1.0,
        geometry_restraints_manager=geometry_restraints,
        geometry_restraints_flags=grf,
        lbfgs_termination_params=scitbx.lbfgs.termination_parameters(
            max_iterations=500))
    xray_structure.set_sites_cart(sites_cart)
    pdb_hierarchy.adopt_xray_structure(xray_structure)
    sites_cart = xray_structure.sites_cart()

    riding_h_manager = riding.manager(
        pdb_hierarchy=pdb_hierarchy,
        geometry_restraints=geometry_restraints,
        use_ideal_bonds_angles=use_ideal_bonds_angles)

    h_parameterization = riding_h_manager.h_parameterization

    diagnostics = parameterization.diagnostics_parameterization(
        connectivity_obj=riding_h_manager.connectivity_obj,
        h_parameterization=h_parameterization,
        sites_cart=sites_cart,
        threshold=0.05)

    h_distances = diagnostics.h_distances
    unk_list = diagnostics.unk_list
    number_h = diagnostics.number_h

    #type_list = []
    for ih in h_distances:
        labels = atoms[ih].fetch_labels()
        hp = h_parameterization[ih]
        #type_list.append(hp.htype)
        if use_ideal_bonds_angles:
            assert (h_distances[ih] < 0.03), \
              'distance too large: %s  atom: %s (%s) residue: %s ' \
              % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())
        else:
            assert (h_distances[ih] < 1e-8), \
              'distance too large: %s  atom: %s (%s) residue: %s ' \
              % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())
        print 'type: %s distance: %s  atom: %s (%s) residue: %s ' % \
          (hp.htype, h_distances[ih], atoms[ih].name, ih, labels.resseq)

    assert (number_h == len(h_parameterization.keys())), \
      'Not all H atoms are parameterized'
    assert (len(unk_list) == 0), 'Some H atoms are not recognized'
Example #5
0
def exercise():
    mon_lib_srv = monomer_library.server.server()
    ener_lib = monomer_library.server.ener_lib()
    processed_pdb_file = monomer_library.pdb_interpretation.process(
        mon_lib_srv=mon_lib_srv,
        ener_lib=ener_lib,
        file_name=None,
        raw_records=pdb_str,
        force_symmetry=True)
    pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy
    xray_structure = processed_pdb_file.xray_structure()

    geometry_restraints = processed_pdb_file.geometry_restraints_manager(
        show_energies=False)

    sites_cart = xray_structure.sites_cart()
    atoms = pdb_hierarchy.atoms()

    riding_h_manager = riding.manager(pdb_hierarchy=pdb_hierarchy,
                                      geometry_restraints=geometry_restraints)

    h_parameterization = riding_h_manager.h_parameterization
    h_connectivity = riding_h_manager.h_connectivity

    diagnostics = parameterization.diagnostics_parameterization(
        connectivity_obj=riding_h_manager.connectivity_obj,
        h_parameterization=h_parameterization,
        sites_cart=sites_cart,
        threshold=0.05)

    #number_h           = diagnostics.number_h
    #double_H           = diagnostics.double_H
    h_distances = diagnostics.h_distances
    unk_list = diagnostics.unk_list
    #unk_ideal_list     = diagnostics.unk_ideal_list
    #long_distance_list = diagnostics.long_distance_list
    #n_connect          = diagnostics.n_connect
    #slipped            = diagnostics.slipped

    # There are 152 H atoms in the pdb_string, check if all of them are recognized
    assert (len(
        h_parameterization.keys()) == 152), 'Not all H atoms are parameterized'

    # For each H atom, check if distance compared to input model is not > 0.05
    # 0.0014 = uncertainty for distance if uncertainty of coordinate = 0.001
    type_list = []
    for ih in h_distances:
        labels = atoms[ih].fetch_labels()
        hp = h_parameterization[ih]
        type_list.append(hp.htype)
        assert (h_distances[ih] < 0.05), 'distance too large: %s  atom: %s (%s) residue: %s ' \
          % (hp.htype, atoms[ih].name, ih, labels.resseq.strip())

# KEEP: useful for debugging
#for ih in h_parameterization.keys():
#  hp = h_parameterization[ih]
#  print "'"+hp.htype+"'"+',',
#
    assert (len(unk_list) == 0), 'Some H atoms are not recognized'

    for type1, type2 in zip(type_list, type_list_known):
        assert (type1 == type2)