Skip to content

Commit ac3a40c

Browse files
committed
# simplifying the number of loops in _parse_mutation()
1 parent 9884bed commit ac3a40c

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

ASExternalTools/interface_cameo.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,15 @@ def _parse_mutation(mutation):
236236
if mutation.startswith("(") and mutation.endswith(")"):
237237
mutation = mutation[1:-1]
238238
mutation = mutation.replace("'", "")
239+
mutation = mutation.replace('"', "")
239240
# print(mutation)
240-
mutation = [pair.strip() for pair in mutation.split(';')]
241-
# print(mutation)
242-
mutation = [[pair.split(',')[0],
243-
pair.split(',')[1],
244-
pair.split(',')[2]]
245-
for pair in mutation]
246-
# print(mutation)
247-
mutation = [[pair[0].strip(),
248-
pair[1].strip(),
249-
pair[2].strip()]
250-
for pair in mutation]
251-
print(mutation)
252241
ndict = {}
253-
for k in mutation:
254-
ndict[str(k[0])] = (int(k[1]), int(k[2]))
242+
for m in [pair.strip() for pair in mutation.split(';')]:
243+
m = [m.split(',')[0].strip(),
244+
m.split(',')[1].strip(),
245+
m.split(',')[2].strip()]
246+
# print(m)
247+
ndict[str(m[0])] = (int(m[1]), int(m[2]))
255248
return ndict
256249

257250
def _perform_mutation(model, mutation):

0 commit comments

Comments
 (0)