コード例 #1
0
ファイル: MpiClusterBsStat.py プロジェクト: polyactis/annot
	def computing_node_handler(self, communicator, data, parameter_list):
		"""
		12-20-05
			called common's computing_node()
		2006-09-21 add fuzzyDense_flag
		"""
		node_rank = communicator.rank
		sys.stderr.write("Node no.%s working...\n"%node_rank)
		data = cPickle.loads(data)
		gene_no2bs_no_set, bs_no2gene_no_set, ratio_cutoff, \
		top_number, p_value_cut_off, fuzzyDense_instance, degree_cut_off, fuzzyDense_flag = parameter_list
		result = []
		for row in data:
			id, vertex_set, recurrence_array = row
			vertex_set = vertex_set[1:-1].split(',')
			vertex_set = map(int, vertex_set)
			if fuzzyDense_flag:
				recurrence_array = recurrence_array[1:-1].split(',')
				recurrence_array = map(float, recurrence_array)
				core_vertex_list, on_dataset_index_ls =  fuzzyDense_instance.get_core_vertex_set(vertex_set, recurrence_array, degree_cut_off)
				if core_vertex_list:
					ls_to_return = cluster_bs_analysis(core_vertex_list, gene_no2bs_no_set, bs_no2gene_no_set, ratio_cutoff, \
						top_number, p_value_cut_off)
					if ls_to_return:
						result.append([id, core_vertex_list, on_dataset_index_ls, ls_to_return])
			else:
				ls_to_return = cluster_bs_analysis(vertex_set, gene_no2bs_no_set, bs_no2gene_no_set, ratio_cutoff, \
					top_number, p_value_cut_off)
				if ls_to_return:
					result.append([id, vertex_set, [0], ls_to_return])	#05-31-06, on_dataset_index_ls is faked by [0]
		sys.stderr.write("Node no.%s done.\n"%node_rank)
		return result
コード例 #2
0
ファイル: fuzzyDense.py プロジェクト: polyactis/annot
		rows = curs.fetchall()
		vertex_list, recurrence_array = rows[0]
		vertex_list = vertex_list[1:-1].split(',')
		vertex_list = map(int, vertex_list)
		recurrence_array = recurrence_array[1:-1].split(',')
		recurrence_array = map(float, recurrence_array)
		
		fuzzyDense_instance = fuzzyDense(edge2encodedOccurrence, debug)
		core_vertex_ls, recurrent_and_on_datasets_ls = fuzzyDense_instance.get_core_vertex_set(vertex_list, recurrence_array, degree_cut_off)
		
		from MpiClusterBsStat import MpiClusterBsStat
		MpiClusterBsStat_instance = MpiClusterBsStat()
		gene_no2bs_no_block = MpiClusterBsStat_instance.get_gene_no2bs_no_block(curs)
		gene_no2bs_no_set, bs_no2gene_no_set = MpiClusterBsStat_instance.construct_two_dicts(0, gene_no2bs_no_block)
		from TF_functions import cluster_bs_analysis
		ls_to_return = cluster_bs_analysis(core_vertex_ls, gene_no2bs_no_set, bs_no2gene_no_set, ratio_cutoff, \
			top_number, p_value_cut_off)
		
		gene_id2symbol = get_gene_id2gene_symbol(curs, tax_id)
		dataset_no2desc = get_dataset_no2desc(curs)
		
		dataset_no_desc_ls = []
		for dataset_index in recurrent_and_on_datasets_ls:
			dataset_no = dataset_index +1
			dataset_no_desc_ls.append([dataset_no, dataset_no2desc[dataset_no]])
		
		
		outf = open(output_file, 'w')
		outf.write("out:=[\n")
		for i in range(len(ls_to_return)):
			row = ls_to_return[i]
			score, score_type, bs_no_list, target_gene_no_list, global_ratio, local_ratio, expected_ratio, unknown_ratio = row