Browse Source

feat: stable

main
Taha Mohammadzadeh 11 months ago
parent
commit
12bd73e3e3
4 changed files with 11 additions and 7 deletions
  1. 1
    1
      DeepDRA.py
  2. 0
    1
      data_loader.py
  3. 9
    4
      main.py
  4. 1
    1
      utils.py

+ 1
- 1
DeepDRA.py View File

mlp_loss_val = mlp_weight * mlp_loss_fn(mlp_output_val, val_target) mlp_loss_val = mlp_weight * mlp_loss_fn(mlp_output_val, val_target)


# Total loss is the sum of autoencoder losses and MLP loss # Total loss is the sum of autoencoder losses and MLP loss
total_val_loss = drug_ae_loss_val + cell_ae_loss_val + mlp_loss_val
total_val_loss = (drug_ae_loss_val + cell_ae_loss_val + mlp_loss_val).item()


# Calculate accuracy # Calculate accuracy
val_predictions = torch.round(mlp_output_val) val_predictions = torch.round(mlp_output_val)

+ 0
- 1
data_loader.py View File

df.columns = df.columns.str.replace('_cell_mut', '') df.columns = df.columns.str.replace('_cell_mut', '')
df.columns = df.columns.str.replace('_cell_CN', '') df.columns = df.columns.str.replace('_cell_CN', '')
df.columns = df.columns.str.replace('_cell_exp', '') df.columns = df.columns.str.replace('_cell_exp', '')

df = (df - df.min()) / (df.max() - df.min()) df = (df - df.min()) / (df.max() - df.min())
df = df.fillna(0) df = df.fillna(0)
if intersect: if intersect:

+ 9
- 4
main.py View File



# Step 2: Load training data # Step 2: Load training data
train_data, train_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES, train_data, train_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES,
raw_file_directory=GDSC_RAW_DATA_FOLDER,
screen_file_directory=GDSC_SCREENING_DATA_FOLDER,
raw_file_directory=RAW_BOTH_DATA_FOLDER,
screen_file_directory=BOTH_SCREENING_DATA_FOLDER,
sep="\t") sep="\t")




if is_test: if is_test:
test_data, test_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES, test_data, test_drug_screen = RawDataLoader.load_data(data_modalities=DATA_MODALITIES,
raw_file_directory=CCLE_RAW_DATA_FOLDER, raw_file_directory=CCLE_RAW_DATA_FOLDER,
screen_file_directory=CTRP_SCREENING_DATA_FOLDER,
screen_file_directory=CCLE_SCREENING_DATA_FOLDER,
sep="\t") sep="\t")
train_data, test_data = RawDataLoader.data_features_intersect(train_data, test_data) train_data, test_data = RawDataLoader.data_features_intersect(train_data, test_data)


# common_columns = list(set(train_drug_screen.columns) & set(test_drug_screen.columns))
#
# train_drug_screen.drop(common_columns[1:100], axis=1, inplace=True)
# test_drug_screen = test_drug_screen[common_columns[1:100]]



# Step 4: Prepare input data for training # Step 4: Prepare input data for training
x_cell_train, x_drug_train, y_train, cell_sizes, drug_sizes = RawDataLoader.prepare_input_data(train_data, x_cell_train, x_drug_train, y_train, cell_sizes, drug_sizes = RawDataLoader.prepare_input_data(train_data,
torch.manual_seed(RANDOM_SEED) torch.manual_seed(RANDOM_SEED)
random.seed(RANDOM_SEED) random.seed(RANDOM_SEED)
np.random.seed(RANDOM_SEED) np.random.seed(RANDOM_SEED)
run(30, is_test=False)
run(10, is_test=True)

+ 1
- 1
utils.py View File

SAVE_MODEL = False # Change it to True to save the trained model SAVE_MODEL = False # Change it to True to save the trained model
VARIATIONAL_AUTOENCODERS = False VARIATIONAL_AUTOENCODERS = False
# DATA_MODALITIES=['cell_CN','cell_exp','cell_methy','cell_mut','drug_comp','drug_DT'] # Change this list to only consider specific data modalities # DATA_MODALITIES=['cell_CN','cell_exp','cell_methy','cell_mut','drug_comp','drug_DT'] # Change this list to only consider specific data modalities
DATA_MODALITIES = ['cell_exp', 'drug_desc','drug_finger']
DATA_MODALITIES = ['cell_CN','cell_exp','cell_methy','cell_mut', 'drug_desc','drug_finger']
RANDOM_SEED = 42 # Must be used wherever can be used RANDOM_SEED = 42 # Must be used wherever can be used





Loading…
Cancel
Save