jobman = JobManager(settings)

# Read data into program
# Where the format is "FILENAME" "DATATYPE"
c4d = ReadData("datasets/German_Data/Caldana-4d.tsv", "dex")
c4l = ReadData("datasets/German_Data/Caldana-4L.tsv", "dex")
c21d = ReadData("datasets/German_Data/Caldana-21d.tsv", "dex")
c21hl = ReadData("datasets/German_Data/Caldana-21HL.tsv", "dex")
c21l = ReadData("datasets/German_Data/Caldana-21L.tsv", "dex")
c21ll = ReadData("datasets/German_Data/Caldana-21LL.tsv", "dex")
c32l = ReadData("datasets/German_Data/Caldana-32L.tsv", "dex")
c32l2 = ReadData("datasets/German_Data/Caldana-32L2.tsv", "dex")

combined = ReadData("datasets/German_Data/Caldana-4d.tsv", "dex")

c21l.experiments = c21l.experiments[1:]

#settings["global"]["time_series_delta_t"] = [5,10,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,320,340,360,640,1280]
settings["global"]["time_series_delta_t"] = [5,10,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,320,340,360,640,1280]
#settings["global"]["time_series_delta_t"] = settings["global"]["time_series_delta_t"][:-remove]

ts_storage = [c4d, c4l, c21d, c21hl, c21l, c21ll, c32l, c32l2]
ts_storage = [c21l, c21ll, c21d, c21hl]
#for dataset in ts_storage:
    #dataset.experiments = dataset.experiments[:-remove]


#ts_storage = [c4l, c21l, c21l]

tfs = c4d.gene_list
pert_data["multifactorial_data"] = ReadData(exp_data_directory + "/" + exp_set + "/" + '/TS/' + multifactorial_filename, "multifactorial")
pert_data["knockout_data"] = ReadData(exp_data_directory + "/" + exp_set + "/" + '/TS/' + knockout_filename, "knockout")


goldnet = Network()
goldnet.read_goldstd(ts_pert_data["goldnet_file"])

######################
# Clip down the pert data so it is the correct size for the exp
######################
# This is the num for everything to use
ts_only_data["timeseries"] = [ts_only_data["timeseries"][0]]

ts_data_num_exp = len(ts_only_data["timeseries"]) * len(ts_only_data["timeseries"][0].experiments)

ts_only_data["multifactorial_data"].experiments = ts_only_data["multifactorial_data"].experiments[0:len(ts_only_data["multifactorial_data"].experiments) - ts_data_num_exp]

ts_pert_data["timeseries"] = ts_pert_data["timeseries"][0:len(ts_pert_data["timeseries"]) / 2]

num_ts_pert = len(ts_pert_data["timeseries"]) * len(ts_pert_data["timeseries"][0].experiments)

ts_pert_data["multifactorial_data"].experiments = ts_pert_data["multifactorial_data"].experiments[0:ts_data_num_exp - num_ts_pert]


print len(ts_pert_data["multifactorial_data"].experiments)
print len(ts_pert_data["timeseries"])

total_exp = len(ts_pert_data["multifactorial_data"].experiments) + len(ts_pert_data["timeseries"]) * len(ts_pert_data["timeseries"][0].experiments)

pert_data["multifactorial_data"].experiments = pert_data["multifactorial_data"].experiments[0:ts_data_num_exp]
pert_data["multifactorial_data"] = ReadData(exp_data_directory + "/" + exp_set + "/" + '/TS/' + multifactorial_filename, "multifactorial")

goldnet = Network()
goldnet.read_goldstd(ts_pert_data["goldnet_file"])

######################
# Clip down the pert data so it is the correct size for the exp
######################
# This is the num for everything to use
ts_data_num_exp = len(ts_only_data["timeseries"]) * len(ts_only_data["timeseries"][0].experiments)

ts_pert_data["timeseries"] = ts_pert_data["timeseries"][0:len(ts_pert_data["timeseries"]) / 2]

num_ts_pert = len(ts_pert_data["timeseries"]) * len(ts_pert_data["timeseries"][0].experiments)

ts_pert_data["multifactorial_data"].experiments = ts_pert_data["multifactorial_data"].experiments[0:ts_data_num_exp - num_ts_pert]


print len(ts_pert_data["multifactorial_data"].experiments)
print len(ts_pert_data["timeseries"])

total_exp = len(ts_pert_data["multifactorial_data"].experiments) + len(ts_pert_data["timeseries"]) * len(ts_pert_data["timeseries"][0].experiments)

pert_data["multifactorial_data"].experiments = pert_data["multifactorial_data"].experiments[0:ts_data_num_exp]

print ts_data_num_exp
print total_exp


# Initialize settings file
settings = {}