Ejemplo n.º 1
0
    def run(self, cutoff, numsel, metric):
        ''' 

        Runs prediction tasks using internally defined methods

        Most of these methods can be found at the stats folder

        '''

        # Load scaler and variable mask and preprocess the data
        success, result = self.preprocess(self.X)
        if not success:
            self.conveyor.setError(result)
            return
        self.X = result

        # instances space object
        space = Space(self.param, self.conveyor)

        # builds space from idata results
        LOG.info('Starting space searching')
        success, search_results = space.search(cutoff, numsel, metric)
        if not success:
            self.conveyor.setError(search_results)
            return

        self.conveyor.addVal(search_results, 'search_results',
                             'Search results', 'result', 'objs',
                             'Collection of similar compounds', 'main')

        LOG.info('Space search finished successfully')

        return
Ejemplo n.º 2
0
    def run (self):
        '''
        Builds a chemical space 

        '''

        # pre-process data
        success, message = self.preprocess()
        if not success:
            self.conveyor.setError(message)
            return

        # instances space object
        space = Space(self.param, self.conveyor)

        # builds space from idata results
        LOG.debug('Starting space building')

        success, space_building_results = space.build()
        if not success:
            LOG.error('space_building_results')
            self.conveyor.setError(space_building_results)
            return

        self.conveyor.addVal(
                    space_building_results,
                    'space_build_info',
                    'space build info',
                    'method',
                    'single',
                    'Information about the building of the chemical space')

        # save model
        try:
            space.save_space()
        except Exception as e:
            LOG.error(f'Error saving space with exception {e}')
            self.conveyor.setError(f'Error saving space with exception {e}')
            return

        LOG.info('Space building finished successfully')

        return
Ejemplo n.º 3
0
    def run(self, cutoff, numsel, metric):
        ''' 

        Runs prediction tasks using internally defined methods

        Most of these methods can be found at the stats folder

        '''

        if self.param.getVal('input_type') != "smarts":
            # Load scaler and variable mask and preprocess the data
            success, result = self.preprocess(self.X)
            if not success:
                self.conveyor.setError(result)
                return
            self.X = result

        # instances space object
        space = Space(self.param, self.conveyor)

        # check metric
        if metric is None:
            metric = space.defaultMetric

        # builds space from idata results
        LOG.info('Starting space searching')
        success, search_results = space.search(cutoff, numsel, metric)
        if not success:
            self.conveyor.setError(search_results)
            return

        self.conveyor.addVal(space.metric, 'metric', 'metric', 'method',
                             'single', 'Final metric used in the search')

        self.conveyor.addVal(search_results, 'search_results',
                             'Search results', 'result', 'objs',
                             'Collection of similar compounds', 'main')

        LOG.info('Space search finished successfully')

        return