Exemple #1
0
    def prepare_exhaustiveness_run(self, exhaust_vars=None, run_type='exhaustiveness'):
        if self.setup_box is False:
            print('Please setup simulation box')
            sys.exit(0)

        self.run_type = run_type

        # Vina takes exhaustiveness parameter
        if exhaust_vars is None:
            self.exhaustiveness = [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]
        else:
            self.exhaustiveness = exhaust_vars

        self.prep_exhaust_run = True
        self.run_folder_name = self.receptor_name + '_' + self.molecule_name + '_' + self.run_type
        self.sim_folder_run = self.folder_path + os.sep + self.run_folder_name
        # Create folder don't forget



        # self.directories = self.find_sample_folders(self.folder_path, dir_name=self.run_type)
        self.directories = folder_utils.find_folder_in_path(self.folder_path, self.run_folder_name)
        print('TADA ', self.directories)

        self.json_state_file = self.sim_folder_run + os.sep + self.receptor_name + '_' + self.molecule_name + '_' + self.run_type + '.json'

        # This will hold information about run states


        if len(self.directories) == 0:
            print('Creating folder for vina run\n')
            print('Vina run type: {0}'.format(self.run_type))
            print(self.sim_folder_run)
            folder_utils.create_folder(self.sim_folder_run)
            self.folder_exists = True

            self.state_data.update({'receptorFile': self.receptor_file,
                                    'ligandFile': self.ligand_file,
                                    'exhaustivenessList': self.exhaustiveness,
                                    'samplesList': self.samples_run,
                                    'folderPath': self.folder_path,
                                    'runType': self.run_type,
                                    'molName': self.molecule_name,
                                    'receptorName': self.receptor_name,
                                    'simRunFolder': self.sim_folder_run,
                                    'directory': self.directories,
                                    'setup': self.setup_box,
                                    'folderCreated': self.folder_exists,
                                    'simStates': {}})

            self.prepVinaSim_exhaust()
            self.save_state_data_json()

            self.load_state_called = False


        else:
            self.load_state_file = self.json_state_file
            self.load_state_called = True
            self.load_state_data_json(self.load_state_file)
Exemple #2
0
    def prepare_samples_collection_run(self, standard_exhaust=128,
                                       num_samples_run=100,
                                       run_type='samples_run'):

        if self.setup_box is False:
            print('Please setup simulation box')
            sys.exit(0)

        self.run_type_samples = run_type

        self.prep_samples_run = True

        self.samples_exhaust = standard_exhaust
        self.samples_run = list(range(1, num_samples_run + 1))

        self.run_folder_name_samples = self.receptor_name + '_' + self.molecule_name + '_' + self.run_type_samples
        self.sim_folder_run_samples = self.folder_path + os.sep + self.run_folder_name_samples
        # Create folder don't forget

        # Exhaustiveness for all samples


        # self.directories = self.find_sample_folders(self.folder_path, dir_name=self.run_type)
        self.directories_samples = folder_utils.find_folder_in_path(self.folder_path, self.run_folder_name_samples)
        print('TADA ', self.directories_samples)

        self.json_samples_state_file = self.sim_folder_run_samples + os.sep + self.receptor_name + '_' + self.molecule_name + '_' + self.run_type_samples + '.json'

        # This will hold information about run states


        if len(self.directories_samples) == 0:
            print('Creating folder for vina samples run\n')
            print('Vina run type: {0}'.format(self.run_type_samples))
            print(self.sim_folder_run_samples)
            folder_utils.create_folder(self.sim_folder_run_samples)
            self.folder_exists_samples = True

            self.state_data_samples.update({'receptorFile': self.receptor_file,
                                            'ligandFile': self.ligand_file,
                                            'exhaustivenessList': self.exhaustiveness,
                                            'samples_exhaust': self.samples_exhaust,
                                            'samplesList': self.samples_run,
                                            'folderPath': self.folder_path,
                                            'runType': self.run_type_samples,
                                            'molName': self.molecule_name,
                                            'receptorName': self.receptor_name,
                                            'simRunFolder': self.sim_folder_run_samples,
                                            'directory': self.directories_samples,
                                            'setup': self.setup_box,
                                            'folderCreated': self.folder_exists_samples,
                                            'simStates': {}})

            self.prepVinaSim_samples()
            self.save_state_data_json(filedata=self.state_data_samples, filename=self.json_samples_state_file)

            self.load_state_called_samples = False

            self.prep_sample_run = True

        else:
            self.load_state_file_samples = self.json_samples_state_file
            self.load_state_called_samples = True
            self.load_samples_state_data_json(self.load_state_file_samples)
            self.prep_sample_run = True