def test_mdprep(self): protein_path = utils.get_data_filename('examples', 'data/Bace_protein.pdb') ligand_path = utils.get_data_filename('examples', 'data/lig_CAT13a.oeb.gz') run_args = [ '--protein', protein_path, '--ligands', ligand_path, '--max_conformers', '800', '--protein_prefix', 'Bace', '--solvent_padding', '10', '--salt_conc', '100', '--protein_ff', 'amber99sbildn.xml', '--solvent_ff', 'tip3p.xml', '--ligand_ff', 'GAFF2', '--other_ff', 'GAFF2', '--min_steps', '30000', '--m_restraints', 'noh (ligand or protein)', '--m_restraintWt', '5.0', '--warm_psec', '10.0', '--w_restraints', 'noh (ligand or protein)', '--w_restraintWt', '2.0', '--w_trajectory_interval', '1000', '--w_reporter_interval', '10000', '--w_outfname', 'warmup', '--eq1_psec', '10.0', '--eq1_restraints', 'noh (ligand or protein)', '--eq1_restraintWt', '2.0', '--eq1_trajectory_interval', '1000', '--eq1_reporter_interval', '10000', '--eq1_outfname', 'equil1', '--eq2_psec', '10.0', '--eq2_restraints', 'noh (ligand or protein)', '--eq2_restraintWt', '0.5', '--eq2_trajectory_interval', '1000', '--eq2_reporter_interval', '10000', '--eq2_outfname', 'equil2', '--eq3_psec', '10.0', '--eq3_restraints', 'ca_protein or (noh ligand)', '--eq3_restraintWt', '0.1', '--eq3_trajectory_interval', '1000', '--eq3_reporter_interval', '10000', '--eq3_outfname', 'equil3', '--ofs-data_out', 'success.oeb', '--fail-data_out', 'fail.oeb', ] self.assertFalse(floe.run(args=run_args))
def test_npt(self): complex_path = utils.get_data_filename( 'examples', 'data/pP38_lp38a_2x_complex.oeb.gz') run_args = [ '--complex', complex_path, '--picosec', '10', '--temperature', '300', '--pressure', '1', '--restraints', 'noh (ligand or protein)', '--restraintWt', '2.0', '--trajectory_interval', '10', '--reporter_interval', '100', '--suffix', 'npt', '--ofs-data_out', 'success.oeb', '--fail-data_out', 'fail.oeb', ] self.assertFalse(floe.run(args=run_args))
def _test_success(self): print('Testing cube:', self.cube.name) # Complex file name complex_fname = utils.get_data_filename('examples', 'data/pbace_lcat13a_complex.oeb.gz') # Read OEMol molecule mol = oechem.OEMol() with oechem.oemolistream(complex_fname) as ifs: oechem.OEReadMolecule(ifs, mol) # Calculate starting potential energy eng_i = self.calculate_eng(mol) # Process the molecules self.cube.process(mol, self.cube.intake.name) # Assert that one molecule was emitted on the success port self.assertEqual(self.runner.outputs['success'].qsize(), 1) # Assert that zero molecules were emitted on the failure port self.assertEqual(self.runner.outputs['failure'].qsize(), 0) outmol = self.runner.outputs["success"].get() # Calculate final potential energy eng_f = self.calculate_eng(outmol) self.assertLess(eng_f, eng_i)
def test_success(self): print('Testing cube:', self.cube.name) # File name of a charged ligand lig_fname = utils.get_data_filename('examples', 'data/lig_CAT13a_chg.oeb.gz') # Read OEMol molecule mol = oechem.OEMol() ifs = oechem.oemolistream(lig_fname) if not oechem.OEReadMolecule(ifs, mol): raise Exception('Cannot read molecule from %s' % lig_fname) ifs.close() mol_copy = mol.CreateCopy() # Set the partial charge to zero for at in mol_copy.GetAtoms(): at.SetPartialCharge(0.0) # Process the molecules self.cube.process(mol_copy, self.cube.intake.name) # Assert that one molecule was emitted on the success port self.assertEqual(self.runner.outputs['success'].qsize(), 1) # Assert that zero molecules were emitted on the failure port self.assertEqual(self.runner.outputs['failure'].qsize(), 0) # Check outmol outmol = self.runner.outputs["success"].get() # Loop through atoms and make sure partial charges were set for iat, oat in zip(mol.GetAtoms(), outmol.GetAtoms()): self.assertNotEqual(iat.GetPartialCharge(), oat.GetPartialCharge)
def test_minimization(self): complex_path = utils.get_data_filename('examples', 'data/pbace_lcat13a_complex.oeb.gz') run_args = [ '--complex', complex_path, '--ofs-data_out', 'success.oeb', '--fail-data_out', 'fail.oeb', '--steps', '30000', ] self.assertFalse(floe.run(args=run_args))
def test_complex_prep(self): protein_path = utils.get_data_filename('examples', 'data/Bace_protein.pdb') ligand_path = utils.get_data_filename('examples', 'data/lig_CAT13a.oeb.gz') run_args = [ '--protein', protein_path, '--ligands', ligand_path, '--max_conformers', '800', '--ofs-data_out', 'success.oeb', '--fail-data_out', 'fail.oeb', ] self.assertFalse(floe.run(args=run_args))
def applyffProtein(protein, opt): """ This function applies the selected force field to the protein Parameters: ----------- protein: OEMol molecule The protein to parametrize opt: python dictionary The options used to parametrize the protein Return: ------- protein_structure: Parmed structure instance The parametrized protein parmed structure """ topology, positions = oeommutils.oemol_to_openmmTop(protein) forcefield = app.ForceField(opt['protein_forcefield']) unmatched_residues = forcefield.getUnmatchedResidues(topology) if unmatched_residues: # Extended ff99SBildn force field oechem.OEThrow.Info("The following protein residues are not recognized " "by the selected FF: {} - {}" "\n...Extended FF is in use".format(opt['protein_forcefield'], unmatched_residues)) ffext_fname = utils.get_data_filename('ComplexPrepCubes', 'ffext/amber99SBildn_ext.xml') forcefield = app.ForceField() forcefield.loadFile(ffext_fname) unmatched_residues = forcefield.getUnmatchedResidues(topology) if unmatched_residues: oechem.OEThrow.Fatal("Error. The following protein residues are not recognized " "by the extended force field {}".format(unmatched_residues)) omm_system = forcefield.createSystem(topology, rigidWater=False) protein_structure = parmed.openmm.load_topology(topology, omm_system, xyz=positions) return protein_structure
def _test_success(self): print('Testing cube:', self.cube.name) # Complex file name complex_fname = utils.get_data_filename( 'examples', 'data/pP38_lp38a_2x_complex.oeb.gz') # Read OEMol molecule mol = oechem.OEMol() with oechem.oemolistream(complex_fname) as ifs: oechem.OEReadMolecule(ifs, mol) # Process the molecules self.cube.process(mol, self.cube.intake.name) # Assert that one molecule was emitted on the success port self.assertEqual(self.runner.outputs['success'].qsize(), 1) # Assert that zero molecules were emitted on the failure port self.assertEqual(self.runner.outputs['failure'].qsize(), 0) outmol = self.runner.outputs["success"].get() # Calculate final volume and temperature vol_f, temp_f = self.calculate_VT(outmol) # Check 3*std volume # Average volume and its standard deviation (in nm^3) measured along # one 10ns run for the selected system avg_volume = 683.6 * (unit.nanometers**3) std_volume = 1.3 self.assertAlmostEqual(avg_volume / (unit.nanometers**3), vol_f.in_units_of(unit.nanometers**3) / (unit.nanometers**3), delta=3 * std_volume) # Check 3*std temperature # Average temperature and its standard deviation (in K) measured along # one 10ns run for the selected system avg_temperature = 300.0 * unit.kelvin std_temperature = 1.1 self.assertAlmostEqual(avg_temperature / unit.kelvin, temp_f.in_units_of(unit.kelvin) / unit.kelvin, delta=3 * std_temperature)
def test_success(self): print('Testing cube:', self.cube.name) # Read a molecule mol = oechem.OEMol() ifs = oechem.oemolistream(utils.get_data_filename('examples', 'data/TOL-smnf.oeb.gz')) if not oechem.OEReadMolecule(ifs, mol): raise Exception('Cannot read molecule') ifs.close() # Process the molecules self.cube.process(mol, self.cube.intake.name) # Assert that one molecule was emitted on the success port self.assertEqual(self.runner.outputs['success'].qsize(), 1) # Assert that zero molecules were emitted on the failure port self.assertEqual(self.runner.outputs['failure'].qsize(), 0) # Get the output molecule, check that it has score. outmol = self.runner.outputs["success"].get() self.assertTrue(oechem.OEHasSDData(outmol, 'Chemgauss4'))
def setUp(self): self.cube = FREDDocking('fred') self.cube.args.receptor = utils.get_data_filename('examples','data/T4-receptor.oeb.gz') self.runner = CubeTestRunner(self.cube) self.runner.start()
def test_restraints(): lig_fname = utils.get_data_filename('examples', 'data/pP38_lp38a_2x_complex.oeb.gz') # Read OEMol molecule mol = oechem.OEMol() with oechem.oemolistream(lig_fname) as ifs: oechem.OEReadMolecule(ifs, mol) res_dic = {} mask = 'protein' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'ligand' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'water' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'ions' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'cofactors' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'ca_protein' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'protein or ligand' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'noh (protein or ligand)' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'ca_protein or (noh ligand)' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set mask = 'resid A:4 A:5 A:6 A:7' ind_set = restraints(mol, mask=mask) res_dic[mask] = ind_set dic_fname = utils.get_data_filename( 'examples', 'data/restraint_test_P38_lp38a_2x.pickle') file = open(dic_fname, 'rb') res_dic_loaded = pickle.load(file) for k in res_dic_loaded: if res_dic[k] == res_dic_loaded[k]: pass else: raise ValueError( "Restraints checking Errors on mask: {}".format(k))