1
|
|
|
from dataclasses import dataclass |
|
|
|
|
2
|
|
|
from typing import Sequence |
3
|
|
|
|
4
|
|
|
from mandos.model.pubchem_api import PubchemApi |
5
|
|
|
from mandos.search.pubchem import PubchemHit, PubchemSearch |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
@dataclass(frozen=True, order=True, repr=True) |
|
|
|
|
9
|
|
|
class DgiHit(PubchemHit): |
10
|
|
|
"""""" |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
class DgiSearch(PubchemSearch[DgiHit]): |
|
|
|
|
14
|
|
|
"""""" |
15
|
|
|
|
16
|
|
|
def __init__(self, key: str, api: PubchemApi): |
|
|
|
|
17
|
|
|
super().__init__(key, api) |
18
|
|
|
|
19
|
|
|
@property |
20
|
|
|
def data_source(self) -> str: |
|
|
|
|
21
|
|
|
return "Drug Gene Interaction Database (DGIdb)" |
22
|
|
|
|
23
|
|
|
def find(self, inchikey: str) -> Sequence[DgiHit]: |
|
|
|
|
24
|
|
|
data = self.api.fetch_data(inchikey) |
25
|
|
|
return [ |
26
|
|
|
DgiHit( |
27
|
|
|
record_id=None, |
28
|
|
|
origin_inchikey=inchikey, |
29
|
|
|
matched_inchikey=data.names_and_identifiers.inchikey, |
30
|
|
|
compound_id=str(data.cid), |
31
|
|
|
compound_name=data.name, |
32
|
|
|
predicate=f"drug/gene interaction", |
|
|
|
|
33
|
|
|
object_id=dd.gene_claim_id, |
34
|
|
|
object_name=dd.gene_name, |
35
|
|
|
search_key=self.key, |
36
|
|
|
search_class=self.search_class, |
37
|
|
|
data_source=self.data_source, |
38
|
|
|
) |
39
|
|
|
for dd in data.biomolecular_interactions_and_pathways.drug_gene_interactions |
40
|
|
|
] |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
__all__ = ["DgiHit", "DgiSearch"] |
44
|
|
|
|