Skip to content

Commit

Permalink
Merge pull request #27 from OpenFreeEnergy/fix_stdout_mushing
Browse files Browse the repository at this point in the history
Fix stdout mushing with analysis command
  • Loading branch information
richardjgowers authored Nov 22, 2023
2 parents c0059c3 + 75d8af5 commit 75bd87f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test = [
"Homepage" = "https://github.com/OpenFreeEnergy/openfe_analysis"

[project.scripts]
openfe_analysis = "openfe_analysis.cli:main"
openfe_analysis = "openfe_analysis.cli:cli"

[tool.versioningit]
default-version = "1+unknown"
Expand Down
16 changes: 13 additions & 3 deletions src/openfe_analysis/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
from . import rmsd


@click.command
@click.group()
def cli():
pass


@cli.command(name="RFE_analysis")
@click.argument('loc', type=click.Path(exists=True,
readable=True,
file_okay=False,
dir_okay=True,
path_type=pathlib.Path))
def main(loc):
@click.argument('output', type=click.Path(writable=True,
dir_okay=False,
path_type=pathlib.Path))
def rfe_analysis(loc, output):
pdb = loc / "hybrid_system.pdb"
trj = loc / "simulation.nc"

data = rmsd.gather_rms_data(pdb, trj)
click.echo(json.dumps(data))

with click.open_file(output, 'w') as f:
f.write(json.dumps(data))

0 comments on commit 75bd87f

Please sign in to comment.