コード例 #1
0
def exercise_2():
    """
  Same as 1 but automatic NCS search procedure does not match short chains,
  in this case chains B,C, so they left out of NCS.
  Not clear if we should utilize MTRIX instead of searching for NCS
  because currently we don't output them and in consecutive runs NCS
  search would be utilized anyway, potentially yelding different groups.
  """
    inp = iotbx.pdb.input(source_info=None, lines=pdb_str_2)
    pdb_int_params = mmtbx.model.manager.get_default_pdb_interpretation_params(
    )
    pdb_int_params.pdb_interpretation.ncs_search.enabled = True
    model = mmtbx.model.manager(model_input=inp,
                                pdb_interpretation_params=pdb_int_params,
                                process_input=True,
                                log=null_out())
    # model.get_xray_structure()
    ss = model.get_ss_annotation()
    assert ss.get_n_helices() == 3
    assert ss.get_n_sheets() == 3

    assert not model.ncs_constraints_present()
    assert model.get_ncs_obj() is not None
    model.setup_ncs_constraints_groups()
    # print model.get_ncs_obj()
    assert model.ncs_constraints_present()
    assert model.get_master_hierarchy().atoms_size() == 15
    # print model.get_master_hierarchy().as_pdb_string()
    assert list(model.get_master_selection()).count(True) == 15
コード例 #2
0
ファイル: tst_model_biomt_mtrix.py プロジェクト: dials/cctbx
def exercise_biomt():
  inp = iotbx.pdb.input(lines=biomt_txt+ss_txt+atoms_txt, source_info=None)
  model = mmtbx.model.manager(
    model_input = inp)
  assert model.get_number_of_atoms() == 300, model.get_number_of_atoms()
  assert model.get_hierarchy().atoms_size() == 300
  assert model.get_xray_structure().scatterers().size() == 300
  ss_ann = model.get_ss_annotation()
  assert ss_ann.get_n_helices() == 2
  assert ss_ann.get_n_sheets() == 1
  model.expand_with_BIOMT_records()
  assert model.get_number_of_atoms() == 900, model.get_number_of_atoms()
  assert model.get_hierarchy().atoms_size() == 900
  assert model.get_xray_structure().scatterers().size() == 900, model.get_xray_structure().scatterers().size()
  ss_ann = model.get_ss_annotation()
  assert ss_ann.get_n_helices() == 6
  assert ss_ann.get_n_sheets() == 3
コード例 #3
0
ファイル: atom_selection.py プロジェクト: dials/cctbx
    def run(self):
        # I'm guessing self.data_manager, self.params and self.logger
        # are already defined here...

        # this must be mmtbx.model.manager?
        model = self.data_manager.get_model()
        atoms = model.get_atoms()
        all_bsel = flex.bool(atoms.size(), False)
        for selection_string in self.params.atom_selection_program.inselection:
            print("Selecting '%s'" % selection_string, file=self.logger)
            isel = model.iselection(string=selection_string)
            all_bsel.set_selected(isel, True)
            if self.params.atom_selection_program.write_pdb_file is None:
                print("  %d atom%s selected" % plural_s(isel.size()),
                      file=self.logger)
                for atom in atoms.select(isel):
                    print("    %s" % atom.format_atom_record(),
                          file=self.logger)
        print("", file=self.logger)
        if self.params.atom_selection_program.write_pdb_file is not None:
            print("Writing file:",
                  show_string(
                      self.params.atom_selection_program.write_pdb_file),
                  file=self.logger)
            ss_ann = model.get_ss_annotation()
            if not model.crystal_symmetry() or \
              (not model.crystal_symmetry().unit_cell()):
                model = shift_and_box_model(model, shift_model=False)
            selected_model = model.select(all_bsel)
            if (ss_ann is not None):
                selected_model.set_ss_annotation(ss_ann.\
                    filter_annotation(
                        hierarchy=selected_model.get_hierarchy(),
                        asc=selected_model.get_atom_selection_cache(),
                        remove_short_annotations=False,
                        remove_3_10_helices=False,
                        remove_empty_annotations=True,
                        concatenate_consecutive_helices=False,
                        split_helices_with_prolines=False,
                        filter_sheets_with_long_hbonds=False))
            if self.params.atom_selection_program.cryst1_replacement_buffer_layer is not None:
                box = uctbx.non_crystallographic_unit_cell_with_the_sites_in_its_center(
                    sites_cart=selected_model.get_atoms().extract_xyz(),
                    buffer_layer=self.params.atom_selection_program.
                    cryst1_replacement_buffer_layer)
                sp = crystal.special_position_settings(box.crystal_symmetry())
                sites_frac = box.sites_frac()
                xrs_box = selected_model.get_xray_structure(
                ).replace_sites_frac(box.sites_frac())
                xray_structure_box = xray.structure(sp, xrs_box.scatterers())
                selected_model.set_xray_structure(xray_structure_box)
            pdb_str = selected_model.model_as_pdb()
            f = open(self.params.atom_selection_program.write_pdb_file, 'w')
            f.write(pdb_str)
            f.close()
            print("", file=self.logger)
