Пример #1
0
    def test_calculate_initial_poses(self):

        file_name = self.golden_data_path / '3p0g' / 'receptor_membrane.pdb'
        _, _, chains = parse_complex_from_file(file_name)
        receptor = Complex(chains, structure_file_name=file_name)
        file_name = self.golden_data_path / '3p0g' / 'ligand.pdb'
        _, _, chains = parse_complex_from_file(file_name)
        ligand = Complex(chains, structure_file_name=file_name)

        rec_translation = receptor.move_to_origin()
        lig_translation = ligand.move_to_origin()

        num_swarms = 100
        num_glowworms = 10
        surface_density = 50.
        restraints = parse_restraints_file(self.golden_data_path / '3p0g' / 'restraints.list')
        receptor_restraints = get_restraints(receptor, restraints['receptor'])
        ligand_restraints = get_restraints(ligand, restraints['ligand'])
        rec_restraints = receptor_restraints['active'] + receptor_restraints['passive']
        lig_restraints = ligand_restraints['active'] + ligand_restraints['passive']

        positions_files = calculate_initial_poses(receptor, ligand, num_swarms, num_glowworms,
                                                  STARTING_POINTS_SEED, rec_restraints, lig_restraints,
                                                  rec_translation, lig_translation, surface_density,
                                                  dest_folder=self.test_path, is_membrane=True)

        assert filecmp.cmp(positions_files[0], self.golden_data_path / '3p0g' / 'init' / 'initial_positions_0.dat')
        assert filecmp.cmp(positions_files[1], self.golden_data_path / '3p0g' / 'init' / 'initial_positions_1.dat')
Пример #2
0
    def test_calculate_initial_poses(self):

        atoms, residues, chains = parse_complex_from_file(
            os.path.join(self.golden_data_path, '3p0g',
                         'receptor_membrane.pdb'))
        receptor = Complex(chains)
        atoms, residues, chains = parse_complex_from_file(
            os.path.join(self.golden_data_path, '3p0g', 'ligand.pdb'))
        ligand = Complex(chains)

        rec_translation = receptor.move_to_origin()
        lig_translation = ligand.move_to_origin()

        num_swarms = 10
        num_glowworms = 10
        seed = 324324
        restraints = parse_restraints_file(
            os.path.join(self.golden_data_path, '3p0g', 'restraints.list'))
        receptor_restraints = get_restraints(receptor, restraints['receptor'])
        ligand_restraints = get_restraints(ligand, restraints['ligand'])
        rec_restraints = receptor_restraints['active'] + receptor_restraints[
            'passive']
        lig_restraints = ligand_restraints['active'] + ligand_restraints[
            'passive']

        positions_files = calculate_initial_poses(receptor,
                                                  ligand,
                                                  num_swarms,
                                                  num_glowworms,
                                                  seed,
                                                  rec_restraints,
                                                  lig_restraints,
                                                  rec_translation,
                                                  lig_translation,
                                                  dest_folder=self.test_path,
                                                  is_membrane=True)

        assert filecmp.cmp(
            positions_files[0],
            os.path.join(self.golden_data_path, '3p0g', 'init',
                         'initial_positions_0.dat'))
        assert filecmp.cmp(
            positions_files[1],
            os.path.join(self.golden_data_path, '3p0g', 'init',
                         'initial_positions_1.dat'))
Пример #3
0
    def test_get_restraints_with_error(self):
        input_file = os.path.join(self.golden_data_path, '2UUY_lig.pdb')
        atoms, residues, chains = parse_complex_from_file(input_file)
        structure = Complex(chains)
        restraints = {'active':['B.VAL.21'], 'passive':['B.GLY.75'], 'blocked':[]}
        
        residues = get_restraints(structure, restraints)

        assert False
Пример #4
0
    def test_get_restraints(self):
        input_file = os.path.join(self.golden_data_path, '2UUY_lig.pdb')
        atoms, residues, chains = parse_complex_from_file(input_file)
        structure = Complex(chains)
        restraints = {'active':['B.ALA.21'], 'passive':['B.GLY.75'], 'blocked':[]}
        
        residues = get_restraints(structure, restraints)

        assert len(residues['active']) == 1 and len(residues['passive']) == 1
        assert residues['active'][0].name == 'ALA' and residues['active'][0].number == 21
        assert residues['passive'][0].name == 'GLY' and residues['passive'][0].number == 75
Пример #5
0
    def test_get_restraints_with_error(self):
        input_file = self.golden_data_path / '2UUY_lig.pdb'
        _, _, chains = parse_complex_from_file(input_file)
        structure = Complex(chains)
        restraints = {
            'active': ['B.VAL.21'],
            'passive': ['B.GLY.75'],
            'blocked': []
        }

        residues = get_restraints(structure, restraints)

        assert residues is not None
Пример #6
0
            num_lig_passive = len(restraints['ligand']['passive'])

            # Check if restraints have been defined for the ligand, but not to the receptor
            if not num_rec_active and not num_rec_passive and (
                    num_lig_active or num_lig_passive):
                raise LightDockError(
                    "Restraints defined for ligand, but not receptor. Try switching structures."
                )

            if not num_rec_active and not num_rec_passive and not num_lig_active and not num_lig_passive:
                raise LightDockError(
                    "Restraints file specified, but not a single restraint found"
                )

            # Check if restraints correspond with real residues
            receptor_restraints = get_restraints(receptor,
                                                 restraints['receptor'])
            args.receptor_restraints = restraints['receptor']
            ligand_restraints = get_restraints(ligand, restraints['ligand'])
            args.ligand_restraints = restraints['ligand']

            log.info(
                "Number of receptor restraints is: %d (active), %d (passive)" %
                (num_rec_active, num_rec_passive))
            log.info(
                "Number of ligand restraints is: %d (active), %d (passive)" %
                (num_lig_active, num_lig_passive))

        rec_restraints = None
        try:
            rec_restraints = receptor_restraints[
                'active'] + receptor_restraints['passive']
Пример #7
0
            # Calculate number of restraints in order to check them
            num_rec_active = len(restraints['receptor']['active'])
            num_rec_passive = len(restraints['receptor']['passive'])
            num_lig_active = len(restraints['ligand']['active'])
            num_lig_passive = len(restraints['ligand']['passive'])

            # Check if restraints have been defined for the ligand, but not to the receptor
            if not num_rec_active and not num_rec_passive and (num_lig_active or num_lig_passive):
                raise LightDockError("Restraints defined for ligand, but not receptor. Try switching structures.")

            if not num_rec_active and not num_rec_passive and not num_lig_active and not num_lig_passive:
                raise LightDockError("Restraints file specified, but not a single restraint found")

            # Check if restraints correspond with real residues
            receptor_restraints = get_restraints(receptor, restraints['receptor'])
            args.receptor_restraints = restraints['receptor']
            ligand_restraints = get_restraints(ligand, restraints['ligand'])
            args.ligand_restraints = restraints['ligand']

            log.info("Number of receptor restraints is: %d (active), %d (passive)" % (num_rec_active, num_rec_passive))
            log.info("Number of ligand restraints is: %d (active), %d (passive)" % (num_lig_active, num_lig_passive))

        rec_restraints = None
        try:
            rec_restraints = receptor_restraints['active'] + receptor_restraints['passive']
        except:
            pass

        lig_restraints = None
        try: