Skip to content

Commit

Permalink
restore reordering of clashcore dict. see #77
Browse files Browse the repository at this point in the history
  • Loading branch information
aozalevsky committed Mar 14, 2024
1 parent 4eef0f0 commit 817d2ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ihm_validation/molprobity.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,18 +763,19 @@ def get_clash_score(line: str) -> str:
for model_id in dict1['Model ID']:
dict1['Number of clashes'].append(len(clashes[f'Model {model_id}'][0]))
clash_total = (sum(dict1['Number of clashes']))
dict1 = self.orderclashdict(dict1)
print(dict1['Model ID'], file=f_clash)
print(dict1['Clash score'], file=f_clash)
print(dict1['Number of clashes'], file=f_clash)

return dict1, clash_total

def orderclashdict(self, modeldict: dict) -> dict:
""" DEPRECATED molprobity returns output in lexicographic order
"""molprobity returns output in lexicographic order
this is to change it to number order
"""
df = pd.DataFrame(modeldict)
df['ID'] = df['Model ID'].apply(lambda x: int(x.split()[1]))
df['ID'] = df['Model ID'].apply(lambda x: int(x))
df = df.sort_values(by='ID')
df = df.drop(['ID'], axis=1)
df_dict = df.to_dict()
Expand Down

0 comments on commit 817d2ea

Please sign in to comment.