-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDataloader.py
More file actions
39 lines (35 loc) · 1.2 KB
/
Dataloader.py
File metadata and controls
39 lines (35 loc) · 1.2 KB
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
29
30
31
32
33
34
35
36
37
38
39
import os
try:
print('SlURM_JOB_ID',os.environ["SLURM_JOB_ID"])
except:
print("no slurm id")
import matplotlib
matplotlib.use('agg')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import tensorflow.keras as K
import tables
import gc
import argparse
import scipy
tf.keras.backend.set_epsilon(0.0000001)
def get_data_GE(datapath, setname, fold):
ytest = pd.read_csv(datapath + "y" + str(setname) + "_" + gt_name + "_"+str(fold)+".csv")
h5file = tables.open_file(datapath + "GeneExpression.h5", "r")
ybatch = ytest["labels"]
xbatchid = np.array(ytest["row"].values, dtype=np.int64)
xbatch = h5file.root.data[xbatchid, :]
ybatch = np.reshape(np.array(ybatch), (-1, 1))
h5file.close()
return (xbatch, ybatch)
def get_data_ME(datapath, setname, fold):
ytest = pd.read_csv(datapath + "y" + str(setname) + "_" + gt_name + "_"+str(fold)+".csv")
h5file = tables.open_file(datapath + "Methylation.h5", "r")
ybatch = ytest["labels"]
xbatchid = np.array(ytest["row"].values, dtype=np.int64)
xbatch = h5file.root.data[xbatchid, :]
ybatch = np.reshape(np.array(ybatch), (-1, 1))
h5file.close()
return (xbatch, ybatch)