Skip to content

Commit

Permalink
Merge pull request #39 from RMeli/cache
Browse files Browse the repository at this point in the history
Expose structures cache from CLI
  • Loading branch information
RMeli committed Jul 17, 2022
2 parents 1c159e1 + 65454ed commit 0df9d8e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
7 changes: 7 additions & 0 deletions gninatorch/gnina.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ def options(args: Optional[List[str]] = None):
help=".molcache2 file for receptors",
)

parser.add_argument(
"--no_cache",
action="store_false",
help="Disable structure caching",
dest="cache_structures",
)

return parser.parse_args(args)


Expand Down
6 changes: 6 additions & 0 deletions gninatorch/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def options(args: Optional[List[str]] = None):
help="Disable CSV output",
dest="csv",
)
parser.add_argument(
"--no_cache",
action="store_false",
help="Disable structure caching",
dest="cache_structures",
)

return parser.parse_args(args)

Expand Down
4 changes: 2 additions & 2 deletions gninatorch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setup_example_provider(
stratify_max=args.stratify_max,
stratify_min=args.stratify_min,
stratify_step=args.stratify_step,
cache_structs=True,
cache_structs=args.cache_structures,
)
else:
# Use command line option for training
Expand All @@ -66,7 +66,7 @@ def setup_example_provider(
ligmolcache=args.ligmolcache,
recmolcache=args.recmolcache,
stratify_receptor=False,
cache_structs=True,
cache_structs=args.cache_structures,
)

example_provider.populate(examples_file)
Expand Down
7 changes: 7 additions & 0 deletions gninatorch/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ def options(args: Optional[List[str]] = None):
dest="roc_auc",
)

parser.add_argument(
"--no_cache",
action="store_false",
help="Disable structure caching",
dest="cache_structures",
)

parser.add_argument("-s", "--seed", type=int, default=None, help="Random seed")
parser.add_argument("--silent", action="store_true", help="No console output")

Expand Down
10 changes: 10 additions & 0 deletions tests/test_gnina.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
import torch

import gninatorch
from gninatorch import gnina, models
from gninatorch.dataloaders import GriddedExamplesLoader

Expand Down Expand Up @@ -318,3 +319,12 @@ def test_gnina_ensemble(
assert np.allclose(1 - score, 1 - CNNscore, atol=1e-6)
assert np.allclose(affinity, CNNaffinity, atol=1e-6)
assert np.allclose(1 - variance, 1 - CNNvariance, atol=1e-6)


def test_header(capsys):
gnina._header()

captured = capsys.readouterr()

assert gninatorch.__version__ in captured.out
assert gninatorch.__git_revision__ in captured.out

0 comments on commit 0df9d8e

Please sign in to comment.