Skip to content

Commit

Permalink
Merge pull request #29 from OpenDrugDiscovery/add_func
Browse files Browse the repository at this point in the history
Merge Add_func branch
  • Loading branch information
FNTwin authored Dec 1, 2023
2 parents 33af696 + 0197dd0 commit 420bdb1
Show file tree
Hide file tree
Showing 18 changed files with 748 additions and 203 deletions.
27 changes: 25 additions & 2 deletions src/openqdc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,32 @@

# Dictionary of objects to lazily import; maps the object's name to its module path

_lazy_imports_obj = {}
_lazy_imports_obj = {
"ANI1": "openqdc.datasets.ani",
"ANI1CCX": "openqdc.datasets.ani",
"ANI1X": "openqdc.datasets.ani",
"Spice": "openqdc.datasets.spice",
"GEOM": "openqdc.datasets.geom",
"QMugs": "openqdc.datasets.qmugs",
"ISO17": "openqdc.datasets.iso_17",
"COMP6": "openqdc.datasets.comp6",
"GDML": "openqdc.datasets.gdml",
"Molecule3D": "openqdc.datasets.molecule3d",
"OrbnetDenali": "openqdc.datasets.orbnet_denali",
"SN2RXN": "openqdc.datasets.sn2_rxn",
"QM7X": "openqdc.datasets.qm7x",
"DESS": "openqdc.datasets.dess",
"NablaDFT": "openqdc.datasets.nabladft",
"SolvatedPeptides": "openqdc.datasets.solvated_peptides",
"WaterClusters": "openqdc.datasets.waterclusters3_30",
"TMQM": "openqdc.datasets.tmqm",
"Dummy": "openqdc.datasets.dummy",
"PCQM_B3LYP": "openqdc.datasets.pcqm",
"PCQM_PM6": "openqdc.datasets.pcqm",
"Transition1X": "openqdc.datasets.transition1x",
}

_lazy_imports_mod = {"datasets": "openqdc.datamodule", "utils": "openqdc.utils"}
_lazy_imports_mod = {"datasets": "openqdc.datasets", "utils": "openqdc.utils"}


def __getattr__(name):
Expand Down
18 changes: 18 additions & 0 deletions src/openqdc/datasets/ani.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class ANI1(BaseDataset):
def root(self):
return p_join(get_local_cache(), "ani")

def __smiles_converter__(self, x):
"""util function to convert string to smiles: useful if the smiles is
encoded in a different format than its display format
"""
return "-".join(x.decode("ascii").split("-")[:-1])

@property
def preprocess_path(self):
path = p_join(self.root, "preprocessed", self.__name__)
Expand Down Expand Up @@ -89,6 +95,12 @@ class ANI1CCX(ANI1):
__force_methods__ = []
force_target_names = []

def __smiles_converter__(self, x):
"""util function to convert string to smiles: useful if the smiles is
encoded in a different format than its display format
"""
return x


class ANI1X(ANI1):
"""
Expand Down Expand Up @@ -145,3 +157,9 @@ class ANI1X(ANI1):

def convert_forces(self, x):
return super().convert_forces(x) * 0.529177249 # correct the Dataset error

def __smiles_converter__(self, x):
"""util function to convert string to smiles: useful if the smiles is
encoded in a different format than its display format
"""
return x
Loading

0 comments on commit 420bdb1

Please sign in to comment.