Example #1
0
def exercise_get_atom_selections (verbose=False) :
  pdb_in = """\
CRYST1   15.000   15.000   15.000  90.00  90.00  90.00 P 212121
HETATM  115  O   HOH A  18       3.000   5.000   5.000  1.00 10.00           O
HETATM  115  O   HOH A  19       5.000   5.000   8.000  1.00 10.00           O
HETATM  115  O   HOH A  20       5.000   5.000   8.000  1.00 10.00           O
END"""
  log = null_out()
  if (verbose) :
    log = sys.stdout
  processed_pdb_files_srv = utils.process_pdb_file_srv(log=log)
  processed_pdb_file, pdb_inp = processed_pdb_files_srv.process_pdb_files(
    raw_records=pdb_in.splitlines())
  selections1 = utils.get_atom_selections(
    all_chain_proxies=processed_pdb_file.all_chain_proxies,
    xray_structure=processed_pdb_file.xray_structure(),
    selection_strings=["resseq 18", "resseq 19", "resseq 20"],
    parameter_name="refine.occupancy")
  try :
    selections2 = utils.get_atom_selections(
      all_chain_proxies=processed_pdb_file.all_chain_proxies,
      xray_structure=processed_pdb_file.xray_structure(),
      selection_strings=["resseq 18:19", "resseq 19:20"],
      parameter_name="refine.occupancy")
  except Sorry, s :
    assert (str(s) == """\
One or more overlapping selections for refine.occupancy:
resseq 18:19
resseq 19:20""")
Example #2
0
def exercise_get_atom_selections(verbose=False):
  pdb_in = """\
CRYST1   15.000   15.000   15.000  90.00  90.00  90.00 P 212121
HETATM  115  O   HOH A  18       3.000   5.000   5.000  1.00 10.00           O
HETATM  115  O   HOH A  19       5.000   5.000   8.000  1.00 10.00           O
HETATM  115  O   HOH A  20       5.000   5.000   8.000  1.00 10.00           O
END"""
  log = null_out()
  if (verbose):
    log = sys.stdout
  model = mmtbx.model.manager(
      model_input = iotbx.pdb.input(lines=pdb_in.splitlines(), source_info=None),
      process_input = True)
  processed_pdb_files_srv = utils.process_pdb_file_srv(log=log)
  processed_pdb_file, pdb_inp = processed_pdb_files_srv.process_pdb_files(
    raw_records=pdb_in.splitlines())
  selections1 = utils.get_atom_selections(
    model = model,
    selection_strings=["resseq 18", "resseq 19", "resseq 20"],
    parameter_name="refine.occupancy")
  try :
    selections2 = utils.get_atom_selections(
      model = model,
      selection_strings=["resseq 18:19", "resseq 19:20"],
      parameter_name="refine.occupancy")
  except Sorry, s :
    assert (str(s) == """\
One or more overlapping selections for refine.occupancy:
resseq 18:19
resseq 19:20""")
Example #3
0
    def __init__(self,
                 start_pdb,
                 target_I,
                 ntotal,
                 nmodes,
                 max_rmsd,
                 backbone_scale,
                 prefix,
                 weight='i',
                 method='rtb',
                 log='tmp.log'):
        self.counter = 0
        self.nmode_init = ntotal
        self.method = method
        self.nmodes = nmodes
        self.topn = 10
        self.Niter = 0
        self.modes = flex.int(range(self.nmode_init)) + 7
        self.cutoff = 8
        self.weighted = True
        self.log = open(log, 'w')
        self.chi = open(prefix + '.chi', 'w')
        pdb_inp = pdb.input(file_name=start_pdb)
        crystal_symmetry = pdb_inp.xray_structure_simple().\
            cubic_unit_cell_around_centered_scatterers(
            buffer_size = 10).crystal_symmetry()
        self.pdb_processor = process_pdb_file_srv(
            crystal_symmetry=crystal_symmetry)

        self.expt = saxs_read_write.read_standard_ascii_qis(target_I)
        self.q = self.expt.q
        self.expt_I = self.expt.i
        self.expt_s = self.expt.s
        if (self.q.size() > 100):
            self.q = self.interpolation(self.q, n_pts=30)
            self.expt_I = flex.linear_interpolation(self.expt.q, self.expt.i,
                                                    self.q)
            self.expt_s = flex.linear_interpolation(self.expt.q, self.expt.s,
                                                    self.q)

        #if( weight=='i'):
        self.expt_s = self.expt_I

        for aa, bb, cc in zip(self.q, self.expt_I, self.expt_s):
            print aa, bb, cc

        start_name = start_pdb
        self.pdb = PDB(start_name, method=self.method)
        self.she_engine = she.she(start_name, self.q)
        self.natom = self.pdb.natm
        self.scale_factor = backbone_scale
        self.pdb.Hessian(self.cutoff, self.nmode_init, self.scale_factor)

        self.root = prefix
        self.scale = 0
        self.drmsd = max_rmsd
        if (self.method == 'rtb'):
            self.drmsd = self.drmsd * 2
        self.Rmax2 = self.natom * (self.drmsd)**2.0
        self.step_size = sqrt(self.Rmax2 / self.nmodes) * 6.0

        self.new_indx = flex.int(range(self.natom))
        self.stop = False
        self.minscore = 1e20
        self.minDev = 0  #minimum deviations of refined structures, compared to refined structure from the previous step
        self.optNum = 1  #number of iterations between geometry optimization
        ### set running env for pulchra ###
        import libtbx.env_config
        env = libtbx.env_config.unpickle()
        self.pulchra = env.build_path + '/pulchra/exe/pulchra'
        self.iterate()
        self.log.close()
        self.chi.close()
