File size: 915 Bytes
6d1bbc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""ML baseline models for DTI binary prediction.

Requires torch (install with `pip install negbiodb[ml]`).
"""

__all__ = ["DeepDTA", "GraphDTA", "DrugBAN"]


def __getattr__(name: str):
    if name in ("DeepDTA", "GraphDTA", "DrugBAN"):
        try:
            import torch  # noqa: F401
        except ImportError as e:
            raise ImportError(
                f"negbiodb.models.{name} requires torch. "
                "Install with: pip install negbiodb[ml]"
            ) from e
        if name == "DeepDTA":
            from negbiodb.models.deepdta import DeepDTA
            return DeepDTA
        if name == "GraphDTA":
            from negbiodb.models.graphdta import GraphDTA
            return GraphDTA
        if name == "DrugBAN":
            from negbiodb.models.drugban import DrugBAN
            return DrugBAN
    raise AttributeError(f"module 'negbiodb.models' has no attribute {name!r}")