add target select
Browse files- app.py +10 -1
- multiana.py +3 -2
app.py
CHANGED
|
@@ -159,6 +159,7 @@ def multi_uniprot(uniprot_id, pdb_num):
|
|
| 159 |
|
| 160 |
def multi_zip(zip_file, seq_input,
|
| 161 |
multi_cutoff, identity_threshold,
|
|
|
|
| 162 |
cnt_by_file=True):
|
| 163 |
# 1. 解压 ZIP 文件到临时文件夹
|
| 164 |
if zip_file is None:
|
|
@@ -185,6 +186,7 @@ def multi_zip(zip_file, seq_input,
|
|
| 185 |
seq_fixed,
|
| 186 |
cutoff=multi_cutoff,
|
| 187 |
match_ratio=identity_threshold / 100,
|
|
|
|
| 188 |
cnt_by_file=cnt_by_file
|
| 189 |
)
|
| 190 |
svg_html = logo_plot(seq_fixed, result)
|
|
@@ -250,6 +252,13 @@ with gr.Blocks() as demo:
|
|
| 250 |
)
|
| 251 |
|
| 252 |
with gr.Group():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
with gr.Row():
|
| 254 |
multi_cutoff_slider = gr.Slider(1, 10, value=3.5, step=0.5, label="Cutoff 距离 (Å)", interactive=True, scale=3)
|
| 255 |
cnt_checkbox = gr.Checkbox(label="Yes", info="单文件内不重复统计位点", value=True, interactive=True)
|
|
@@ -295,7 +304,7 @@ with gr.Blocks() as demo:
|
|
| 295 |
# 多结构分析
|
| 296 |
multi_run_btn.click(
|
| 297 |
fn=multi_zip,
|
| 298 |
-
inputs=[zip_input, seq_input, multi_cutoff_slider, identity_threshold, cnt_checkbox],
|
| 299 |
outputs=[multi_logo, multi_result_cache]
|
| 300 |
)
|
| 301 |
uniprot_btn.click(
|
|
|
|
| 159 |
|
| 160 |
def multi_zip(zip_file, seq_input,
|
| 161 |
multi_cutoff, identity_threshold,
|
| 162 |
+
target_entity_keys=None,
|
| 163 |
cnt_by_file=True):
|
| 164 |
# 1. 解压 ZIP 文件到临时文件夹
|
| 165 |
if zip_file is None:
|
|
|
|
| 186 |
seq_fixed,
|
| 187 |
cutoff=multi_cutoff,
|
| 188 |
match_ratio=identity_threshold / 100,
|
| 189 |
+
target_entity_keys=target_entity_keys,
|
| 190 |
cnt_by_file=cnt_by_file
|
| 191 |
)
|
| 192 |
svg_html = logo_plot(seq_fixed, result)
|
|
|
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Group():
|
| 255 |
+
mult_target_selector = gr.Dropdown(
|
| 256 |
+
value=['Ligand'],
|
| 257 |
+
choices=['Ligand', 'Protein', 'DNA', 'RNA', 'Ion'],
|
| 258 |
+
label="选择互作对象类型(可多选)",
|
| 259 |
+
multiselect=True,
|
| 260 |
+
interactive=True,
|
| 261 |
+
)
|
| 262 |
with gr.Row():
|
| 263 |
multi_cutoff_slider = gr.Slider(1, 10, value=3.5, step=0.5, label="Cutoff 距离 (Å)", interactive=True, scale=3)
|
| 264 |
cnt_checkbox = gr.Checkbox(label="Yes", info="单文件内不重复统计位点", value=True, interactive=True)
|
|
|
|
| 304 |
# 多结构分析
|
| 305 |
multi_run_btn.click(
|
| 306 |
fn=multi_zip,
|
| 307 |
+
inputs=[zip_input, seq_input, multi_cutoff_slider, identity_threshold, mult_target_selector, cnt_checkbox],
|
| 308 |
outputs=[multi_logo, multi_result_cache]
|
| 309 |
)
|
| 310 |
uniprot_btn.click(
|
multiana.py
CHANGED
|
@@ -148,7 +148,7 @@ def analyze_group(
|
|
| 148 |
# 4. 筛选实体
|
| 149 |
all_keys = set(summary.keys())
|
| 150 |
all_keys.discard(prot_key)
|
| 151 |
-
if target_entity_keys:
|
| 152 |
target_entity_keys_canonical = [f'({k.lower()})' for k in target_entity_keys]
|
| 153 |
keys_to_analyze = []
|
| 154 |
for k in all_keys:
|
|
@@ -157,7 +157,8 @@ def analyze_group(
|
|
| 157 |
else:
|
| 158 |
keys_to_analyze = list(all_keys)
|
| 159 |
file_residues = set()
|
| 160 |
-
# 5. 提取接触
|
|
|
|
| 161 |
for key in keys_to_analyze:
|
| 162 |
contacts = extract_contact_residues(
|
| 163 |
summary,
|
|
|
|
| 148 |
# 4. 筛选实体
|
| 149 |
all_keys = set(summary.keys())
|
| 150 |
all_keys.discard(prot_key)
|
| 151 |
+
if target_entity_keys is not None:
|
| 152 |
target_entity_keys_canonical = [f'({k.lower()})' for k in target_entity_keys]
|
| 153 |
keys_to_analyze = []
|
| 154 |
for k in all_keys:
|
|
|
|
| 157 |
else:
|
| 158 |
keys_to_analyze = list(all_keys)
|
| 159 |
file_residues = set()
|
| 160 |
+
# 5. 提取接触
|
| 161 |
+
# TODO: 似乎可以不用循环
|
| 162 |
for key in keys_to_analyze:
|
| 163 |
contacts = extract_contact_residues(
|
| 164 |
summary,
|