Example #1
0
def oncodrivefm(project):
	log = task.logger
	conf = task.conf

	log.info("--- [{0}] --------------------------------------------".format(project["id"]))

	# configuration

	default_filter = get_data_gene_filter_path(conf)

	genes_filter_enabled = get_project_conf(conf, project,
											"oncodrivefm.genes.filter_enabled", ONCODRIVEFM_GENES_FILTER_ENABLED)

	genes_filter = get_project_conf(conf, project, "oncodrivefm.genes.filter", default_filter)
	if genes_filter is None: # user can assign a null
		genes_filter_enabled = False
		genes_filter = default_filter

	filt = LabelFilter()

	if genes_filter_enabled:
		log.info("Loading expression filter ...")
		log.debug("> {0}".format(genes_filter))
		filt.load(genes_filter)

	log.info("Calculating quality indicators for OncodriveFM ...")

	qc_data = quality_control(log, conf, project, filt if genes_filter_enabled else None)

	project_results = ProjectResults(project)
	project_results.save_quality_control("oncodrivefm", qc_data)
Example #2
0
def load_expression_filter(log, conf, project):

	default_filter = get_data_gene_filter_path(conf)
	genes_filter_enabled = get_project_conf(conf, project,
											"oncodrivefm.genes.filter_enabled", ONCODRIVEFM_GENES_FILTER_ENABLED)

	genes_filter = get_project_conf(conf, project, "oncodrivefm.genes.filter", default_filter)
	if genes_filter is None: # user can assign a null
		genes_filter_enabled = False
		genes_filter = default_filter

	filt = LabelFilter()

	if genes_filter_enabled:
		log.info("Loading expression filter ...")
		log.debug("> {0}".format(genes_filter))
		filt.load(genes_filter)

	return genes_filter_enabled, genes_filter, filt
Example #3
0
def get_oncodrivefm_configuration(log, conf, project, num_samples):
	log.info("OncodriveFM configuration:")

	num_cores = get_project_conf(conf, project, "oncodrivefm.num_cores", ONCODRIVEFM_NUM_CORES)
	estimator = get_project_conf(conf, project, "oncodrivefm.estimator", ONCODRIVEFM_ESTIMATOR)

	log.info("  num_cores = {0}".format(num_cores))
	log.info("  estimator = {0}".format(estimator))

	log.info("  Genes:")

	genes_num_samplings = get_project_conf(conf, project,
										   "oncodrivefm.genes.num_samplings", ONCODRIVEFM_GENES_NUM_SAMPLINGS)

	genes_threshold = get_threshold(log, conf, project,
											"oncodrivefm.genes.threshold", ONCODRIVEFM_GENES_THRESHOLD, num_samples)

	genes_filter_enabled, genes_filter, filt = load_expression_filter(log, conf, project)

	log.info("    num_samplings = {0}".format(genes_num_samplings))
	log.info("    threshold = {0}".format(genes_threshold))
	log.info("    filter enabled = {0}".format(genes_filter_enabled))
	log.info("    filter = {0}".format(os.path.basename(genes_filter) if genes_filter is not None else None))

	log.info("  Pathways:")

	pathways_num_samplings = get_project_conf(conf, project,
									"oncodrivefm.pathways.num_samplings", ONCODRIVEFM_PATHWAYS_NUM_SAMPLINGS)
	pathways_threshold = get_threshold(log, conf, project,
									"oncodrivefm.pathways.threshold", ONCODRIVEFM_PATHWAYS_THRESHOLD, num_samples)

	log.info("    num_samplings = {0}".format(pathways_num_samplings))
	log.info("    threshold = {0}".format(pathways_threshold))

	return (num_cores, estimator,
			genes_num_samplings, genes_threshold, genes_filter_enabled, genes_filter, filt,
			pathways_num_samplings, pathways_threshold)
Example #4
0
def get_threshold(log, conf, project, key, default, num_samples):
	threshold = get_project_conf(conf, project, key, default)
	try:
		threshold = int(threshold)
	except:
		if isinstance(threshold, basestring) and threshold.endswith("%"):
			try:
				threshold = max(num_samples * int(threshold[0:-1]) / 100, 2)
			except:
				log.warn("Wrong threshold value for '{0}'. Using the default value '{1}' instead.".format(threshold[0:-1], default))
				threshold = default
		else:
			log.warn("Wrong threshold value for '{0}'. Using the default value '{1}' instead.".format(threshold, default))
			threshold = default
	return threshold
Example #5
0
def get_oncodriveclust_configuration(log, conf, project):
	log.info("OncodriveCLUST configuration:")

	mutations_threshold = get_project_conf(conf, project, "oncodriveclust.mutations_threshold", ONCODRIVECLUST_MUTATIONS_THRESHOLD)

	default_filter = get_data_gene_filter_path(conf)
	genes_filter_enabled = get_project_conf(conf, project, "oncodriveclust.genes_filter_enabled", ONCODRIVECLUST_GENES_FILTER_ENABLED)
	genes_filter = get_project_conf(conf, project, "oncodriveclust.genes_filter", default_filter)
	if genes_filter is None: # user can assign a null
		genes_filter_enabled = False
		genes_filter = default_filter

	log.info("  mutations_threshold = {0}".format(mutations_threshold))
	log.info("  genes_filter_enabled = {0}".format(genes_filter_enabled))
	log.info("  genes_filter = {0}".format(os.path.basename(genes_filter)))

	filt = LabelFilter()

	if genes_filter_enabled:
		log.info("Loading expression filter ...")
		log.debug("> {0}".format(genes_filter))
		filt.load(genes_filter)

	return (mutations_threshold, genes_filter_enabled, genes_filter, filt)