Skip to content
Snippets Groups Projects
Commit 5da128cc authored by Le, Mia's avatar Le, Mia
Browse files

added functional relevance to seed_var result table

parent 18bb85c2
Branches
No related tags found
No related merge requests found
...@@ -239,27 +239,35 @@ class cami(): ...@@ -239,27 +239,35 @@ class cami():
prefix=f'{result_set}_{self.uid}', prefix=f'{result_set}_{self.uid}',
file_type='png') file_type='png')
sub_validation_results = biodigest.single_validation.single_validation( with open(os.path.join(self.tmp_dir, f'{result_set}_{self.uid}_relevance_scores.tsv'), 'w') as f:
tar=set(self.result_module_sets[result_set]), rel_score_name = list(set_validation_results['input_values']['values'].keys())[0]
tar_id='entrez', f.write(f'value\t{rel_score_name}\n')
mode='subnetwork-set', val_res_dct = set_validation_results['input_values']['values'][rel_score_name]
distance='jaccard', for val in val_res_dct:
network_data={"network_file":ppi_graph_file, f.write(f'{val}\t{val_res_dct[val]}\n')
"prop_name":"name",
"id_type":"entrez"}, # sub_validation_results = biodigest.single_validation.single_validation(
ref=set(seed_gene_lst), # tar=set(self.result_module_sets[result_set]),
ref_id='entrez' # tar_id='entrez',
) # mode='subnetwork-set',
if sub_validation_results['status'] == 'ok': # distance='jaccard',
biodigest.single_validation.save_results(sub_validation_results, f'{result_set}_{self.uid}', # network_data={"network_file":ppi_graph_file,
self.output_dir) # "prop_name":"name",
biodigest.evaluation.d_utils.plotting_utils.create_plots(results=sub_validation_results, # "id_type":"entrez"},
mode='subnetwork-set', # ref=set(seed_gene_lst),
tar=set(self.result_module_sets[result_set]), # ref_id='entrez'
tar_id='entrez', # )
out_dir=self.output_dir, # if sub_validation_results['status'] == 'ok':
prefix=f'{result_set}_{self.uid}', # biodigest.single_validation.save_results(sub_validation_results, f'{result_set}_{self.uid}',
file_type='png') # self.output_dir)
# biodigest.evaluation.d_utils.plotting_utils.create_plots(results=sub_validation_results,
# mode='subnetwork-set',
# tar=set(self.result_module_sets[result_set]),
# tar_id='entrez',
# out_dir=self.output_dir,
# prefix=f'{result_set}_{self.uid}',
# file_type='png')
def run_threaded_tool(self, tool, pred_sets): def run_threaded_tool(self, tool, pred_sets):
"""run a tool in one thread and save the results into a dictionary pred_sets """run a tool in one thread and save the results into a dictionary pred_sets
......
...@@ -51,6 +51,11 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru ...@@ -51,6 +51,11 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
res_table.write(f'\t{tool}_rdr_ks_pvalue') res_table.write(f'\t{tool}_rdr_ks_pvalue')
for tool in prediction_tools: for tool in prediction_tools:
res_table.write(f'\t{tool}_msr_ks_pvalue') res_table.write(f'\t{tool}_msr_ks_pvalue')
with open(os.path.join(cami.tmp_dir, f'{used_tools[0]}_{cami.uid}_relevance_scores.tsv)'), 'r') as f:
for line in f:
val_name = line.split('\t')[0]
redisc_table.write(f'\t{val_name}')
res_table.write('\n') res_table.write('\n')
# result dictionaries of the form {tool:list(value for each iteration)} # result dictionaries of the form {tool:list(value for each iteration)}
...@@ -135,6 +140,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru ...@@ -135,6 +140,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
for pred_tool in prediction_tools: for pred_tool in prediction_tools:
p_val = kolmogorov_smirnoff.calculate_ks_p_value(list(module_size_dict[tool]), p_val = kolmogorov_smirnoff.calculate_ks_p_value(list(module_size_dict[tool]),
list(module_size_dict[pred_tool])) list(module_size_dict[pred_tool]))
res_table.write(f'\t{p_val}')
with open(os.path.join(cami.tmp_dir, f'{tool}_{cami.uid}_relevance_scores.tsv)'), 'r') as f:
for line in f:
rel_score = line.split('\t')[1].strip()
res_table.write(f'\t{rel_score}')
res_table.write('\n') res_table.write('\n')
print(f'Result tables are saved in the following locations:') print(f'Result tables are saved in the following locations:')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment