Commit 04eaddb7 by Kyle Beauchamp

Improved tests and docstring example.

parent 4a38eb7d
......@@ -574,6 +574,8 @@ class PDBFixer(object):
Find nonstandard residues.
>>> fixer = PDBFixer(pdbid='1VII')
>>> fixer.findMissingAtoms()
>>> fixer.addMissingAtoms()
>>> fixer.applyMutations(["ALA-57-GLY"])
>>> fixer.addMissingHydrogens(7.0)
......
......@@ -7,34 +7,34 @@ def test_mutate_1():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-57-GLY"], "A")
fixer.addMissingHydrogens(7.0)
app.PDBFile.writeFile(fixer.topology, fixer.positions, tempfile.TemporaryFile())
temp_pdb = tempfile.NamedTemporaryFile()
app.PDBFile.writeFile(fixer.topology, fixer.positions, temp_pdb)
pdb = app.PDBFile(temp_pdb.name)
assert list(pdb.topology.residues())[16].name == "GLY", "Name of mutated residue did not change correctly!"
def test_mutate_2():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-57-GLY", "SER-56-ALA"], "A")
fixer.addMissingHydrogens(7.0)
app.PDBFile.writeFile(fixer.topology, fixer.positions, tempfile.TemporaryFile())
temp_pdb = tempfile.NamedTemporaryFile()
app.PDBFile.writeFile(fixer.topology, fixer.positions, temp_pdb)
pdb = app.PDBFile(temp_pdb.name)
assert list(pdb.topology.residues())[16].name == "GLY", "Name of mutated residue did not change correctly!"
assert list(pdb.topology.residues())[15].name == "ALA", "Name of mutated residue did not change correctly!"
@raises(ValueError)
def test_mutate_3_fails():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-57-GLY", "SER-57-ALA"], "A")
fixer.addMissingHydrogens(7.0)
app.PDBFile.writeFile(fixer.topology, fixer.positions, tempfile.TemporaryFile())
@raises(KeyError)
def test_mutate_4_fails():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-57-WTF", "SER-56-ALA"], "A")
fixer.addMissingHydrogens(7.0)
app.PDBFile.writeFile(fixer.topology, fixer.positions, tempfile.TemporaryFile())
@raises(KeyError)
def test_mutate_5_fails():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-1000-GLY", "SER-56-ALA"], "A")
fixer.addMissingHydrogens(7.0)
app.PDBFile.writeFile(fixer.topology, fixer.positions, tempfile.TemporaryFile())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment