Exemplo n.º 1
0
    def test_omm_STMD_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "ShortTrajMD.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_lig26.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_protein_ACE_NMA_caps.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        if using_orion():
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                }
            })
        else:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                },
                "mp": num_proc
            })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)
Exemplo n.º 2
0
    def test_simple_run(self):
        workfloe = WorkFloeWrapper.get_workfloe(
            os.path.join(FLOES_DIR, "relative_binding.py"),
            run_timeout=1200
        )
        protein_file = DatasetWrapper.get_dataset(os.path.join(FILE_DIR, "Thrombin_protein.pdb"))
        reference_ligand_file = DatasetWrapper.get_dataset(os.path.join(FILE_DIR, "ligand7.sdf"))
        target_ligands_file = DatasetWrapper.get_dataset(os.path.join(FILE_DIR, "ligand0.sdf"))
        success_output_file = OutputDatasetWrapper(extension=".oedb")
        failure_output_file = OutputDatasetWrapper(extension=".oedb")
        workfloe.start(
            {
                "promoted": {
                    "n_iterations" : 20,
                    "n_steps_per_iteration" : 2,
                    "solvent_padding" : 0.0,
                    "protein": protein_file.identifier,
                    "vacuum_test": True, # test ligand in vacuum only
                    "reference_ligand": reference_ligand_file.identifier,
                    "target_ligands": target_ligands_file.identifier,
                    "success": success_output_file.identifier,
                    "failure": failure_output_file.identifier,
                }
            }
        )
        # Faked locally
        self.assertEqual(workfloe.state, "complete")
        # Also faked
        self.assertEqual(
            len(workfloe.reason),
            0,
            "Failed with reason {}".format(workfloe.reason)
        )

        ifs = oeifstream()
        with open(success_output_file.path, "rb") as ifs:
            records = list(OEReadRecords(ifs))
        count = len(records)
        self.assertEqual(count, 10)
Exemplo n.º 3
0
    def test_gmx_PlainMD_protein_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "PlainMD.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "4JOO_truncNoLig.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "solute": protein_file.identifier,
                "md_engine": "Gromacs",
                "prod_ns": 1,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)
Exemplo n.º 4
0
    def test_simple_run(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "charge_floe.py"),
                                                run_timeout=1200)
        input_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "10.ism"))
        output_file = OutputDatasetWrapper(extension=".oedb")
        workfloe.start({
            "promoted": {
                "in": input_file.identifier,
                "out": output_file.identifier,
            }
        })
        # Faked locally
        self.assertEqual(workfloe.state, "complete")
        # Also faked
        self.assertEqual(len(workfloe.reason), 0,
                         "Failed with reason {}".format(workfloe.reason))

        ifs = oeifstream()
        with open(output_file.path, "rb") as ifs:
            records = list(OEReadRecords(ifs))
        count = len(records)
        self.assertEqual(count, 10)
Exemplo n.º 5
0
    def test_omm_minimization_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDminimize.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        # Read input record
        ifs = oeifstream(system.dataset_path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)

        # Check the out record list
        self.assertEqual(count, 1)

        # Calculate the initial potential energy
        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 1)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate the initial potential energy
            eng_i = calculate_eng(mdstate, parmed_structure)

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "Minimize": {
                    "save_md_stage": True
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Read output record
        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # The records list must have just one record
        self.assertEqual(count, 1)

        # Calculate the final potential energy
        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 2)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate the final potential energy
            eng_f = calculate_eng(mdstate, parmed_structure)

        self.assertLess(
            eng_f.in_units_of(unit.kilojoule_per_mole) /
            unit.kilojoule_per_mole,
            eng_i.in_units_of(unit.kilojoule_per_mole) /
            unit.kilojoule_per_mole)
