def run(args, out=None):
    if (out is None): out = sys.stdout
    from mmtbx.building.alternate_conformations import single_residue
    import mmtbx.command_line
    cmdline = mmtbx.command_line.load_model_and_data(args=args,
                                                     master_phil=master_phil(),
                                                     process_pdb_file=True,
                                                     create_fmodel=True,
                                                     out=out,
                                                     usage_string="""\
mmtbx.build_alt_confs_simple model.pdb data.mtz [options]

Simple tool for building alternate conformations by real-space refinement into
difference density.  Not intended for production use - use the program
mmtbx.build_alternate_conformations if you want refinement and post-processing.
""")
    params = cmdline.params
    validate_params(params)
    log = multi_out()
    log.register("stdout", out)
    log_file_name = os.path.splitext(params.output.file_name)[0] + ".log"
    logfile = open(log_file_name, "w")
    log.register("logfile", logfile)
    pdb_hierarchy, n_alternates = single_residue.build_cycle(
        pdb_hierarchy=cmdline.pdb_hierarchy,
        fmodel=cmdline.fmodel,
        geometry_restraints_manager=cmdline.geometry,
        params=params,
        cif_objects=cmdline.cif_objects,
        selection=params.selection,
        nproc=params.nproc,
        verbose=params.output.verbose,
        debug=params.output.debug,
        out=log)
    # TODO real-space refinement of multi-conformer model
    f = open(params.output.file_name, "w")
    f.write(
        pdb_hierarchy.as_pdb_string(
            crystal_symmetry=cmdline.fmodel.xray_structure))
    f.close()
    make_header("Building complete", out=out)
    print >> log, ""
    print >> log, "Wrote %s" % params.output.file_name
    print >> log, "You MUST refine this model before using it!"
def run (args, out=None) :
  if (out is None) : out = sys.stdout
  from mmtbx.building.alternate_conformations import single_residue
  import mmtbx.command_line
  cmdline = mmtbx.command_line.load_model_and_data(
    args=args,
    master_phil=master_phil(),
    process_pdb_file=True,
    create_fmodel=True,
    out=out,
    usage_string="""\
mmtbx.build_alt_confs_simple model.pdb data.mtz [options]

Simple tool for building alternate conformations by real-space refinement into
difference density.  Not intended for production use - use the program
mmtbx.build_alternate_conformations if you want refinement and post-processing.
""")
  params = cmdline.params
  validate_params(params)
  log = multi_out()
  log.register("stdout", out)
  log_file_name = os.path.splitext(params.output.file_name)[0] + ".log"
  logfile = open(log_file_name, "w")
  log.register("logfile", logfile)
  pdb_hierarchy, n_alternates = single_residue.build_cycle(
    pdb_hierarchy = cmdline.pdb_hierarchy,
    fmodel = cmdline.fmodel,
    geometry_restraints_manager = cmdline.geometry,
    params = params,
    cif_objects=cmdline.cif_objects,
    selection=params.selection,
    nproc=params.nproc,
    verbose=params.output.verbose,
    debug=params.output.debug,
    out=log)
  # TODO real-space refinement of multi-conformer model
  f = open(params.output.file_name, "w")
  f.write(pdb_hierarchy.as_pdb_string(
    crystal_symmetry=cmdline.fmodel.xray_structure))
  f.close()
  make_header("Building complete", out=out)
  print >> log, ""
  print >> log, "Wrote %s" % params.output.file_name
  print >> log, "You MUST refine this model before using it!"
Example #3
0
 def build_residue_conformers (self, stop_if_none=False) :
   self.extract_selection()
   print >> self.out, ""
   #self.fmodel.info().show_targets(out=self.out, text="starting model")
   make_sub_header("Fitting individual residues", out=self.out)
   t1 = time.time()
   params = self.params
   self.pdb_hierarchy, n_alternates = single_residue.build_cycle(
     pdb_hierarchy = self.pdb_hierarchy,
     fmodel = self.fmodel,
     geometry_restraints_manager = self.geometry_restraints_manager,
     params = params,
     cif_objects=self.cif_objects,
     selection=params.selection,
     nproc=params.nproc,
     verbose=self.verbose,
     debug=self.debug,
     out=self.out)
   if (n_alternates == 0) and (stop_if_none) :
     raise Sorry("No new conformations generated.")
   return n_alternates