prettify columns
Browse files- folding_studio_demo/app.py +20 -11
- folding_studio_demo/correlate.py +2 -2
folding_studio_demo/app.py
CHANGED
@@ -8,7 +8,7 @@ from gradio_molecule3d import Molecule3D
|
|
8 |
import pandas as pd
|
9 |
|
10 |
from folding_studio_demo.predict import predict
|
11 |
-
from folding_studio_demo.correlate import fake_predict_and_correlate,
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
@@ -144,12 +144,26 @@ def model_comparison(api_key: str) -> None:
|
|
144 |
|
145 |
|
146 |
def create_correlation_tab():
|
147 |
-
gr.Markdown("#
|
148 |
spr_data_with_scores = pd.read_csv("spr_af_scores_mapped.csv")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
with gr.Row():
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
gr.Markdown("# Prediction and correlation")
|
155 |
with gr.Row():
|
@@ -162,13 +176,8 @@ def create_correlation_tab():
|
|
162 |
correlation_ranking_plot = gr.Plot(label="Correlation ranking")
|
163 |
correlation_plot = gr.Plot(label="Correlation with binding affinity")
|
164 |
|
165 |
-
csv_file.change(
|
166 |
-
fn=lambda file: spr_data_with_scores.drop(columns=COLUMNS) if file else None,
|
167 |
-
inputs=csv_file,
|
168 |
-
outputs=dataframe
|
169 |
-
)
|
170 |
fake_predict_btn.click(
|
171 |
-
fn=lambda x: fake_predict_and_correlate(spr_data_with_scores,
|
172 |
inputs=None,
|
173 |
outputs=[prediction_dataframe, correlation_ranking_plot, correlation_plot]
|
174 |
)
|
|
|
8 |
import pandas as pd
|
9 |
|
10 |
from folding_studio_demo.predict import predict
|
11 |
+
from folding_studio_demo.correlate import fake_predict_and_correlate, SCORE_COLUMNS
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
|
|
144 |
|
145 |
|
146 |
def create_correlation_tab():
|
147 |
+
gr.Markdown("# Correlation with experimental binding affinity data")
|
148 |
spr_data_with_scores = pd.read_csv("spr_af_scores_mapped.csv")
|
149 |
+
prettified_columns = {
|
150 |
+
"antibody_name": "Antibody Name",
|
151 |
+
"KD (nM)": "KD (nM)",
|
152 |
+
"antibody_vh_sequence": "Antibody VH Sequence",
|
153 |
+
"antibody_vl_sequence": "Antibody VL Sequence",
|
154 |
+
"antigen_sequence": "Antigen Sequence"
|
155 |
+
}
|
156 |
+
spr_data_with_scores = spr_data_with_scores.rename(columns=prettified_columns)
|
157 |
with gr.Row():
|
158 |
+
columns = [
|
159 |
+
"Antibody Name",
|
160 |
+
"KD (nM)",
|
161 |
+
"Antibody VH Sequence",
|
162 |
+
"Antibody VL Sequence",
|
163 |
+
"Antigen Sequence"
|
164 |
+
]
|
165 |
+
# Display dataframe with floating point values rounded to 2 decimal places
|
166 |
+
spr_data = gr.DataFrame(value=spr_data_with_scores[columns].round(2), label="Experimental Antibody-Antigen Binding Affinity Data")
|
167 |
|
168 |
gr.Markdown("# Prediction and correlation")
|
169 |
with gr.Row():
|
|
|
176 |
correlation_ranking_plot = gr.Plot(label="Correlation ranking")
|
177 |
correlation_plot = gr.Plot(label="Correlation with binding affinity")
|
178 |
|
|
|
|
|
|
|
|
|
|
|
179 |
fake_predict_btn.click(
|
180 |
+
fn=lambda x: fake_predict_and_correlate(spr_data_with_scores, SCORE_COLUMNS),
|
181 |
inputs=None,
|
182 |
outputs=[prediction_dataframe, correlation_ranking_plot, correlation_plot]
|
183 |
)
|
folding_studio_demo/correlate.py
CHANGED
@@ -6,7 +6,7 @@ from scipy.stats import spearmanr
|
|
6 |
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
9 |
-
|
10 |
"confidence_score_boltz",
|
11 |
"ptm_boltz",
|
12 |
"iptm_boltz",
|
@@ -87,4 +87,4 @@ def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: l
|
|
87 |
cols_to_show = [kd_col]
|
88 |
cols_to_show.extend(score_cols)
|
89 |
|
90 |
-
return spr_data_with_scores[cols_to_show], corr_ranking_plot, corr_plot
|
|
|
6 |
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
9 |
+
SCORE_COLUMNS = [
|
10 |
"confidence_score_boltz",
|
11 |
"ptm_boltz",
|
12 |
"iptm_boltz",
|
|
|
87 |
cols_to_show = [kd_col]
|
88 |
cols_to_show.extend(score_cols)
|
89 |
|
90 |
+
return spr_data_with_scores[cols_to_show].round(2), corr_ranking_plot, corr_plot
|