-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring #38
Merged
Merged
Refactoring #38
Changes from 23 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4bfb1c1
Updated dummy dataset
862dc60
ran pre-commit on dummy
f8a6f0f
Download and upload progress. No init method
c159603
Basic versioning, refactor src->openqdc, updated .toml
77acba2
__init__.py clean
8b54153
black + isort
e6995a7
DES fix, base utilies, CLI
2a06637
mkdocs dependency + fix
5e179d0
Tutorial update + mkdocs fix
caf4976
Updated readme
984e971
ruff .
ef8264a
Fix cli multiple option
b96158f
Upgraded to black>=24, fixed import tests, cleaning, gh action lint w…
bc49b9d
pre-commit check
cedf344
Removed TypeAlias for compatibility with py3.9
77f2051
First shot at improved docstrings
79d62a2
Updated Readme, Docstrings datasets and small additions notebook
3e7c6e9
revert naming AVAILABLE_DATASETS
b2e9100
Pleasing isort / pre-commit
534232a
Fixes wrong isort - likely due to phasing out src directory
a610870
isort fixes
d695cde
Fixes 5min timeout issue when downloading large datasets
9b70b84
Merge pull request #39 from OpenDrugDiscovery/docstring_enhancements
FNTwin 0dd2184
Refactored into potential and interaction
817bbed
Cli test
e03c6b1
WIP
f394953
Merge branch 'develop' into minor_fixes
362d0f4
Correct units for Transition1X
8ca966a
Merge branch 'refactoring' into minor_fixes
088d457
Merge pull request #34 from OpenDrugDiscovery/minor_fixes
FNTwin 1e6652f
Cli docs + readme
b297cef
Merge branch 'refactoring' of https://github.com/OpenDrugDiscovery/op…
56d1d1b
Cli update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
try: | ||
from importlib.metadata import PackageNotFoundError, version | ||
except ModuleNotFoundError: | ||
# Try backported to PY<38 `importlib_metadata`. | ||
from importlib_metadata import PackageNotFoundError, version | ||
|
||
try: | ||
__version__ = version("openqdc") | ||
except PackageNotFoundError: | ||
# package is not installed | ||
__version__ = "dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from typing import List, Optional | ||
|
||
import typer | ||
from loguru import logger | ||
from prettytable import PrettyTable | ||
from typing_extensions import Annotated | ||
|
||
from openqdc import AVAILABLE_DATASETS | ||
from openqdc.raws.config_factory import DataConfigFactory | ||
from openqdc.raws.fetch import DataDownloader | ||
|
||
app = typer.Typer(help="OpenQDC CLI") | ||
|
||
|
||
def exist_dataset(dataset): | ||
if dataset not in AVAILABLE_DATASETS: | ||
logger.error(f"{dataset} is not available. Please open an issue on Github for the team to look into it.") | ||
return False | ||
return True | ||
|
||
|
||
@app.command() | ||
def download( | ||
datasets: List[str], | ||
overwrite: Annotated[ | ||
bool, | ||
typer.Option( | ||
help="Whether to overwrite the datasets", | ||
), | ||
] = False, | ||
cache_dir: Annotated[ | ||
Optional[str], | ||
typer.Option( | ||
help="Path to cache directory", | ||
), | ||
] = None, | ||
): | ||
""" | ||
Download preprocessed datasets from openQDC. | ||
""" | ||
for dataset in list(map(lambda x: x.lower().replace("_", ""), datasets)): | ||
if exist_dataset(dataset): | ||
if AVAILABLE_DATASETS[dataset].no_init().is_cached() and not overwrite: | ||
logger.info(f"{dataset} is already cached. Skipping download") | ||
else: | ||
AVAILABLE_DATASETS[dataset](overwrite_local_cache=True, cache_dir=cache_dir) | ||
|
||
|
||
@app.command() | ||
def datasets(): | ||
""" | ||
Print the available datasets. | ||
""" | ||
table = PrettyTable(["Name", "Forces", "Level of theory"]) | ||
for dataset in AVAILABLE_DATASETS: | ||
empty_dataset = AVAILABLE_DATASETS[dataset].no_init() | ||
has_forces = False if not empty_dataset.__force_methods__ else True | ||
table.add_row([dataset, has_forces, ",".join(empty_dataset.__energy_methods__)]) | ||
table.align = "l" | ||
print(table) | ||
|
||
|
||
@app.command() | ||
def fetch(datasets: List[str]): | ||
""" | ||
Download the raw datasets files from openQDC. | ||
""" | ||
if datasets[0] == "all": | ||
dataset_names = DataConfigFactory.available_datasets | ||
|
||
for dataset_name in dataset_names: | ||
dd = DataDownloader() | ||
dd.from_name(dataset_name) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from .base import BaseDataset # noqa | ||
from .interaction import DES # noqa | ||
from .potential.ani import ANI1, ANI1CCX, ANI1X # noqa | ||
from .potential.comp6 import COMP6 # noqa | ||
from .potential.dummy import Dummy # noqa | ||
from .potential.gdml import GDML # noqa | ||
from .potential.geom import GEOM # noqa | ||
from .potential.iso_17 import ISO17 # noqa | ||
from .potential.molecule3d import Molecule3D # noqa | ||
from .potential.nabladft import NablaDFT # noqa | ||
from .potential.orbnet_denali import OrbnetDenali # noqa | ||
from .potential.pcqm import PCQM_B3LYP, PCQM_PM6 # noqa | ||
from .potential.qm7x import QM7X # noqa | ||
from .potential.qmugs import QMugs # noqa | ||
from .potential.sn2_rxn import SN2RXN # noqa | ||
from .potential.solvated_peptides import SolvatedPeptides # noqa | ||
from .potential.spice import Spice # noqa | ||
from .potential.tmqm import TMQM # noqa | ||
from .potential.transition1x import Transition1X # noqa | ||
from .potential.waterclusters3_30 import WaterClusters # noqa | ||
|
||
AVAILABLE_DATASETS = { | ||
"ani1": ANI1, | ||
"ani1ccx": ANI1CCX, | ||
"ani1x": ANI1X, | ||
"comp6": COMP6, | ||
"des": DES, | ||
"gdml": GDML, | ||
"geom": GEOM, | ||
"iso17": ISO17, | ||
"molecule3d": Molecule3D, | ||
"nabladft": NablaDFT, | ||
"orbnetdenali": OrbnetDenali, | ||
"pcqmb3lyp": PCQM_B3LYP, | ||
"pcqmpm6": PCQM_PM6, | ||
"qm7x": QM7X, | ||
"qmugs": QMugs, | ||
"sn2rxn": SN2RXN, | ||
"solvatedpeptides": SolvatedPeptides, | ||
"spice": Spice, | ||
"tmqm": TMQM, | ||
"transition1x": Transition1X, | ||
"watercluster": WaterClusters, | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the documentation so the help can tell the user more info about the arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Typer has also --help for the subcommands, I will make it more clear in the readme.