|
|
|
|
|
|
|
|
import torch.nn.functional as F |
|
|
import torch.nn.functional as F |
|
|
import os |
|
|
import os |
|
|
import sys |
|
|
import sys |
|
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
PROJ_DIR = os.path.dirname(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))) |
|
|
PROJ_DIR = os.path.dirname(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from drug.models import GCN |
|
|
from drug.models import GCN |
|
|
from drug.datasets import DDInteractionDataset |
|
|
from drug.datasets import DDInteractionDataset |
|
|
from model.utils import get_FP_by_negative_index |
|
|
from model.utils import get_FP_by_negative_index |
|
|
|
|
|
from const import Drug2FP_FILE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super(Connector, self).__init__() |
|
|
super(Connector, self).__init__() |
|
|
# self.ddiDataset = DDInteractionDataset(gpu_id = gpu_id) |
|
|
# self.ddiDataset = DDInteractionDataset(gpu_id = gpu_id) |
|
|
self.gcn = None |
|
|
self.gcn = None |
|
|
|
|
|
self.drug2FP_df = pd.read_csv(Drug2FP_FILE) |
|
|
|
|
|
|
|
|
#Cell line features |
|
|
#Cell line features |
|
|
# np.load('cell_feat.npy') |
|
|
# np.load('cell_feat.npy') |
|
|
|
|
|
|
|
|
drug2_feat = drug2_feat.cuda(self.gpu_id) |
|
|
drug2_feat = drug2_feat.cuda(self.gpu_id) |
|
|
for i, x in enumerate(drug1_idx): |
|
|
for i, x in enumerate(drug1_idx): |
|
|
if x < 0: |
|
|
if x < 0: |
|
|
drug1_feat[i] = get_FP_by_negative_index(x) |
|
|
|
|
|
|
|
|
drug1_feat[i] = get_FP_by_negative_index(x,self.drug2FP_df) |
|
|
for i, x in enumerate(drug2_idx): |
|
|
for i, x in enumerate(drug2_idx): |
|
|
if x < 0: |
|
|
if x < 0: |
|
|
drug2_feat[i] = get_FP_by_negative_index(x) |
|
|
|
|
|
|
|
|
drug2_feat[i] = get_FP_by_negative_index(x,self.drug2FP_df) |
|
|
feat = torch.cat([drug1_feat, drug2_feat, cell_feat], 1) |
|
|
feat = torch.cat([drug1_feat, drug2_feat, cell_feat], 1) |
|
|
return feat |
|
|
return feat |
|
|
|
|
|
|