Пример #1
0
def generate_magnessium_inputs(file_base="mg_frag", anonymize=True):
    """
  Creates a fake model and reflection data for a structure containing magnesium
  ions.

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
    pdb_file = write_pdb_input_magnessium_binding(file_base=file_base)
    mtz_file = generate_mtz_file(file_base=file_base, d_min=1.5)
    assert os.path.isfile(pdb_file) and os.path.isfile(mtz_file)
    if anonymize:
        pdb_in = any_file(pdb_file)
        hierarchy = pdb_in.file_object.hierarchy
        hierarchy, n = anonymize_ions(hierarchy, log=null_out())
        pdb_file = file_base + "_hoh.pdb"
        hierarchy.write_pdb_file(
            file_name=pdb_file,
            crystal_symmetry=pdb_in.file_object.crystal_symmetry())
        assert os.path.isfile(pdb_file)
    return os.path.abspath(mtz_file), os.path.abspath(pdb_file)
def generate_magnessium_inputs (file_base="mg_frag", anonymize=True) :
  """
  Creates a fake model and reflection data for a structure containing magnesium
  ions.

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
  pdb_file = write_pdb_input_magnessium_binding (file_base=file_base)
  mtz_file = generate_mtz_file(
    file_base=file_base,
    d_min=1.5)
  assert os.path.isfile(pdb_file) and os.path.isfile(mtz_file)
  if anonymize:
    pdb_in = any_file(pdb_file)
    hierarchy = pdb_in.file_object.hierarchy
    hierarchy, n = anonymize_ions(hierarchy, log=null_out())
    pdb_file = file_base + "_hoh.pdb"
    hierarchy.write_pdb_file(
      file_name=pdb_file,
      crystal_symmetry=pdb_in.file_object.crystal_symmetry())
    assert os.path.isfile(pdb_file)
  return os.path.abspath(mtz_file), os.path.abspath(pdb_file)
Пример #3
0
def generate_zinc_inputs(file_base="zn_frag", anonymize=True, wavelength=None):
    """
  Generate both a PDB file and an MTZ file for the zinc-bound structure,
  with the zinc optionally replaced by solvent after F(model) was
  calculated. Zinc is simulated as an anomalous scatterer at 1.54 A.

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
    anom = None
    if (wavelength is None):
        fp = -1.3
        fdp = 0.47
        anom = [
            group_args(selection="element ZN", fp=fp, fdp=fdp),
        ]
    pdb_file = write_pdb_input_zinc_binding(file_base=file_base)
    mtz_file = generate_mtz_file(file_base=file_base,
                                 d_min=1.9,
                                 anomalous_scatterers=anom,
                                 wavelength=wavelength)
    assert os.path.isfile(pdb_file) and os.path.isfile(mtz_file)
    if anonymize:
        pdb_in = any_file(pdb_file)
        hierarchy = pdb_in.file_object.hierarchy
        hierarchy, n = anonymize_ions(hierarchy, log=null_out())
        pdb_file = file_base + "_hoh.pdb"
        hierarchy.write_pdb_file(
            file_name=pdb_file,
            crystal_symmetry=pdb_in.file_object.crystal_symmetry())
        assert os.path.isfile(pdb_file)
    return os.path.abspath(mtz_file), os.path.abspath(pdb_file)
def generate_zinc_inputs (file_base="zn_frag", anonymize=True,
    wavelength=None) :
  """
  Generate both a PDB file and an MTZ file for the zinc-bound structure,
  with the zinc optionally replaced by solvent after F(model) was
  calculated. Zinc is simulated as an anomalous scatterer at 1.54 A.

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
  anom = None
  if (wavelength is None) :
    fp = -1.3
    fdp = 0.47
    anom = [ group_args(selection="element ZN", fp=fp, fdp=fdp), ]
  pdb_file = write_pdb_input_zinc_binding(file_base=file_base)
  mtz_file = generate_mtz_file(
    file_base=file_base,
    d_min=1.9,
    anomalous_scatterers=anom,
    wavelength=wavelength)
  assert os.path.isfile(pdb_file) and os.path.isfile(mtz_file)
  if anonymize:
    pdb_in = any_file(pdb_file)
    hierarchy = pdb_in.file_object.hierarchy
    hierarchy, n = anonymize_ions(hierarchy, log=null_out())
    pdb_file = file_base + "_hoh.pdb"
    hierarchy.write_pdb_file(
      file_name=pdb_file,
      crystal_symmetry=pdb_in.file_object.crystal_symmetry())
    assert os.path.isfile(pdb_file)
  return os.path.abspath(mtz_file), os.path.abspath(pdb_file)
Пример #5
0
def generate_calcium_inputs(file_base="ca_frag", anonymize=True):
    """
  Generate both a PDB file and an MTZ file for the calcium-bound structure,
  with the calcium optionally  replaced by solvent after F(model) was
  calculated. Calcium is simulated as an anomalous scatterer at 1.025 A.

  (This method is also a suitable template for generating any other model/data
  files for specific structures.)

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
    pdb_file = write_pdb_input_calcium_binding(file_base=file_base)
    mtz_file = generate_mtz_file(file_base=file_base,
                                 d_min=1.5,
                                 anomalous_scatterers=[
                                     group_args(selection="element CA",
                                                fp=0.25,
                                                fdp=0.5)
                                 ])
    assert (os.path.isfile(pdb_file)) and (os.path.isfile(mtz_file))
    if anonymize:
        pdb_in = any_file(pdb_file)
        hierarchy = pdb_in.file_object.hierarchy
        hierarchy, n = anonymize_ions(hierarchy, log=null_out())
        pdb_file = file_base + "_hoh.pdb"
        hierarchy.write_pdb_file(
            file_name=pdb_file,
            crystal_symmetry=pdb_in.file_object.crystal_symmetry())
        assert os.path.isfile(pdb_file)
    return os.path.abspath(mtz_file), os.path.abspath(pdb_file)
def generate_calcium_inputs (file_base="ca_frag", anonymize=True) :
  """
  Generate both a PDB file and an MTZ file for the calcium-bound structure,
  with the calcium optionally  replaced by solvent after F(model) was
  calculated. Calcium is simulated as an anomalous scatterer at 1.025 A.

  (This method is also a suitable template for generating any other model/data
  files for specific structures.)

  Parameters
  ----------
  file_base : str, optional
  anonymize : bool, optional
      Replace all ions in the returned pdb file with waters.

  Returns
  -------
  mtz_path : str
  pdb_path : str
  """
  pdb_file = write_pdb_input_calcium_binding(file_base=file_base)
  mtz_file = generate_mtz_file(
    file_base=file_base,
    d_min=1.5,
    anomalous_scatterers=[
      group_args(selection="element CA", fp=0.25, fdp=0.5)
      ])
  assert (os.path.isfile(pdb_file)) and (os.path.isfile(mtz_file))
  if anonymize:
    pdb_in = any_file(pdb_file)
    hierarchy = pdb_in.file_object.hierarchy
    hierarchy, n = anonymize_ions(hierarchy, log=null_out())
    pdb_file = file_base + "_hoh.pdb"
    hierarchy.write_pdb_file(
      file_name=pdb_file,
      crystal_symmetry=pdb_in.file_object.crystal_symmetry())
    assert os.path.isfile(pdb_file)
  return os.path.abspath(mtz_file), os.path.abspath(pdb_file)