コード例 #1
0
ファイル: tst.py プロジェクト: zhuligs/cctbx_project
def exercise_00(debug=True):
  mon_lib_srv = monomer_library.server.server()
  ener_lib = monomer_library.server.ener_lib()
  for i, l in enumerate(loop):
    if(debug): print "-"*70, i
    ppf = monomer_library.pdb_interpretation.process(
      mon_lib_srv    = mon_lib_srv,
      ener_lib       = ener_lib,
      raw_records    = flex.std_string(l[0].splitlines()),
      force_symmetry = True)
    geometry = ppf.geometry_restraints_manager(
      show_energies      = False,
      plain_pairs_radius = 5.0)
    restraints_manager = mmtbx.restraints.manager(
      geometry = geometry, normalization = False)
    ph = ppf.all_chain_proxies.pdb_hierarchy
    sel = hydrogens.rotatable(pdb_hierarchy=ph, mon_lib_srv=mon_lib_srv,
      restraints_manager = restraints_manager, log=None)
    if(debug):
      print
      print sel
      print l[2]
      print l[0]
      print "\n".join([a.format_atom_record() for a in ph.atoms()])
    ppf.all_chain_proxies.pdb_inp.write_pdb_file(file_name = "m%s.pdb"%str(i))
    if(debug): print "-"*80
    assert sel == l[2], "%s != %s" % (sel, l[2])
    assert hydrogens.count_rotatable(sel) == l[1]
コード例 #2
0
def exercise_01():
    pdb_inp = iotbx.pdb.input(source_info=None, lines=m5_str)
    ph = pdb_inp.construct_hierarchy()
    xrs_answer = pdb_inp.xray_structure_simple()
    xrs_answer.switch_to_neutron_scattering_dictionary()
    ph.write_pdb_file(file_name="answer.pdb")
    f_calc = xrs_answer.structure_factors(d_min=1).f_calc()
    fft_map = f_calc.fft_map(resolution_factor=0.1)
    fft_map.apply_sigma_scaling()
    map_data = fft_map.real_map_unpadded()
    #
    mon_lib_srv = monomer_library.server.server()
    ener_lib = monomer_library.server.ener_lib()
    ppf = monomer_library.pdb_interpretation.process(
        mon_lib_srv=mon_lib_srv,
        ener_lib=ener_lib,
        raw_records=flex.std_string(m5_str_HD_rotated.splitlines()),
        force_symmetry=True)
    geometry = ppf.geometry_restraints_manager(show_energies=False,
                                               plain_pairs_radius=5.0)
    restraints_manager = mmtbx.restraints.manager(geometry=geometry,
                                                  normalization=False)
    xrs = ppf.all_chain_proxies.pdb_inp.xray_structure_simple()
    ph = ppf.all_chain_proxies.pdb_hierarchy
    ph.write_pdb_file(file_name="poor.pdb")
    xrs.switch_to_neutron_scattering_dictionary()
    f_calc_poor = f_calc.structure_factors_from_scatterers(
        xray_structure=xrs).f_calc()
    #
    rotatable_h_selection = hydrogens.rotatable(
        pdb_hierarchy=ph,
        mon_lib_srv=mon_lib_srv,
        restraints_manager=restraints_manager,
        log=None)
    hydrogens.fit_rotatable(pdb_hierarchy=ph,
                            xray_structure=xrs,
                            map_data=map_data,
                            rotatable_h_selection=rotatable_h_selection)
    ph.write_pdb_file(file_name="result.pdb")
    #
    f_calc_fixed = f_calc.structure_factors_from_scatterers(
        xray_structure=xrs).f_calc()

    def r_factor(x, y):
        n = flex.sum(flex.abs(abs(x).data() - abs(y).data()))
        d = flex.sum(flex.abs(abs(x).data() + abs(y).data())) / 2
        return n / d

    assert r_factor(f_calc, f_calc_poor) > 0.2
    assert r_factor(f_calc, f_calc_fixed) < 0.015
コード例 #3
0
ファイル: tst.py プロジェクト: cctbx/cctbx-playground
def exercise_01():
  pdb_inp = iotbx.pdb.input(source_info=None, lines=m5_str)
  ph = pdb_inp.construct_hierarchy()
  xrs_answer = pdb_inp.xray_structure_simple()
  xrs_answer.switch_to_neutron_scattering_dictionary()
  ph.write_pdb_file(file_name = "answer.pdb")
  f_calc = xrs_answer.structure_factors(d_min=1).f_calc()
  fft_map = f_calc.fft_map(resolution_factor=0.1)
  fft_map.apply_sigma_scaling()
  map_data = fft_map.real_map_unpadded()
  #
  mon_lib_srv = monomer_library.server.server()
  ener_lib = monomer_library.server.ener_lib()
  ppf = monomer_library.pdb_interpretation.process(
    mon_lib_srv    = mon_lib_srv,
    ener_lib       = ener_lib,
    raw_records    = flex.std_string(m5_str_HD_rotated.splitlines()),
    force_symmetry = True)
  geometry = ppf.geometry_restraints_manager(
    show_energies      = False,
    plain_pairs_radius = 5.0)
  restraints_manager = mmtbx.restraints.manager(
    geometry = geometry, normalization = False)
  xrs = ppf.all_chain_proxies.pdb_inp.xray_structure_simple()
  ph = ppf.all_chain_proxies.pdb_hierarchy
  ph.write_pdb_file(file_name = "poor.pdb")
  xrs.switch_to_neutron_scattering_dictionary()
  f_calc_poor = f_calc.structure_factors_from_scatterers(
    xray_structure = xrs).f_calc()
  #
  rotatable_h_selection = hydrogens.rotatable(
    pdb_hierarchy      = ph,
    mon_lib_srv        = mon_lib_srv,
    restraints_manager = restraints_manager,
    log                = None)
  hydrogens.fit_rotatable(pdb_hierarchy=ph, xray_structure=xrs,
    map_data=map_data,rotatable_h_selection=rotatable_h_selection)
  ph.write_pdb_file(file_name = "result.pdb")
  #
  f_calc_fixed = f_calc.structure_factors_from_scatterers(
    xray_structure = xrs).f_calc()
  def r_factor(x,y):
    n = flex.sum( flex.abs( abs(x).data() - abs(y).data() ) )
    d = flex.sum( flex.abs( abs(x).data() + abs(y).data() ) )/2
    return n/d
  assert r_factor(f_calc, f_calc_poor) > 0.2
  assert r_factor(f_calc, f_calc_fixed) < 0.015
コード例 #4
0
ファイル: tst.py プロジェクト: zhuligs/cctbx_project
def exercise_02(debug=False):
  mon_lib_srv = monomer_library.server.server()
  ener_lib = monomer_library.server.ener_lib()
  ppf = monomer_library.pdb_interpretation.process(
    mon_lib_srv    = mon_lib_srv,
    ener_lib       = ener_lib,
    raw_records    = flex.std_string(exercise_02_str.splitlines()),
    force_symmetry = True)
  geometry = ppf.geometry_restraints_manager(
    show_energies      = False,
    plain_pairs_radius = 5.0)
  restraints_manager = mmtbx.restraints.manager(
    geometry = geometry, normalization = False)
  ph = ppf.all_chain_proxies.pdb_hierarchy
  sel = hydrogens.rotatable(pdb_hierarchy=ph, mon_lib_srv=mon_lib_srv,
    restraints_manager = restraints_manager, log = None)
  n_rot_h = hydrogens.count_rotatable(sel)
  assert n_rot_h == 43, n_rot_h