Skip to content

Commit

Permalink
Merge pull request #884 from frannerin/rbfe-raw-report
Browse files Browse the repository at this point in the history
'raw' gather report should output all PU repeats
  • Loading branch information
atravitz authored Oct 22, 2024
2 parents d98f67b + 6906c4d commit 949256d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 26 deletions.
15 changes: 8 additions & 7 deletions openfecli/commands/gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ def _generate_bad_legs_error_message(set_vals, ligpair):
def _parse_raw_units(results: dict) -> list[tuple]:
# grab individual unit results from master results dict
# returns list of (estimate, uncertainty) tuples
list_of_pur = list(results['protocol_result']['data'].values())[0]
list_of_pur = list(results['protocol_result']['data'].values())

return [(pu['outputs']['unit_estimate'],
pu['outputs']['unit_estimate_error'])
# could add to each tuple pu[0]["source_key"] for repeat ID
return [(pu[0]['outputs']['unit_estimate'],
pu[0]['outputs']['unit_estimate_error'])
for pu in list_of_pur]


Expand Down Expand Up @@ -192,18 +193,18 @@ def _write_ddg(legs, writer, allow_partial):


def _write_raw(legs, writer, allow_partial=True):
writer.writerow(["leg", "ligand_i", "ligand_j", "DG(i->j) (kcal/mol)",
"MBAR uncertainty (kcal/mol)"])
writer.writerow(["leg", "repeat", "ligand_i", "ligand_j",
"DG(i->j) (kcal/mol)", "MBAR uncertainty (kcal/mol)"])

for ligpair, vals in sorted(legs.items()):
for simtype, repeats in sorted(vals.items()):
for m, u in repeats:
for rep, (m, u) in enumerate(repeats):
if m is None:
m, u = 'NaN', 'NaN'
else:
m, u = format_estimate_uncertainty(m.m, u.m)

writer.writerow([simtype, *ligpair, m, u])
writer.writerow([simtype, rep, *ligpair, m, u])


def _write_dg_raw(legs, writer, allow_partial): # pragma: no-cover
Expand Down
74 changes: 55 additions & 19 deletions openfecli/tests/commands/test_gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,61 @@ def results_dir(tmpdir):


_EXPECTED_RAW = b"""\
leg ligand_i ligand_j DG(i->j) (kcal/mol) MBAR uncertainty (kcal/mol)
complex\tlig_ejm_31\tlig_ejm_42\t-14.9\t0.8
solvent\tlig_ejm_31\tlig_ejm_42\t-15.7\t0.8
complex\tlig_ejm_31\tlig_ejm_46\t-40.7\t0.8
solvent\tlig_ejm_31\tlig_ejm_46\t-39.8\t0.8
complex\tlig_ejm_31\tlig_ejm_47\t-27.8\t0.8
solvent\tlig_ejm_31\tlig_ejm_47\t-27.8\t0.8
complex\tlig_ejm_31\tlig_ejm_48\t-16.2\t0.8
solvent\tlig_ejm_31\tlig_ejm_48\t-16.8\t0.8
complex\tlig_ejm_31\tlig_ejm_50\t-57.3\t0.8
solvent\tlig_ejm_31\tlig_ejm_50\t-58.3\t0.8
complex\tlig_ejm_42\tlig_ejm_43\t-19.0\t0.8
solvent\tlig_ejm_42\tlig_ejm_43\t-20.3\t0.8
complex\tlig_ejm_46\tlig_jmc_23\t17.3\t0.8
solvent\tlig_ejm_46\tlig_jmc_23\t17.2\t0.8
complex\tlig_ejm_46\tlig_jmc_27\t15.9\t0.8
solvent\tlig_ejm_46\tlig_jmc_27\t16.0\t0.8
complex\tlig_ejm_46\tlig_jmc_28\t23.1\t0.8
solvent\tlig_ejm_46\tlig_jmc_28\t23.5\t0.8
leg repeat ligand_i ligand_j DG(i->j) (kcal/mol) MBAR uncertainty (kcal/mol)
complex 0 lig_ejm_31 lig_ejm_42 -14.9 0.8
complex 1 lig_ejm_31 lig_ejm_42 -14.8 0.8
complex 2 lig_ejm_31 lig_ejm_42 -15.1 0.8
solvent 0 lig_ejm_31 lig_ejm_42 -15.7 0.8
solvent 1 lig_ejm_31 lig_ejm_42 -15.7 0.8
solvent 2 lig_ejm_31 lig_ejm_42 -15.7 0.8
complex 0 lig_ejm_31 lig_ejm_46 -40.7 0.8
complex 1 lig_ejm_31 lig_ejm_46 -40.7 0.8
complex 2 lig_ejm_31 lig_ejm_46 -40.8 0.8
solvent 0 lig_ejm_31 lig_ejm_46 -39.8 0.8
solvent 1 lig_ejm_31 lig_ejm_46 -39.9 0.8
solvent 2 lig_ejm_31 lig_ejm_46 -39.8 0.8
complex 0 lig_ejm_31 lig_ejm_47 -27.8 0.8
complex 1 lig_ejm_31 lig_ejm_47 -28.0 0.8
complex 2 lig_ejm_31 lig_ejm_47 -27.7 0.8
solvent 0 lig_ejm_31 lig_ejm_47 -27.8 0.8
solvent 1 lig_ejm_31 lig_ejm_47 -27.8 0.8
solvent 2 lig_ejm_31 lig_ejm_47 -27.9 0.8
complex 0 lig_ejm_31 lig_ejm_48 -16.2 0.8
complex 1 lig_ejm_31 lig_ejm_48 -16.2 0.8
complex 2 lig_ejm_31 lig_ejm_48 -16.0 0.8
solvent 0 lig_ejm_31 lig_ejm_48 -16.8 0.8
solvent 1 lig_ejm_31 lig_ejm_48 -16.7 0.8
solvent 2 lig_ejm_31 lig_ejm_48 -16.8 0.8
complex 0 lig_ejm_31 lig_ejm_50 -57.3 0.8
complex 1 lig_ejm_31 lig_ejm_50 -57.3 0.8
complex 2 lig_ejm_31 lig_ejm_50 -57.4 0.8
solvent 0 lig_ejm_31 lig_ejm_50 -58.3 0.8
solvent 1 lig_ejm_31 lig_ejm_50 -58.4 0.8
solvent 2 lig_ejm_31 lig_ejm_50 -58.3 0.8
complex 0 lig_ejm_42 lig_ejm_43 -19.0 0.8
complex 1 lig_ejm_42 lig_ejm_43 -18.7 0.8
complex 2 lig_ejm_42 lig_ejm_43 -19.0 0.8
solvent 0 lig_ejm_42 lig_ejm_43 -20.3 0.8
solvent 1 lig_ejm_42 lig_ejm_43 -20.3 0.8
solvent 2 lig_ejm_42 lig_ejm_43 -20.3 0.8
complex 0 lig_ejm_46 lig_jmc_23 17.3 0.8
complex 1 lig_ejm_46 lig_jmc_23 17.4 0.8
complex 2 lig_ejm_46 lig_jmc_23 17.5 0.8
solvent 0 lig_ejm_46 lig_jmc_23 17.2 0.8
solvent 1 lig_ejm_46 lig_jmc_23 17.1 0.8
solvent 2 lig_ejm_46 lig_jmc_23 17.1 0.8
complex 0 lig_ejm_46 lig_jmc_27 15.9 0.8
complex 1 lig_ejm_46 lig_jmc_27 15.8 0.8
complex 2 lig_ejm_46 lig_jmc_27 15.7 0.8
solvent 0 lig_ejm_46 lig_jmc_27 16.0 0.8
solvent 1 lig_ejm_46 lig_jmc_27 15.9 0.8
solvent 2 lig_ejm_46 lig_jmc_27 15.9 0.8
complex 0 lig_ejm_46 lig_jmc_28 23.1 0.8
complex 1 lig_ejm_46 lig_jmc_28 23.2 0.8
complex 2 lig_ejm_46 lig_jmc_28 23.1 0.8
solvent 0 lig_ejm_46 lig_jmc_28 23.5 0.8
solvent 1 lig_ejm_46 lig_jmc_28 23.3 0.8
solvent 2 lig_ejm_46 lig_jmc_28 23.4 0.8
"""


Expand Down

0 comments on commit 949256d

Please sign in to comment.