def testLoadStruct(self): """ Test load_rosetta against read_PDB""" init() pose = pose_from_sequence(3*'A') struct = load_rosetta(pose) pdb = read_PDB(get_fn('ala_ala_ala.pdb')) self.assertEqual(len(struct.atoms), len(pdb.atoms)) self.assertEqual(len(struct.residues), len(pdb.residues))
def test_loaded_topology(self): """ Test load_rosetta against OpenMM topology""" init() pose = pose_from_sequence(3 * 'A') struct = load_rosetta(pose) pdb = PDBFile(get_fn('ala_ala_ala.pdb')) self.assertEqual(len(list(struct.topology.atoms())), len(list(pdb.topology.atoms()))) self.assertEqual(len(list(struct.topology.bonds())), len(list(pdb.topology.bonds()))) self.assertEqual(len(list(struct.topology.residues())), len(list(pdb.topology.residues())))
def test_loaded_positions(self): """ Test that positions were properly loaded""" init() seq = 3 * 'A' pose = pose_from_sequence(seq) struct = load_rosetta(pose) posexyz = list( chain(*[[tuple(atom.xyz()) for atom in res.atoms()] for res in [pose.residue(idx) for idx in range(1, len(seq) + 1)]])) structxyz = [(atom.xx, atom.xy, atom.xz) for atom in struct.atoms] self.assertEqual(posexyz, structxyz)
def testLoadedTopology(self): """ Test load_rosetta against OpenMM topology""" init() pose = pose_from_sequence(3*'A') struct = load_rosetta(pose) pdb = PDBFile(get_fn('ala_ala_ala.pdb')) self.assertEqual(_unpackLen(struct.topology.atoms()), _unpackLen(pdb.topology.atoms())) self.assertEqual(_unpackLen(struct.topology.bonds()), _unpackLen(pdb.topology.bonds())) self.assertEqual(_unpackLen(struct.topology.residues()), _unpackLen(pdb.topology.residues()))
def testLoadedPositions(self): """ Test that positions were properly loaded""" init() seq = 3*'A' pose = pose_from_sequence(seq) struct = load_rosetta(pose) posexyz = list( chain(*[[tuple(atom.xyz()) for atom in res.atoms()] for res in [pose.residue(idx) for idx in range(1, len(seq)+1)]])) structxyz = [(atom.xx, atom.xy, atom.xz) for atom in struct.atoms] self.assertEqual(posexyz, structxyz)
# Initialize PyRosetta init() # Create Ala12 print('Creating Ala12...') seq = 12*'A' pose = pose_from_sequence(seq) # Mutate residue 5 to K print('Mutating Fifth Ala to Lys...') mutant = mutate_residue(pose, 5, 'K') # Load mutant into ParmEd print('Loading into ParmEd...') struct = load_rosetta(mutant) # Load AMBER-99SBildn and TIP3P parameters print('Loading AMBER parameters...') ff = ForceField('amber99sbildn.xml', 'tip3p.xml') # Solvate Structure print('Solvating...') mod = Modeller(struct.topology, struct.positions) mod.addSolvent(ff, model='tip3p', boxSize=Vec3(4, 4, 4)*nanometers, positiveIon='Na+', negativeIon='Cl-', ionicStrength=0.1*molar) # Create OpenMM System print('Creating OpenMM System...') system = ff.createSystem(mod.topology, nonbondedMethod=PME,