EZ4Fanta commited on
Commit
e58b2fc
·
1 Parent(s): d6b4b2b
Files changed (3) hide show
  1. .gitignore +3 -1
  2. app.py +7 -29
  3. requirements.txt +1 -1
.gitignore CHANGED
@@ -2,4 +2,6 @@ static/dna.html
2
  static/dna.pdb
3
  static/test.cif
4
  test.py
5
- *.ipynb
 
 
 
2
  static/dna.pdb
3
  static/test.cif
4
  test.py
5
+ *.ipynb
6
+ __pycache__
7
+ *.pyc
app.py CHANGED
@@ -77,7 +77,7 @@ def render_html(view, entity_color_dict):
77
 
78
 
79
  def analyze_contacts(selected_str, cutoff, structure_cache):
80
- keys = [k.strip() for k in selected_str.split(";") if k]
81
  if len(keys) < 2:
82
  debug_text = "<b style='color:red'>请至少选择两个实体进行分析</b>"
83
  return debug_text, debug_text
@@ -126,24 +126,19 @@ with gr.Blocks() as demo:
126
  file_input = gr.File(label="上传PDB文件", file_types=[".pdb"], scale=1)
127
  with gr.Column(scale=2):
128
  with gr.Row():
129
- with gr.Column():
130
- entity_selector = gr.Dropdown(label="选择实体", choices=[], interactive=True)
131
- with gr.Row():
132
- add_btn = gr.Button("添加")
133
- del_btn = gr.Button("删除")
134
- clr_btn = gr.Button("清空")
135
-
136
- with gr.Column():
137
- selected_display = gr.Textbox(label="已选择实体(以分号分隔)", interactive=True)
138
  cutoff_slider = gr.Slider(1, 10, value=4.0, step=0.5, label="Cutoff 距离 (Å)")
139
-
140
  run_btn = gr.Button("分析并渲染")
141
 
 
142
  debug_text = gr.Textbox(label="调试信息", interactive=False)
143
 
144
  run_btn.click(
145
  fn=analyze_contacts,
146
- inputs=[selected_display, cutoff_slider, structure_cache],
147
  outputs=[output, debug_text]
148
  )
149
 
@@ -153,23 +148,6 @@ with gr.Blocks() as demo:
153
  outputs=[output, entity_selector, structure_cache]
154
  )
155
 
156
- add_btn.click(
157
- fn=update_selected,
158
- inputs=[entity_selector, selected_display],
159
- outputs=selected_display
160
- )
161
-
162
- del_btn.click(
163
- fn=delete_selected,
164
- inputs=[entity_selector, selected_display],
165
- outputs=selected_display
166
- )
167
-
168
- clr_btn.click(
169
- fn=clear_selected,
170
- inputs=[],
171
- outputs=selected_display
172
- )
173
 
174
  demo.load(
175
  fn=lambda: load_structure(default_file),
 
77
 
78
 
79
  def analyze_contacts(selected_str, cutoff, structure_cache):
80
+ keys = selected_str
81
  if len(keys) < 2:
82
  debug_text = "<b style='color:red'>请至少选择两个实体进行分析</b>"
83
  return debug_text, debug_text
 
126
  file_input = gr.File(label="上传PDB文件", file_types=[".pdb"], scale=1)
127
  with gr.Column(scale=2):
128
  with gr.Row():
129
+ with gr.Column(scale=2):
130
+ entity_selector = gr.Dropdown(choices=[], interactive=True, multiselect=True, label="选择实体")
131
+
132
+ with gr.Column(scale=1):
 
 
 
 
 
133
  cutoff_slider = gr.Slider(1, 10, value=4.0, step=0.5, label="Cutoff 距离 (Å)")
 
134
  run_btn = gr.Button("分析并渲染")
135
 
136
+
137
  debug_text = gr.Textbox(label="调试信息", interactive=False)
138
 
139
  run_btn.click(
140
  fn=analyze_contacts,
141
+ inputs=[entity_selector, cutoff_slider, structure_cache],
142
  outputs=[output, debug_text]
143
  )
144
 
 
148
  outputs=[output, entity_selector, structure_cache]
149
  )
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  demo.load(
153
  fn=lambda: load_structure(default_file),
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  Bio==1.8.0
2
  biopython==1.85
3
- gradio==5.29.1
4
  py3Dmol==2.4.2
5
  py3Dmol==2.4.2
 
1
  Bio==1.8.0
2
  biopython==1.85
3
+ gradio==5.30.0
4
  py3Dmol==2.4.2
5
  py3Dmol==2.4.2