Exemple #1
0
def run(args):
  if len(args) == 0:
    show_usage()
    return
  inp_fn = args[0]
  import time
  t0=time.time()
  pdb_input = iotbx.pdb.input(
      file_name=inp_fn,
      source_info=None,
      raise_sorry_if_format_error=True)
  t0=time.time()
  model = mmtbx.model.manager(
      model_input = pdb_input)
  pdb_h = model.get_hierarchy()
  info = pdb_h.flip_symmetric_amino_acids()
  print info
  model.set_sites_cart_from_hierarchy()

  out_fn_prefix = inp_fn
  if inp_fn.endswith(".pdb") or inp_fn.endswith(".cif"):
    out_fn_prefix = inp_fn[:-4]
  out_fn = out_fn_prefix + "_iupac.pdb"

  if model.input_format_was_cif():
    out_fn = out_fn_prefix + "_iupac.cif"
    txt = model.model_as_mmcif()
  else:
    out_fn = out_fn_prefix + "_iupac.cif"
    txt = model.model_as_pdb()
  with open(out_fn, 'w') as f:
    f.write(txt)
Exemple #2
0
def run(args):
  if len(args) == 0:
    show_usage()
    return
  inp_fn = args[0]
  pdb_input = iotbx.pdb.input(
      file_name=inp_fn,
      source_info=None,
      raise_sorry_if_format_error=True)
  model = mmtbx.model.manager(
      model_input = pdb_input)

  out_fn_prefix = inp_fn
  if inp_fn.endswith(".pdb") or inp_fn.endswith(".cif"):
    out_fn_prefix = inp_fn[:-4]
  out_fn = out_fn_prefix + "_sorted"

  txt = ""
  if model.input_format_was_cif():
    out_fn += ".cif"
    txt = model.model_as_mmcif()
  else:
    out_fn += ".pdb"
    txt = model.model_as_pdb()
  with open(out_fn, 'w') as f:
    f.write(txt)
def run(args):
    """
  Apply MTRIX records of PDB or equivalent records of mmCIF.
  Example:
    phenix.pdb.mtrix_reconstruction model.pdb
    phenix.pdb.mtrix_reconstruction model.cif
  """
    if (len(args) == 0 or "--help" in args or "-h" in args):
        print run.__doc__
        return
    file_name = args[0]
    pdb_inp = iotbx.pdb.input(file_name=file_name)
    model = mmtbx.model.manager(model_input=pdb_inp)
    if model.input_format_was_cif():
        out_text = model.model_as_mmcif()
        ext = ".cif"
    else:
        out_text = model.model_as_pdb()
        ext = ".pdb"
    ofn = "%s_MTRIX_expanded%s" % (os.path.splitext(
        os.path.basename(file_name))[0], ext)
    print "Writing result to %s file." % ofn
    with open(ofn, 'w') as f:
        f.write(out_text)