Exemplo n.º 6
0
    def test_gmx_minimization_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDminimize.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        # Read input record
        ifs = oeifstream(system.dataset_path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)

        # Check the out record list
        self.assertEqual(count, 1)

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "md_engine": "Gromacs",
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "Minimize": {
                    "save_md_stage": True
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Read output record
        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # The records list must have just one record
        self.assertEqual(count, 1)
Exemplo n.º 7
0
    def test_compex_prep_split_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "Complex_prep.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_lig26.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_protein_ACE_NMA_caps.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "ligands": ligand_file.identifier,
                "protein": protein_file.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        # Each record should have the MD record interface
        for record in records:

            mdrecord = MDDataRecord(record)

            self.assertTrue(record.has_value(Fields.flaskid))
            self.assertTrue(record.has_value(Fields.title))
            self.assertTrue(record.has_value(Fields.ligand))
            self.assertTrue(record.has_value(Fields.protein))
            self.assertTrue(record.has_value(Fields.primary_molecule))
            self.assertTrue(record.has_value(Fields.flask))
            self.assertTrue(record.has_value(Fields.md_stages))
            self.assertTrue(record.has_value(Fields.pmd_structure))

            self.assertEqual(mdrecord.get_flask_id, 0)
            self.assertEqual(mdrecord.get_title, "pMCL1_l26")
            self.assertEqual(record.get_value(Fields.ligand).NumAtoms(), 43)
            self.assertEqual(record.get_value(Fields.protein).NumAtoms(), 2432)

            complx = mdrecord.get_flask
            protein_split, ligand_split, water, excipients = oeommutils.split(
                complx)
            self.assertEqual(protein_split.NumAtoms(), 2432)
            self.assertEqual(ligand_split.NumAtoms(), 43)
            self.assertEqual(water.NumAtoms(), 20022)
            self.assertEqual(excipients.NumAtoms(), 17)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 1)

            stage = stages[0]

            self.assertTrue(stage.has_value(Fields.stage_name))
            self.assertTrue(stage.has_value(Fields.mddata))

            self.assertEqual(stage.get_value(Fields.stage_type), "SETUP")

            top_mol = mdrecord.get_stage_topology()
            self.assertEqual(top_mol.NumAtoms(), complx.NumAtoms())
Exemplo n.º 8
0
    def test_compex_prep_md_comp_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "Complex_prep.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "retigabine.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "kcnq_fix_ARG_fc.oeb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "ligands": ligand_file.identifier,
                "protein": protein_file.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:

            md_components = record.get_value(Fields.md_components)

            protein = md_components.get_protein
            ligand = md_components.get_ligand
            counter_ions = md_components.get_counter_ions
            excipients = md_components.get_excipients
            water = md_components.get_water

            self.assertEqual(protein.NumAtoms(), 7353)
            self.assertEqual(ligand.NumAtoms(), 40)
            self.assertEqual(water.NumAtoms(), 58308)
            self.assertEqual(excipients.NumAtoms(), 44)
            self.assertEqual(counter_ions.NumAtoms(), 54)
Exemplo n.º 9
0
    def test_gmx_npt_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDnpt.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pP38_lig38a_2n_npt_5ns.oedb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "md_engine": "Gromacs",
                "nanoseconds": 0.01,
                "temperature": 300.0,
                "pressure": 1.0,
                "trajectory_interval": 0.0,
                "reporter_interval": 0.0,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "npt": {
                    "save_md_stage": True,
                    "constraints": "H-Bonds",
                    "restraints": "",
                    "nonbondedCutoff": 10.0
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:
            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 3)
Exemplo n.º 10
0
    def test_omm_npt_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDnpt.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pP38_lig38a_2n_npt_5ns.oedb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "nanoseconds": 0.01,
                "temperature": 300.0,
                "pressure": 1.0,
                "trajectory_interval": 0.0,
                "reporter_interval": 0.0,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "npt": {
                    "save_md_stage": True,
                    "constraints": "H-Bonds",
                    "restraints": "",
                    "nonbondedCutoff": 10.0
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 3)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate final volume and temperature
            vol_f, temp_f = calculate_VT(mdstate, parmed_structure)

            # Check 3*std volume
            # Average volume and its standard deviation (in nm^3) measured along
            # one 5ns run for the selected system
            avg_volume = 632.4198167 * (unit.nanometers**3)
            std_volume = 1.201609662

            self.assertAlmostEqual(avg_volume / (unit.nanometers**3),
                                   vol_f.in_units_of(unit.nanometers**3) /
                                   (unit.nanometers**3),
                                   delta=3 * std_volume)

            # Check temperature
            # Average temperature and its standard deviation (in K) measured along
            # one 5ns run for the selected system
            avg_temperature = 299.9852145 * unit.kelvin
            std_temperature = 2.021052471
            self.assertAlmostEqual(avg_temperature / unit.kelvin,
                                   temp_f.in_units_of(unit.kelvin) /
                                   unit.kelvin,
                                   delta=3 * std_temperature)
Exemplo n.º 11
0
    def test_gmx_STMD_Analysis_large_sys_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "ShortTrajMDWithAnalysis.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "Hunt13_lig13.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "4JOO_truncNoLig.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        if using_orion:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "md_engine": "Gromacs",
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                }
            })
        else:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "md_engine": "Gromacs",
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                },
                "mp": num_proc
            })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)