Spaces:
Sleeping
Sleeping
update app
Browse files- app.py +3 -23
- src/bin/PROBE.py +40 -0
app.py
CHANGED
@@ -9,6 +9,7 @@ import json
|
|
9 |
import yaml
|
10 |
|
11 |
from src.about import *
|
|
|
12 |
|
13 |
global data_component, filter_component
|
14 |
|
@@ -19,19 +20,6 @@ def get_baseline_df():
|
|
19 |
df = df[present_columns]
|
20 |
return df
|
21 |
|
22 |
-
def update_yaml(representation_name, benchmark_type, human_file_path, skempi_file_path):
|
23 |
-
with open("./src/bin/probe_config.yaml", 'r') as file:
|
24 |
-
yaml_data = yaml.safe_load(file)
|
25 |
-
|
26 |
-
yaml_data['representation_name'] = representation_name
|
27 |
-
yaml_data['benchmark'] = benchmark_type
|
28 |
-
yaml_data['representation_file_human'] = human_file
|
29 |
-
yaml_data['representation_file_affinity'] = skempi_file
|
30 |
-
|
31 |
-
with open("./src/bin/probe_config.yaml", "w") as file:
|
32 |
-
yaml.dump(yaml_data, file)
|
33 |
-
|
34 |
-
return None
|
35 |
|
36 |
def add_new_eval(
|
37 |
human_file,
|
@@ -42,16 +30,8 @@ def add_new_eval(
|
|
42 |
):
|
43 |
representation_name = model_name_textbox if revision_name_textbox == '' else revision_name_textbox
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
# Save human and skempi files under ./src/data/representation_vectors using pandas
|
48 |
-
print(human_file)
|
49 |
-
df = pd.read_csv(human_file)
|
50 |
-
print(df.head().to_string())
|
51 |
-
return None
|
52 |
-
if human_file is not None:
|
53 |
-
human_df = pd.read_csv(human_file)
|
54 |
-
human_df.to_csv(f"./src/data/representation_vectors/{representation_name}_human.csv", index=False)
|
55 |
|
56 |
return None
|
57 |
|
|
|
9 |
import yaml
|
10 |
|
11 |
from src.about import *
|
12 |
+
from src.bin.PROBE import run_probe
|
13 |
|
14 |
global data_component, filter_component
|
15 |
|
|
|
20 |
df = df[present_columns]
|
21 |
return df
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def add_new_eval(
|
25 |
human_file,
|
|
|
30 |
):
|
31 |
representation_name = model_name_textbox if revision_name_textbox == '' else revision_name_textbox
|
32 |
|
33 |
+
run_probe(benchmark_type, representation_name, human_file, skempi_file)
|
34 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
return None
|
37 |
|
src/bin/PROBE.py
CHANGED
@@ -59,4 +59,44 @@ if args["benchmark"] in ["affinity","all"]:
|
|
59 |
bae.predict_affinities_and_report_results()
|
60 |
print("\n\nPROBE (Protein RepresentatiOn Benchmark) run is finished...\n")
|
61 |
|
|
|
|
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
bae.predict_affinities_and_report_results()
|
60 |
print("\n\nPROBE (Protein RepresentatiOn Benchmark) run is finished...\n")
|
61 |
|
62 |
+
def run_probe(benchmarks, representation_name, representation_file_human, representation_file_affinity, similarity_tasks=["Sparse","200","500"], function_prediction_aspec="All_Aspects", function_prediction_dataset="All_Data_Sets", family_prediction_dataset=["nc","uc50","uc30","mm15"], detailed_output=False):
|
63 |
+
print("\n\nPROBE (Protein RepresentatiOn Benchmark) run is started...\n\n")
|
64 |
|
65 |
+
if any(item in ['similarity', 'function', 'family', 'all'] for item in benchmarks):
|
66 |
+
print("\nRepresentation vectors are loading...\n")
|
67 |
+
human_representation_dataframe = load_representation(representation_file_human)
|
68 |
+
|
69 |
+
if "similarity" in benchmarks:
|
70 |
+
print("\nSemantic similarity Inference Benchmark is running...\n")
|
71 |
+
ssi.representation_dataframe = human_representation_dataframe
|
72 |
+
ssi.representation_name = representation_name
|
73 |
+
ssi.protein_names = ssi.representation_dataframe['Entry'].tolist()
|
74 |
+
ssi.similarity_tasks = similarity_tasks
|
75 |
+
ssi.detailed_output = detailed_output
|
76 |
+
ssi.calculate_all_correlations()
|
77 |
+
|
78 |
+
if "function" in benchmarks:
|
79 |
+
print("\n\nOntology-based protein function prediction benchmark is running...\n")
|
80 |
+
fp.aspect_type = function_prediction_aspect
|
81 |
+
fp.dataset_type = function_prediction_dataset
|
82 |
+
fp.representation_dataframe = human_representation_dataframe
|
83 |
+
fp.representation_name = representation_name
|
84 |
+
fp.detailed_output = detailed_output
|
85 |
+
fp.pred_output()
|
86 |
+
|
87 |
+
if "family" in benchmarks:
|
88 |
+
print("\n\nDrug target protein family classification benchmark is running...\n")
|
89 |
+
tfc.representation_path = representation_file_human
|
90 |
+
tfc.representation_name = representation_name
|
91 |
+
tfc.detailed_output = detailed_output
|
92 |
+
for dataset in family_prediction_dataset:
|
93 |
+
tfc.score_protein_rep(dataset)
|
94 |
+
|
95 |
+
if "affinity" in benchmarks:
|
96 |
+
print("\n\nProtein-protein binding affinity estimation benchmark is running...\n")
|
97 |
+
bae.skempi_vectors_path = representation_file_affinity
|
98 |
+
bae.representation_name = representation_name
|
99 |
+
bae.predict_affinities_and_report_results()
|
100 |
+
|
101 |
+
print("\n\nPROBE (Protein RepresentatiOn Benchmark) run is finished...\n")
|
102 |
+
return 0
|