Example #4
0
    def __init__(self,
                 start_pdb,
                 target_I,
                 max_rmsd,
                 backbone_scale,
                 prefix,
                 nstep_per_cycle=100,
                 method='ca',
                 weight='i',
                 log='tmp.log'):
        self.counter = 0
        self.topn = 3
        self.Niter = 0
        self.method = method
        self.cutoff = 12
        self.log = open(log, 'w')
        self.nstep_per_cycle = nstep_per_cycle
        self.pdb_obj = PDB(start_pdb, method=self.method)
        crystal_symmetry = self.pdb_obj.pdbi.xray_structure_simple().\
            cubic_unit_cell_around_centered_scatterers(
            buffer_size = 10).crystal_symmetry()
        self.pdb_processor = process_pdb_file_srv(
            crystal_symmetry=crystal_symmetry)

        self.expt = saxs_read_write.read_standard_ascii_qis(target_I)
        self.q = self.expt.q
        self.expt_I = self.expt.i
        self.expt_s = self.expt.s
        if (self.q.size() > 20):
            self.q = self.interpolation(self.q, n_pts=20)
            self.expt_I = flex.linear_interpolation(self.expt.q, self.expt.i,
                                                    self.q)
            self.expt_s = flex.linear_interpolation(self.expt.q, self.expt.s,
                                                    self.q)

        if (weight == 'i'):
            self.expt_s = flex.sqrt(self.expt_I)

        self.time_nm = 0
        self.time_she = 0
        self.she_engine = she.she(start_pdb, self.q)
        self.natom = self.pdb_obj.natm
        self.nbeads = self.pdb_obj.n_block
        self.scale_factor = backbone_scale
        time1 = time.time()
        self.time_nm += (time.time() - time1)

        self.root = prefix
        self.drmsd = max_rmsd
        self.step_size = self.drmsd * 3
        self.threshold = self.drmsd**2.0

        self.new_indx = flex.int(range(self.natom))
        self.stop = False
        self.minscore = 1e20
        self.minDev = 0  #minimum deviations of refined structures, compared to refined structure from the previous step
        self.optNum = 10  #number of iterations between geometry optimization

        #self.estimate_init_weight()
        #self.restraint_weight *= 8  ## contribute 8x of chi initially
        self.iterate()
        self.log.close()

        print "time used for NM : %d" % self.time_nm
        print "time used for she: %d" % self.time_she
Example #5
0
    def __init__(self,
                 start_pdb,
                 target_I,
                 ntotal,
                 nmodes,
                 max_rmsd,
                 backbone_scale,
                 prefix,
                 weight='i',
                 method='rtb',
                 log='tmp.log'):
        self.counter = 0
        self.nmode_init = ntotal
        self.nmodes = 3  #nmodes
        self.method = method
        self.topn = 3
        self.Niter = 0
        self.modes = flex.int(range(self.nmode_init)) + 7
        self.cutoff = 12
        self.weighted = True
        self.log = open(log, 'w')
        pdb_inp = pdb.input(file_name=start_pdb)
        crystal_symmetry = pdb_inp.xray_structure_simple().\
            cubic_unit_cell_around_centered_scatterers(
            buffer_size = 10).crystal_symmetry()
        #    uc=cctbx.uctbx.unit_cell("300,300,300,90,90,90")
        #    crystal_symmetry=cctbx.crystal.symmetry(uc, 'P1')
        self.pdb_processor = process_pdb_file_srv(
            crystal_symmetry=crystal_symmetry)

        self.expt = saxs_read_write.read_standard_ascii_qis(target_I)
        self.q = self.expt.q
        self.expt_I = self.expt.i
        self.expt_s = self.expt.s
        if (self.q.size() > 50):
            self.q = self.interpolation(self.q, n_pts=50)
            self.expt_I = flex.linear_interpolation(self.expt.q, self.expt.i,
                                                    self.q)
            self.expt_s = flex.linear_interpolation(self.expt.q, self.expt.s,
                                                    self.q)

        if (weight == 'i'):
            self.expt_s = self.expt_I

        self.time_nm = 0
        self.time_she = 0
        start_name = start_pdb
        self.pdb = PDB(start_name, method=self.method)
        self.she_engine = she.she(start_name, self.q)
        self.natom = self.pdb.natm
        self.scale_factor = backbone_scale
        time1 = time.time()
        self.nmode = self.pdb.Hessian(self.cutoff, self.nmode_init,
                                      self.scale_factor)
        self.time_nm += (time.time() - time1)

        self.root = prefix
        self.drmsd = max_rmsd
        self.Rmax2 = self.natom * (self.drmsd)**2.0
        self.step_size = sqrt(self.Rmax2 / self.nmodes) * 5.0

        self.new_indx = flex.int(range(self.natom))
        self.stop = False
        self.minscore = 1e20
        self.minDev = 0  #minimum deviations of refined structures, compared to refined structure from the previous step
        self.optNum = 10  #number of iterations between geometry optimization
        self.iterate()
        self.log.close()

        print "time used for NM : %d" % self.time_nm
        print "time used for she: %d" % self.time_she