class LigChargeTester(unittest.TestCase): """ Test ELF10 charge cube """ def setUp(self): self.cube = ParallelLigandChargeCube('elf10charge') self.cube.args.max_conforms = 800 self.runner = CubeTestRunner(self.cube) self.runner.start() @pytest.mark.travis @pytest.mark.local def test_success(self): print('Testing cube:', self.cube.name) # File name of a charged ligand lig_fname = os.path.join(FILE_DIR, "lig_CAT13a_chg.oeb.gz") # Read OEMol molecule ligand = oechem.OEMol() with oechem.oemolistream(lig_fname) as ifs: oechem.OEReadMolecule(ifs, ligand) ligand_copy = ligand.CreateCopy() # Set the partial charge to zero for at in ligand_copy.GetAtoms(): at.SetPartialCharge(0.0) ligand_record = OERecord() ligand_record.set_value(Fields.primary_molecule, ligand_copy) ligand_record.set_value(Fields.flaskid, 0) ligand_record.set_value(Fields.title, ligand_copy.GetTitle()) # Process the molecules self.cube.process(ligand_record, 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 out ligand out_record = self.runner.outputs["success"].get() out_ligand = out_record.get_value(Fields.primary_molecule) # Loop through atoms and make sure partial charges were set for iat, oat in zip(ligand.GetAtoms(), out_ligand.GetAtoms()): self.assertNotEqual(iat.GetPartialCharge(), oat.GetPartialCharge)
job.classification = [['Molecular Dynamics']] # job.uuid = "372e1890-d053-4027-970a-85b209e4676f" job.tags = [tag for lists in job.classification for tag in lists] # Ligand setting iligs = DatasetReaderCube("LigandReader", title="Ligand Reader") iligs.promote_parameter("data_in", promoted_name="ligands", title="Ligand Input Dataset", description="Ligand Dataset") ligset = LigandSetting("LigandSetting", title="Ligand Setting") ligset.set_parameters(lig_res_name='LIG') chargelig = ParallelLigandChargeCube("LigCharge", title="Ligand Charge") chargelig.promote_parameter('charge_ligands', promoted_name='charge_ligands', description="Charge the ligand or not", default=True) ligid = IDSettingCube("Ligand Ids") # Protein Reading cube. The protein prefix parameter is used to select a name for the # output system files iprot = DatasetReaderCube("ProteinReader", title="Protein Reader") iprot.promote_parameter("data_in", promoted_name="protein", title='Protein Input Dataset', description="Protein Dataset")
def setUp(self): self.cube = ParallelLigandChargeCube('elf10charge') self.cube.args.max_conforms = 800 self.runner = CubeTestRunner(self.cube) self.runner.start()