Skip to content

Commit 26284b9

Browse files
Merge pull request #18 from cthoyt/model-resolver
Add base model and implement model class resolution
2 parents 99f3773 + 0aca694 commit 26284b9

17 files changed

+183
-42
lines changed

chemicalx/models/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
from class_resolver import Resolver # noqa:F401,F403
2+
13
from .audnnsynergy import * # noqa:F401,F403
4+
from .base import Model # noqa:F401,F403
25
from .caster import * # noqa:F401,F403
36
from .deepcci import * # noqa:F401,F403
47
from .deepddi import * # noqa:F401,F403
@@ -12,3 +15,5 @@
1215
from .mhcaddi import * # noqa:F401,F403
1316
from .mrgnn import * # noqa:F401,F403
1417
from .ssiddi import * # noqa:F401,F403
18+
19+
model_resolver = Resolver.from_subclasses(base=Model)

chemicalx/models/audnnsynergy.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
class AUDNNSynergy:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"AUDNNSynergy",
5+
]
6+
7+
8+
class AUDNNSynergy(Model):
9+
pass

chemicalx/models/base.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Base classes for models and utilities."""
2+
3+
__all__ = [
4+
"Model",
5+
]
6+
7+
8+
class Model:
9+
"""The base class for ChemicalX models."""
10+
11+
def __init__(self, x: int):
12+
self.x = x

chemicalx/models/caster.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class CASTER:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"CASTER",
5+
]
6+
7+
8+
class CASTER(Model):
9+
"""An implementation of the CASTER model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/15
12+
"""

chemicalx/models/deepcci.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DeepCCI:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DeepCCI",
5+
]
6+
7+
8+
class DeepCCI(Model):
9+
"""An implementation of the DeepCCI model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/1
12+
"""

chemicalx/models/deepddi.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DeepDDI:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DeepDDI",
5+
]
6+
7+
8+
class DeepDDI(Model):
9+
"""An implementation of the DeepDDI model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/2
12+
"""

chemicalx/models/deepdds.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DeepDDS:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DeepDDS",
5+
]
6+
7+
8+
class DeepDDS(Model):
9+
"""An implementation of the DeepDDS model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/19
12+
"""

chemicalx/models/deepdrug.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DeepDrug:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DeepDrug",
5+
]
6+
7+
8+
class DeepDrug(Model):
9+
"""An implementation of the DeepDrug model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/14
12+
"""

chemicalx/models/deepsynergy.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DeepSynergy:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DeepSynergy",
5+
]
6+
7+
8+
class DeepSynergy(Model):
9+
"""An implementation of the DeepSynergy model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/16
12+
"""

chemicalx/models/dpddi.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class DPDDI:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"DPDDI",
5+
]
6+
7+
8+
class DPDDI(Model):
9+
"""An implementation of the DPDDI model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/20
12+
"""

chemicalx/models/epgcnds.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class EPGCNDS:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"EPGCNDS",
5+
]
6+
7+
8+
class EPGCNDS(Model):
9+
"""An implementation of the EPGCNDS model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/22
12+
"""

chemicalx/models/gcnbmp.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class GCNBMP:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"GCNBMP",
5+
]
6+
7+
8+
class GCNBMP(Model):
9+
"""An implementation of the GCNBMP model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/21
12+
"""

chemicalx/models/matchmaker.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class MatchMaker:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"MatchMaker",
5+
]
6+
7+
8+
class MatchMaker(Model):
9+
"""An implementation of the MatchMaker model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/23
12+
"""

chemicalx/models/mhcaddi.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class MHCADDI:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"MHCADDI",
5+
]
6+
7+
8+
class MHCADDI(Model):
9+
"""An implementation of the MHCADDI model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/13
12+
"""

chemicalx/models/mrgnn.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class MRGNN:
2-
def __init__(self, x: int):
3-
self.x = 2
1+
from .base import Model
2+
3+
__all__ = [
4+
"MRGNN",
5+
]
6+
7+
8+
class MRGNN(Model):
9+
"""An implementation of the MR-GNN model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/12
12+
"""

chemicalx/models/ssiddi.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
class SSIDDI:
2-
def __init__(self, x: int):
3-
self.x = x
1+
from .base import Model
2+
3+
__all__ = [
4+
"SSIDDI",
5+
]
6+
7+
8+
class SSIDDI(Model):
9+
"""An implementation of the SSI-DDI model.
10+
11+
.. seealso:: https://github.com/AstraZeneca/chemicalx/issues/11
12+
"""

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"tqdm",
1111
"six",
1212
"scikit-learn",
13+
"class-resolver",
1314
]
1415

1516

0 commit comments

Comments
 (0)