Exemplo n.º 1
0
    def __init__(self,
                 organism,
                 membership,
                 ratios,
                 meme_suite,
                 seqtype,
                 sequence_filters=[],
                 scaling_func=None,
                 num_motif_func=None,
                 update_in_iteration=lambda iteration: True,
                 motif_in_iteration=lambda iteration: True,
                 config_params=None):
        """creates a ScoringFunction"""
        # run_in_iteration does not apply here, since we actually have
        # two schedules, motif_in_iteration and update_in_iteration here
        scoring.ScoringFunctionBase.__init__(self,
                                             organism,
                                             membership,
                                             ratios,
                                             scaling_func,
                                             schedule=None,
                                             config_params=config_params)
        # attributes accessible by subclasses
        self.meme_suite = meme_suite
        self.seqtype = seqtype
        self.update_in_iteration = update_in_iteration
        self.motif_in_iteration = motif_in_iteration
        self.num_motif_func = num_motif_func

        self.__sequence_filters = sequence_filters
        self.__last_motif_infos = None
        self.__last_iteration_result = {}
        self.all_pvalues = None
        self.last_result = None

        self.update_log = scoring.RunLog("motif-score-" + seqtype,
                                         config_params)
        self.motif_log = scoring.RunLog("motif-motif-" + seqtype,
                                        config_params)

        used_genes = sorted(ratios.row_names)
        self.used_seqs = organism.sequences_for_genes_scan(
            used_genes, seqtype=self.seqtype)

        logging.info("building reverse map...")
        start_time = util.current_millis()
        self.reverse_map = self.__build_reverse_map(ratios)
        logging.info("reverse map built in %d ms.",
                     util.current_millis() - start_time)
 def __init__(self, organism, membership, ratios, config_params=None):
     """Create scoring function instance"""
     scoring.ScoringFunctionBase.__init__(self, "SetEnrichment", organism,
                                          membership, ratios, config_params)
     self.__set_types = read_set_types(config_params, organism.thesaurus(),
                                       ratios.row_names)
     self.run_log = scoring.RunLog('set_enrichment', config_params)
Exemplo n.º 3
0
 def __init__(self, organism, membership, ratios, scaling_func, schedule,
              config_params):
     """Create scoring function instance"""
     scoring.ScoringFunctionBase.__init__(self, organism, membership,
                                          ratios, scaling_func, schedule,
                                          config_params)
     self.run_log = scoring.RunLog("row_scoring", config_params)
Exemplo n.º 4
0
    def __init__(self,
                 id,
                 organism,
                 membership,
                 ratios,
                 seqtype,
                 config_params=None):
        """creates a ScoringFunction"""
        scoring.ScoringFunctionBase.__init__(self,
                                             id,
                                             organism,
                                             membership,
                                             ratios,
                                             config_params=config_params)
        # attributes accessible by subclasses
        self.seqtype = seqtype
        self.__setup_meme_suite(config_params)
        self.num_motif_func = util.get_iter_fun(
            config_params['MEME'], "nmotifs", config_params['num_iterations'])

        self.__last_motif_infos = None
        self.__last_iteration_result = {}
        self.all_pvalues = None
        self.last_result = None

        self.update_log = scoring.RunLog("motif-score-" + seqtype,
                                         config_params)
        self.motif_log = scoring.RunLog("motif-motif-" + seqtype,
                                        config_params)

        used_genes = sorted(ratios.row_names)
        self.used_seqs = organism.sequences_for_genes_scan(
            used_genes, seqtype=self.seqtype)

        logging.debug("building reverse map...")
        start_time = util.current_millis()
        self.reverse_map = self.__build_reverse_map(ratios)
        logging.debug("reverse map built in %d ms.",
                      util.current_millis() - start_time)

        self.__last_results = None  # caches the results of the previous meme run
Exemplo n.º 5
0
 def __init__(self,
              organism,
              membership,
              matrix,
              set_types,
              scaling_func=None,
              schedule=lambda iteration: True,
              config_params=None):
     """Create scoring function instance"""
     scoring.ScoringFunctionBase.__init__(self, organism, membership,
                                          matrix, scaling_func, schedule,
                                          config_params)
     self.__set_types = set_types
     # stores (min_set, pvalue) pairs for each cluster and set type
     # for the last run of the function
     self.__last_min_enriched_set = {}
     for set_type in set_types:
         self.__last_min_enriched_set[set_type] = {}
     self.run_log = scoring.RunLog('set_enrichment', config_params)
Exemplo n.º 6
0
 def __init__(self, organism, membership, ratios, config_params):
     """Create scoring function instance"""
     scoring.ScoringFunctionBase.__init__(self, "Networks", organism,
                                          membership, ratios, config_params)
     self.__networks = None
     self.run_log = scoring.RunLog("network", config_params)