コード例 #4
0
ファイル: tst_model_biomt_mtrix.py プロジェクト: dials/cctbx
def exercise_mtrix():
  inp = iotbx.pdb.input(lines=mtrix_txt+ss_txt+atoms_txt, source_info=None)
  model = mmtbx.model.manager(
    model_input = inp)
  assert model.get_number_of_atoms() == 900, model.get_number_of_atoms()
  assert model.get_hierarchy().atoms_size() == 900
  assert model.get_xray_structure().scatterers().size() == 900
  ss_ann = model.get_ss_annotation()
  # print ss_ann.as_pdb_str()
  assert ss_ann.get_n_helices() == 6
  assert ss_ann.get_n_sheets() == 3
コード例 #5
0
def exercise_1():
  inp = iotbx.pdb.input(source_info=None, lines=pdb_str_1)
  model = mmtbx.model.manager(
      model_input = inp,
      log = null_out())
  assert model.get_number_of_atoms() == 21
  assert model.get_hierarchy().atoms_size() == 21
  assert model.get_xray_structure().scatterers().size() == 21
  ss = model.get_ss_annotation()
  # print ss.as_pdb_str()
  # STOP()
  assert ss.get_n_helices() == 3
  # because the second strand contains chain B which is not in ATOM records
  # whole sheet got discarded.
  assert ss.get_n_sheets() == 0
  rm = model.get_restraints_manager()
  assert rm.geometry.pair_proxies().bond_proxies.simple.size() == 6
  # since No NCS was set, these functions return the whole thing and no
  # master selection
  assert model.get_master_hierarchy().atoms_size() == 21
  assert model.get_master_selection().size() == 0
  # print model.model_as_pdb()
  # print "="*40

  # Here we set NCS constraints
  inp = iotbx.pdb.input(source_info=None, lines=pdb_str_1)
  pdb_int_params = mmtbx.model.manager.get_default_pdb_interpretation_params()
  pdb_int_params.pdb_interpretation.ncs_search.enabled=True
  model = mmtbx.model.manager(
      model_input = inp,
      pdb_interpretation_params = pdb_int_params,
      process_input=True,
      log = null_out())
  # model.get_xray_structure()
  assert not model.ncs_constraints_present()
  assert model.get_ncs_obj() is not None
  model.setup_ncs_constraints_groups()
  # print model.get_ncs_obj()
  assert model.ncs_constraints_present()
  assert model.get_master_hierarchy().atoms_size() == 7
  # print model.get_master_hierarchy().as_pdb_string()
  # print list(model.get_master_selection())
  assert list(model.get_master_selection()).count(True) == 7
コード例 #6
0
ファイル: prepare_model_for_rsr.py プロジェクト: dials/cctbx
def show_ss_counts(model):
    ss = model.get_ss_annotation()
    print("Number of helices:", ss.get_n_helices())
    print("Number of sheets :", ss.get_n_sheets())