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
def __init__(self, function_id, cmrun, seqtype): """creates a ScoringFunction""" scoring.ScoringFunctionBase.__init__(self, function_id, cmrun) # attributes accessible by subclasses self.seqtype = seqtype self.__setup_meme_suite(cmrun.config_params) self.num_motif_func = util.get_iter_fun( cmrun.config_params['MEME'], "nmotifs", cmrun.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(("%s-score-" % function_id) + seqtype, cmrun.dbsession(), cmrun.config_params) self.motif_log = scoring.RunLog(("%s-motif-" % function_id) + seqtype, cmrun.dbsession(), cmrun.config_params) used_genes = sorted(cmrun.ratios.row_names) self.used_seqs = cmrun.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(cmrun.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
def get_scaling(params, id): """returns a scaling function for the given prefix from the configuration parameters""" scaling = params[id] return util.get_iter_fun(params, prefix + "scaling", params["num_iterations"])
def get_scaling(params, id): """returns a scaling function for the given prefix from the configuration parameters""" scaling = params[id] return util.get_iter_fun(params, prefix + 'scaling', params['num_iterations'])