Skip to content

Commit

Permalink
# simplifying the number of loops in _parse_mutation()
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriceling committed Nov 11, 2021
1 parent 9884bed commit ac3a40c
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions ASExternalTools/interface_cameo.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,15 @@ def _parse_mutation(mutation):
if mutation.startswith("(") and mutation.endswith(")"):
mutation = mutation[1:-1]
mutation = mutation.replace("'", "")
mutation = mutation.replace('"', "")
# print(mutation)
mutation = [pair.strip() for pair in mutation.split(';')]
# print(mutation)
mutation = [[pair.split(',')[0],
pair.split(',')[1],
pair.split(',')[2]]
for pair in mutation]
# print(mutation)
mutation = [[pair[0].strip(),
pair[1].strip(),
pair[2].strip()]
for pair in mutation]
print(mutation)
ndict = {}
for k in mutation:
ndict[str(k[0])] = (int(k[1]), int(k[2]))
for m in [pair.strip() for pair in mutation.split(';')]:
m = [m.split(',')[0].strip(),
m.split(',')[1].strip(),
m.split(',')[2].strip()]
# print(m)
ndict[str(m[0])] = (int(m[1]), int(m[2]))
return ndict

def _perform_mutation(model, mutation):
Expand Down

0 comments on commit ac3a40c

Please sign in to comment.