示例#1
0
def test_find_missing_heavy_atoms():
    fn = get_fn('2igd/2igd.pdb')
    parm = pmd.load_file(fn)
    parm2 = parm[':1-2&!@CB']
    parm2.save("test.pdb", overwrite=True)
    pdbfixer = AmberPDBFixer(parm2)
    assert len(pdbfixer.find_missing_heavy_atoms()) == 2
    assert 'CB' not in set(atom.name for atom in pdbfixer.parm.atoms)
示例#2
0
def test_constructore_AmberPDBFixer():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)

    fixer_0 = AmberPDBFixer(parm)
    fixer_1 = AmberPDBFixer(fn)

    assert len(fixer_0.parm.atoms) == len(fixer_1.parm.atoms)
示例#3
0
def test_add_missing_atoms():
    fname = get_fn('dna.pdb')
    parm = pmd.load_file(fname)
    parm = parm['!@H=']
    assert len(parm['@H='].atoms) == 0
    fixer = AmberPDBFixer(parm)
    fixer.add_missing_atoms()
    assert len(fixer.parm['@H='].atoms) > 0
示例#4
0
def test_constph():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)
    resnames_before = set(res.name for res in parm.residues)
    pdbfixer = AmberPDBFixer(parm)
    pdbfixer.constph()
    resnames_after = set(res.name for res in pdbfixer.parm.residues)
    assert sorted(resnames_after - resnames_before) == sorted(
        {'HIP', 'AS4', 'GL4'})
示例#5
0
def test_assign_histidine():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)
    his_residues = [
        res.name for res in parm.residues
        if res.name in {'HIS', 'HIE', 'HID', 'HIP'}
    ]
    assert his_residues == ['HIS']

    pdbfixer = AmberPDBFixer(parm)
    pdbfixer.assign_histidine()
    his_residues = [
        res.name for res in pdbfixer.parm.residues
        if res.name in {'HIS', 'HIE', 'HID', 'HIP'}
    ]
    assert his_residues == ['HID']

    # Do not rename to HIS if this residue does not
    # have hydrogen.
    parm2 = pmd.Structure()
    for resnum, resname in enumerate(['HIE', 'HID', 'HIS']):
        atom = pmd.Atom(name='C', atomic_number=6)
        parm2.add_atom(atom, resname, resnum=resnum, chain='A')
    fixer2 = AmberPDBFixer(parm2)
    fixer2.assign_histidine()
    assert ['HIE', 'HID', 'HIS'] == [res.name for res in fixer2.parm.residues]
示例#6
0
def test_packmol():
    pdb_fh = get_fn('2igd/2igd.pdb')
    parm = pmd.load_file(pdb_fh)
    water = parm[':HOH'][':1']
    parm.strip(':HOH')
    pdbfixer = AmberPDBFixer(parm)
    assert len([
        res.name for res in pdbfixer.parm.residues
        if res.name.startswith('HOH')
    ]) == 0
    pdbfixer.pack(water, n_copies=100)
    assert len([
        res.name for res in pdbfixer.parm.residues
        if res.name.startswith('HOH')
    ]) == 100
示例#7
0
def test_assign_histidine():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)
    his_residues = [
        res.name for res in parm.residues
        if res.name in {'HIS', 'HIE', 'HID', 'HIP'}
    ]
    assert his_residues == ['HIS']

    pdbfixer = AmberPDBFixer(parm)
    pdbfixer.assign_histidine()
    his_residues = [
        res.name for res in pdbfixer.parm.residues
        if res.name in {'HIS', 'HIE', 'HID', 'HIP'}
    ]
    assert his_residues == ['HID']
示例#8
0
def test_find_disulfide():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)
    pdbfixer = AmberPDBFixer(parm)
    cys_cys_set, _ = pdbfixer.find_disulfide()
    assert sorted(cys_cys_set) == [(5, 126), (29, 114), (63, 79), (75, 93)]

    one_cys_parm = parm[':CYS'][':1']
    pdbfixer_2 = AmberPDBFixer(one_cys_parm)
    assert not pdbfixer_2.find_disulfide()[0]
示例#9
0
def test_mutate():
    pdb_fh = get_fn('ala3_alpha.pdb')
    parm = pmd.load_file(pdb_fh)
    assert set(res.name for res in parm.residues) == {'ALA'}

    pdbfixer = AmberPDBFixer(parm)
    pdbfixer.mutate([
        (1, 'ARG'),
    ])
    pdbfixer.add_missing_atoms()
    assert [res.name
            for res in pdbfixer.parm.residues] == ['ALA', 'ARG', 'ALA']
    assert ([
        atom.name for atom in pdbfixer.parm.residues[1]
        if atom.atomic_number == 6
    ] == ['CA', 'CB', 'CG', 'CD', 'CZ', 'C'])
示例#10
0
def test_find_non_standard_resnames():
    fn = get_fn('4lzt/4lzt_h.pdb')
    parm = pmd.load_file(fn)
    pdbfixer = AmberPDBFixer(parm)
    assert pdbfixer.find_non_starndard_resnames() == {'NO3'}
示例#11
0
def test_find_gaps_nogap():
    pdb_fh = get_fn('2igd/2igd_4tleap_uc.pdb')
    parm = pmd.load_file(pdb_fh)
    pdbfixer = AmberPDBFixer(parm)
    assert not pdbfixer.find_gaps()
示例#12
0
def test_find_gaps():
    pdb_fh = get_fn('2igd/2igd.pdb')
    parm = pmd.load_file(pdb_fh)
    parm_gap = parm[':1,3']
    pdbfixer = AmberPDBFixer(parm_gap)
    assert pdbfixer.find_gaps() == [(4.134579301452567, 'MET', 0, 'PRO', 1)]
示例#13
0
 def get_fixer(fname):
     pdb_fh = get_fn(fname)
     parm = pmd.load_file(pdb_fh)
     return AmberPDBFixer(parm)