Spaces:
Running
on
Zero
Running
on
Zero
Anton Bushuiev
commited on
Commit
·
b432a65
1
Parent(s):
cc0f00e
Check mutations
Browse files
app.py
CHANGED
@@ -82,7 +82,32 @@ def process_inputs(inputs, temp_dir):
|
|
82 |
|
83 |
muts = list(map(lambda x: x.strip(), muts.split(';')))
|
84 |
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
|
88 |
def plot_3dmol(pdb_path, ppi_path, muts, attn, mut_id=0):
|
|
|
82 |
|
83 |
muts = list(map(lambda x: x.strip(), muts.split(';')))
|
84 |
|
85 |
+
# Basic format
|
86 |
+
try:
|
87 |
+
muts = list(map(lambda m: Mutation.from_str(m), muts.split(';')))
|
88 |
+
except Exception as e:
|
89 |
+
raise gr.Error(f'Mutations parsing failed: {e}.')
|
90 |
+
|
91 |
+
# Partners
|
92 |
+
for mut in muts:
|
93 |
+
for pmut in mut.muts:
|
94 |
+
if pmut.chain not in partners:
|
95 |
+
raise gr.Error(f'Chain of point mutation {pmut} from {mut} is not in the list of partners {partners}.')
|
96 |
+
|
97 |
+
# Consistency with provided .pdb
|
98 |
+
muts_on_interface = []
|
99 |
+
for mut in muts:
|
100 |
+
if mut.wt_in_pdb(ppi_path):
|
101 |
+
val = True
|
102 |
+
elif mut.wt_in_pdb(pdb_path):
|
103 |
+
val = False
|
104 |
+
else:
|
105 |
+
raise gr.Error(f'Wild-type of mutation {mut} is not in the provided .pdb file.')
|
106 |
+
muts_on_interface.append(val)
|
107 |
+
|
108 |
+
muts = [str(m) for m in muts]
|
109 |
+
|
110 |
+
return pdb_path, ppi_path, muts, muts_on_interface
|
111 |
|
112 |
|
113 |
def plot_3dmol(pdb_path, ppi_path, muts, attn, mut_id=0):
|