Skip to content

Commit

Permalink
Merge pull request #24 from cthoyt/resolve-datasets
Browse files Browse the repository at this point in the history
Add dataset resolver around dataset loader class
  • Loading branch information
benedekrozemberczki authored Jan 14, 2022
2 parents 732660a + 2987385 commit ddb47ea
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chemicalx/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from class_resolver import Resolver

from .contextfeatureset import * # noqa:F401,F403
from .drugfeatureset import * # noqa:F401,F403
from .labeledtriples import * # noqa:F401,F403
from .datasetloader import * # noqa:F401,F403
from .drugpairbatch import * # noqa:F401,F403
from .batchgenerator import * # noqa:F401,F403

dataset_resolver = Resolver.from_subclasses(base=DatasetLoader)
21 changes: 21 additions & 0 deletions chemicalx/data/datasetloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
from typing import Dict
from chemicalx.data import DrugFeatureSet, ContextFeatureSet, LabeledTriples

__all__ = [
"DatasetLoader",
"DrugCombDbDatasetLoader",
"DrugCombDatasetLoader",
]


class DatasetLoader:
"""
Expand Down Expand Up @@ -102,3 +108,18 @@ def get_labeled_triples(self):
labeled_triples = LabeledTriples()
labeled_triples.update_from_pandas(raw_data)
return labeled_triples


class DrugCombDbDatasetLoader(DatasetLoader):
"""A dataset loader for `DrugCombDB <http://drugcombdb.denglab.org>`_."""

def __init__(self):
super().__init__("drugcombdb")


# FIXME need reference
class DrugCombDatasetLoader(DatasetLoader):
"""A dataset loader for DrugComb."""

def __init__(self):
super().__init__("drugcomb")

0 comments on commit ddb47ea

Please sign in to comment.