def exercise_01(verbose):
    if (verbose): log = sys.stdout
    else: log = StringIO()
    pdb_file = libtbx.env.find_in_repositories(
        relative_path="phenix_regression/pdb/ala_hd.pdb", test=os.path.isfile)
    model = get_model(pdb_file, log)
    model.de_deuterate()
    assert (len(model.hd_group_selections()) == 0)
    ph = model.get_hierarchy()
    atoms = ph.atoms()
    assert (atoms.extract_element().count('D') == 0)
    assert (model.get_hd_selection().count(True) == 7)
def exercise_04(verbose):
    if (verbose): log = sys.stdout
    else: log = StringIO()
    model = get_model(file_name=None, log=log, pdb_str=pdb_str_1)
    model.de_deuterate()
    assert (len(model.hd_group_selections()) == 0)
    ph = model.get_hierarchy()
    atoms = ph.atoms()
    assert (atoms.extract_element().count('D') == 0)
    assert (model.get_hd_selection().count(True) == 15)
    atom_names = [x.strip() for x in atoms.extract_name()]
    assert ('D' not in atom_names)
    assert ('DG' not in atom_names)
def exercise_05(verbose):
    if (verbose): log = sys.stdout
    else: log = StringIO()
    model = get_model(file_name=None, log=log, pdb_str=pdb_str_2)
    #model.get_hierarchy().write_pdb_file(file_name="haha.pdb")
    model.de_deuterate()
    assert (len(model.hd_group_selections()) == 0)
    ph = model.get_hierarchy()
    atoms = ph.atoms()
    assert (atoms.extract_element().count('D') == 0)
    #print(model.get_hd_selection().count(True))
    assert (model.get_hd_selection().count(True) == 35)
    assert (model.selection('resname DOD').count(True) == 0)