Spaces:
Running
Running
roni
commited on
Commit
·
e103bde
1
Parent(s):
4a6ff7a
limiting to peptide search only
Browse files
app.py
CHANGED
@@ -17,10 +17,12 @@ You can use it to search the full [PDB](https://www.rcsb.org/) database or in a
|
|
17 |
"""
|
18 |
max_results = 1000
|
19 |
choice_sep = " | "
|
|
|
20 |
|
21 |
|
22 |
def search_and_display(seq, max_res, index_selection):
|
23 |
n_search_res = 10000
|
|
|
24 |
max_res = int(limit_n_results(max_res))
|
25 |
engine = engines[index_selection]
|
26 |
search_res = engine.search_by_sequence(seq, n=n_search_res)
|
@@ -30,6 +32,11 @@ def search_and_display(seq, max_res, index_selection):
|
|
30 |
return formatted_search_results, results_options
|
31 |
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
def limit_n_results(n):
|
34 |
return max(min(n, max_results), 1)
|
35 |
|
|
|
17 |
"""
|
18 |
max_results = 1000
|
19 |
choice_sep = " | "
|
20 |
+
max_seq_length = 50
|
21 |
|
22 |
|
23 |
def search_and_display(seq, max_res, index_selection):
|
24 |
n_search_res = 10000
|
25 |
+
_validate_sequence_length(seq)
|
26 |
max_res = int(limit_n_results(max_res))
|
27 |
engine = engines[index_selection]
|
28 |
search_res = engine.search_by_sequence(seq, n=n_search_res)
|
|
|
32 |
return formatted_search_results, results_options
|
33 |
|
34 |
|
35 |
+
def _validate_sequence_length(seq):
|
36 |
+
if len(seq) > max_seq_length:
|
37 |
+
raise gr.Error("Only peptide input is currently supported")
|
38 |
+
|
39 |
+
|
40 |
def limit_n_results(n):
|
41 |
return max(min(n, max_results), 1)
|
42 |
|