allow gathering of legacy results

This commit is contained in:
richard gowers
2023-07-03 12:07:52 +01:00
committed by Richard Gowers
parent 916695fa87
commit 516a3aeb55
2 changed files with 21 additions and 4 deletions

View File

@@ -23,7 +23,10 @@ def get_names(result) -> tuple[str, str]:
# Result to tuple of ligand names
nm = list(result['unit_results'].values())[0]['name']
toks = nm.split()
return toks[0], toks[2]
if toks[2] == 'repeat':
return toks[0], toks[1]
else:
return toks[0], toks[2]
def get_type(res):
@@ -39,6 +42,15 @@ def get_type(res):
return 'solvent'
def legacy_get_type(res_fn):
if 'solvent' in res_fn:
return 'solvent'
elif 'vacuum' in res_fn:
return 'vacuum'
else:
return 'complex'
@click.command(
'gather',
short_help="Gather result jsons for network of RFE results into a TSV file"
@@ -104,8 +116,14 @@ def gather(rootdir, output):
click.echo(f"WARNING: Calculations for {result_fn} did not finish succesfully!",
err=True)
names = get_names(result)
simtype = get_type(result)
try:
names = get_names(result)
except KeyError:
raise ValueError("Failed to guess names")
try:
simtype = get_type(result)
except KeyError:
simtype = legacy_get_type(result_fn)
legs[names][simtype] = result['estimate'], result['uncertainty']

View File

@@ -69,7 +69,6 @@ DGvacuum(lig_13, lig_14)\tvacuum\tlig_13\tlig_14\t15.0\t0.0057
"""
@pytest.mark.xfail
def test_gather(results_dir, ref_gather):
runner = CliRunner()