Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload app.py
Browse files
app.py
CHANGED
@@ -863,36 +863,36 @@ To predict interactions/binding affinities of a single target against a library
|
|
863 |
"Alternatively, enter a Uniprot ID or gene symbol with organism and click Query for "
|
864 |
"the sequence."
|
865 |
)
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
)
|
874 |
-
target_id = gr.Textbox(show_label=False, visible=False,
|
875 |
-
interactive=True, scale=4,
|
876 |
-
info='Query a sequence on UniProt with a UniProt ID.')
|
877 |
-
target_gene = gr.Textbox(
|
878 |
-
show_label=False, visible=False,
|
879 |
-
interactive=True, scale=4,
|
880 |
-
info='Query a sequence on UniProt with a gene symbol.')
|
881 |
-
target_organism = gr.Textbox(
|
882 |
-
info='Organism scientific name (default: Homo sapiens).',
|
883 |
-
placeholder='Homo sapiens', show_label=False,
|
884 |
-
visible=False, interactive=True, scale=4, )
|
885 |
|
886 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
target_upload_btn = gr.UploadButton(label='Upload a FASTA file', type='binary',
|
888 |
visible=True, variant='primary',
|
889 |
size='lg')
|
|
|
890 |
target_query_btn = gr.Button(value='Query the sequence', variant='primary',
|
891 |
-
visible=False)
|
892 |
# with gr.Row():
|
893 |
# example_uniprot = gr.Button(value='Example: Q16539', elem_classes='example', visible=False)
|
894 |
# example_gene = gr.Button(value='Example: MAPK14', elem_classes='example', visible=False)
|
895 |
-
example_fasta = gr.Button(value='Example:
|
896 |
target_fasta = gr.Code(label='Input or Display FASTA', interactive=True, lines=5)
|
897 |
# with gr.Row():
|
898 |
# with gr.Column():
|
@@ -980,7 +980,7 @@ To predict interactions/binding affinities of a single target against a library
|
|
980 |
|
981 |
with gr.TabItem(label='Target protein identification', id=1):
|
982 |
gr.Markdown('''
|
983 |
-
# <center>
|
984 |
|
985 |
<center>
|
986 |
To predict interactions/binding affinities of a single compound against a library of protein targets.
|
@@ -1015,7 +1015,7 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1015 |
"If the proteins in the target library of interest all belong to the same protein "
|
1016 |
"family, manually selecting the family is supported."
|
1017 |
)
|
1018 |
-
target_identify_target_family = gr.Dropdown(choices=
|
1019 |
value='General',
|
1020 |
label='Step 2. Select Target Protein Family ('
|
1021 |
'Optional)')
|
@@ -1042,7 +1042,7 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1042 |
with gr.Column():
|
1043 |
HelpTip(
|
1044 |
"Interaction prediction provides you binding probability score between the target of "
|
1045 |
-
"interest and each compound in the library,"
|
1046 |
"while affinity prediction directly estimates their binding strength measured using "
|
1047 |
"IC50."
|
1048 |
)
|
@@ -1054,7 +1054,7 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1054 |
with gr.Column():
|
1055 |
HelpTip(
|
1056 |
"Select your preferred model, or click Recommend for the best-performing model based "
|
1057 |
-
"on the selected task, family, and whether the compound was trained."
|
1058 |
"Please refer to documentation for detailed benchamrk results."
|
1059 |
)
|
1060 |
target_identify_preset = gr.Dropdown(list(PRESET_MAP.keys()), label='Step 5. Select a '
|
@@ -1080,15 +1080,23 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1080 |
visible=False)
|
1081 |
with gr.TabItem(label='Interaction pair inference', id=2):
|
1082 |
gr.Markdown('''
|
1083 |
-
# <center>
|
1084 |
<center>To predict interactions/binding affinities between any compound-protein pairs.</center>
|
1085 |
''')
|
1086 |
with gr.Blocks() as infer_block:
|
1087 |
with gr.Column() as infer_page:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
infer_type = gr.Dropdown(
|
1089 |
-
choices=['Upload a
|
1090 |
-
'Upload a
|
1091 |
-
|
|
|
1092 |
with gr.Column() as pair_upload:
|
1093 |
gr.File(label="Example custom dataset",
|
1094 |
value="data/examples/interaction_pair_inference.csv",
|
@@ -1113,18 +1121,39 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1113 |
infer_target = gr.File(label='FASTA/CSV file containing multiple targets',
|
1114 |
file_count="single", type='filepath')
|
1115 |
|
1116 |
-
with gr.Row(
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
|
|
|
|
|
|
1122 |
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1128 |
|
1129 |
with gr.Row(visible=True):
|
1130 |
# pair_infer_clr_btn = gr.ClearButton(size='lg')
|
@@ -1138,18 +1167,19 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1138 |
with gr.TabItem(label='Chemical property report', id=3):
|
1139 |
with gr.Blocks() as report:
|
1140 |
gr.Markdown('''
|
1141 |
-
# <center>
|
1142 |
-
|
1143 |
To compute chemical properties for the predictions of drug hit screening,
|
1144 |
-
target protein identification, and interaction pair inference.
|
1145 |
-
|
|
|
1146 |
|
1147 |
The page shows only a preview report displaying at most 30 records
|
1148 |
(with top predicted CPI/CPA if reporting results from a prediction job).
|
1149 |
|
1150 |
For a full report, please
|
1151 |
generate and download a CSV or interactive HTML report below.
|
1152 |
-
|
1153 |
''')
|
1154 |
with gr.Row():
|
1155 |
file_for_report = gr.File(interactive=True, type='filepath')
|
@@ -1160,7 +1190,7 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1160 |
|
1161 |
with gr.Row():
|
1162 |
# clear_btn = gr.ClearButton(size='lg')
|
1163 |
-
analyze_btn = gr.Button('
|
1164 |
|
1165 |
with gr.Row():
|
1166 |
with gr.Column(scale=3):
|
@@ -1187,7 +1217,8 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1187 |
gr.Textbox(visible=False, value=''),
|
1188 |
gr.Textbox(visible=False, value=''),
|
1189 |
gr.Button(visible=True),
|
1190 |
-
gr.Code(value='')
|
|
|
1191 |
case 'Gene symbol':
|
1192 |
return [gr.Dropdown(info=''),
|
1193 |
gr.UploadButton(visible=False),
|
@@ -1195,7 +1226,8 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1195 |
gr.Textbox(visible=True, value=''),
|
1196 |
gr.Textbox(visible=True, value=''),
|
1197 |
gr.Button(visible=True),
|
1198 |
-
gr.Code(value='')
|
|
|
1199 |
case 'Sequence':
|
1200 |
return [gr.Dropdown(info='Enter (paste) a FASTA string below manually or upload a FASTA file.'),
|
1201 |
gr.UploadButton(visible=True),
|
@@ -1203,7 +1235,8 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1203 |
gr.Textbox(visible=False, value=''),
|
1204 |
gr.Textbox(visible=False, value=''),
|
1205 |
gr.Button(visible=False),
|
1206 |
-
gr.Code(value='')
|
|
|
1207 |
|
1208 |
|
1209 |
target_input_type.select(
|
@@ -1212,7 +1245,7 @@ To predict interactions/binding affinities of a single compound against a librar
|
|
1212 |
outputs=[
|
1213 |
target_input_type, target_upload_btn,
|
1214 |
target_id, target_gene, target_organism, target_query_btn,
|
1215 |
-
target_fasta
|
1216 |
],
|
1217 |
show_progress=False
|
1218 |
)
|
|
|
863 |
"Alternatively, enter a Uniprot ID or gene symbol with organism and click Query for "
|
864 |
"the sequence."
|
865 |
)
|
866 |
+
target_input_type = gr.Dropdown(
|
867 |
+
label='Step 1. Select Target Input Type and Input',
|
868 |
+
choices=['Sequence', 'UniProt ID', 'Gene symbol'],
|
869 |
+
info='Enter (paste) a FASTA string below manually or upload a FASTA file.',
|
870 |
+
value='Sequence',
|
871 |
+
scale=4, interactive=True
|
872 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
873 |
|
874 |
with gr.Row():
|
875 |
+
target_id = gr.Textbox(show_label=False, visible=False,
|
876 |
+
interactive=True, scale=4,
|
877 |
+
info='Enter a UniProt ID and query.')
|
878 |
+
target_gene = gr.Textbox(
|
879 |
+
show_label=False, visible=False,
|
880 |
+
interactive=True, scale=4,
|
881 |
+
info='Enter a gene symbol and query.')
|
882 |
+
target_organism = gr.Textbox(
|
883 |
+
info='Organism scientific name (default: Homo sapiens).',
|
884 |
+
placeholder='Homo sapiens', show_label=False,
|
885 |
+
visible=False, interactive=True, scale=4, )
|
886 |
target_upload_btn = gr.UploadButton(label='Upload a FASTA file', type='binary',
|
887 |
visible=True, variant='primary',
|
888 |
size='lg')
|
889 |
+
target_paste_markdown = gr.Button(value='Or paste your sequence below', visible=True)
|
890 |
target_query_btn = gr.Button(value='Query the sequence', variant='primary',
|
891 |
+
visible=False, scale=4)
|
892 |
# with gr.Row():
|
893 |
# example_uniprot = gr.Button(value='Example: Q16539', elem_classes='example', visible=False)
|
894 |
# example_gene = gr.Button(value='Example: MAPK14', elem_classes='example', visible=False)
|
895 |
+
example_fasta = gr.Button(value='Example: MAPK14 (Q16539)', elem_classes='example')
|
896 |
target_fasta = gr.Code(label='Input or Display FASTA', interactive=True, lines=5)
|
897 |
# with gr.Row():
|
898 |
# with gr.Column():
|
|
|
980 |
|
981 |
with gr.TabItem(label='Target protein identification', id=1):
|
982 |
gr.Markdown('''
|
983 |
+
# <center>Target Protein Identification</center>
|
984 |
|
985 |
<center>
|
986 |
To predict interactions/binding affinities of a single compound against a library of protein targets.
|
|
|
1015 |
"If the proteins in the target library of interest all belong to the same protein "
|
1016 |
"family, manually selecting the family is supported."
|
1017 |
)
|
1018 |
+
target_identify_target_family = gr.Dropdown(choices=['General'],
|
1019 |
value='General',
|
1020 |
label='Step 2. Select Target Protein Family ('
|
1021 |
'Optional)')
|
|
|
1042 |
with gr.Column():
|
1043 |
HelpTip(
|
1044 |
"Interaction prediction provides you binding probability score between the target of "
|
1045 |
+
"interest and each compound in the library, "
|
1046 |
"while affinity prediction directly estimates their binding strength measured using "
|
1047 |
"IC50."
|
1048 |
)
|
|
|
1054 |
with gr.Column():
|
1055 |
HelpTip(
|
1056 |
"Select your preferred model, or click Recommend for the best-performing model based "
|
1057 |
+
"on the selected task, family, and whether the compound was trained. "
|
1058 |
"Please refer to documentation for detailed benchamrk results."
|
1059 |
)
|
1060 |
target_identify_preset = gr.Dropdown(list(PRESET_MAP.keys()), label='Step 5. Select a '
|
|
|
1080 |
visible=False)
|
1081 |
with gr.TabItem(label='Interaction pair inference', id=2):
|
1082 |
gr.Markdown('''
|
1083 |
+
# <center>Interaction Pair Inference</center>
|
1084 |
<center>To predict interactions/binding affinities between any compound-protein pairs.</center>
|
1085 |
''')
|
1086 |
with gr.Blocks() as infer_block:
|
1087 |
with gr.Column() as infer_page:
|
1088 |
+
HelpTip(
|
1089 |
+
"A custom interation pair dataset can be a CSV file with 2 required columns "
|
1090 |
+
"(X1 for smiles and X2 for sequences) "
|
1091 |
+
"and optionally 2 ID columns (ID1 for compound ID and ID2 for target ID), "
|
1092 |
+
"or generated from a FASTA file containing multiple"
|
1093 |
+
"sequences and a SDF file containing multiple compounds."
|
1094 |
+
)
|
1095 |
infer_type = gr.Dropdown(
|
1096 |
+
choices=['Upload a CSV interaction pair dataset',
|
1097 |
+
'Upload a compound library and a target library'],
|
1098 |
+
label='Step 1. Select Pair Input Type and Input',
|
1099 |
+
value='Upload a CSV interaction pair dataset')
|
1100 |
with gr.Column() as pair_upload:
|
1101 |
gr.File(label="Example custom dataset",
|
1102 |
value="data/examples/interaction_pair_inference.csv",
|
|
|
1121 |
infer_target = gr.File(label='FASTA/CSV file containing multiple targets',
|
1122 |
file_count="single", type='filepath')
|
1123 |
|
1124 |
+
with gr.Row():
|
1125 |
+
with gr.Column():
|
1126 |
+
HelpTip(
|
1127 |
+
"By default, models trained on all protein families (general) will be applied. "
|
1128 |
+
"If the proteins in the target library of interest all belong to the same protein family, manually selecting the family is supported."
|
1129 |
+
)
|
1130 |
+
pair_infer_target_family = gr.Dropdown(choices=list(TARGET_FAMILY_MAP.keys()),
|
1131 |
+
value='General',
|
1132 |
+
label='Step 2. Select Target Protein Family (Optional)')
|
1133 |
|
1134 |
+
with gr.Row():
|
1135 |
+
with gr.Column():
|
1136 |
+
HelpTip(
|
1137 |
+
"Interaction prediction provides you binding probability score between the target of interest and each compound in the library, "
|
1138 |
+
"while affinity prediction directly estimates their binding strength measured using IC50."
|
1139 |
+
)
|
1140 |
+
pair_infer_task = gr.Dropdown(list(TASK_MAP.keys()),
|
1141 |
+
label='Step 3. Select a Prediction Task',
|
1142 |
+
value='Compound-protein interaction')
|
1143 |
+
|
1144 |
+
with gr.Row():
|
1145 |
+
with gr.Column():
|
1146 |
+
HelpTip("Select your preferred model. "
|
1147 |
+
"Please refer to documentation for detailed benchamrk results."
|
1148 |
+
)
|
1149 |
+
pair_infer_preset = gr.Dropdown(list(PRESET_MAP.keys()), label='Step 4. Select a Preset Model')
|
1150 |
+
# infer_preset_recommend_btn = gr.Button(value='Recommend a model', variant='primary')
|
1151 |
+
|
1152 |
+
with gr.Row():
|
1153 |
+
pair_infer_email = gr.Textbox(
|
1154 |
+
label='Step 5. Email (Optional)',
|
1155 |
+
info="If an email is provided, a notification email will be sent to you when your job is completed."
|
1156 |
+
)
|
1157 |
|
1158 |
with gr.Row(visible=True):
|
1159 |
# pair_infer_clr_btn = gr.ClearButton(size='lg')
|
|
|
1167 |
with gr.TabItem(label='Chemical property report', id=3):
|
1168 |
with gr.Blocks() as report:
|
1169 |
gr.Markdown('''
|
1170 |
+
# <center>Chemical Property Report</center>
|
1171 |
+
|
1172 |
To compute chemical properties for the predictions of drug hit screening,
|
1173 |
+
target protein identification, and interaction pair inference.
|
1174 |
+
|
1175 |
+
You may also upload your own dataset using a CSV file containing one required column X1 for compound SMILES.
|
1176 |
|
1177 |
The page shows only a preview report displaying at most 30 records
|
1178 |
(with top predicted CPI/CPA if reporting results from a prediction job).
|
1179 |
|
1180 |
For a full report, please
|
1181 |
generate and download a CSV or interactive HTML report below.
|
1182 |
+
|
1183 |
''')
|
1184 |
with gr.Row():
|
1185 |
file_for_report = gr.File(interactive=True, type='filepath')
|
|
|
1190 |
|
1191 |
with gr.Row():
|
1192 |
# clear_btn = gr.ClearButton(size='lg')
|
1193 |
+
analyze_btn = gr.Button('Preview Top 30 Records', variant='primary', size='lg', interactive=False)
|
1194 |
|
1195 |
with gr.Row():
|
1196 |
with gr.Column(scale=3):
|
|
|
1217 |
gr.Textbox(visible=False, value=''),
|
1218 |
gr.Textbox(visible=False, value=''),
|
1219 |
gr.Button(visible=True),
|
1220 |
+
gr.Code(value=''),
|
1221 |
+
gr.Button(visible=False)]
|
1222 |
case 'Gene symbol':
|
1223 |
return [gr.Dropdown(info=''),
|
1224 |
gr.UploadButton(visible=False),
|
|
|
1226 |
gr.Textbox(visible=True, value=''),
|
1227 |
gr.Textbox(visible=True, value=''),
|
1228 |
gr.Button(visible=True),
|
1229 |
+
gr.Code(value=''),
|
1230 |
+
gr.Button(visible=False)]
|
1231 |
case 'Sequence':
|
1232 |
return [gr.Dropdown(info='Enter (paste) a FASTA string below manually or upload a FASTA file.'),
|
1233 |
gr.UploadButton(visible=True),
|
|
|
1235 |
gr.Textbox(visible=False, value=''),
|
1236 |
gr.Textbox(visible=False, value=''),
|
1237 |
gr.Button(visible=False),
|
1238 |
+
gr.Code(value=''),
|
1239 |
+
gr.Button(visible=True)]
|
1240 |
|
1241 |
|
1242 |
target_input_type.select(
|
|
|
1245 |
outputs=[
|
1246 |
target_input_type, target_upload_btn,
|
1247 |
target_id, target_gene, target_organism, target_query_btn,
|
1248 |
+
target_fasta, target_paste_markdown
|
1249 |
],
|
1250 |
show_progress=False
|
1251 |
)
|