コード例 #1
0
inpv = list(inp["values"])
pathv = list(path["values"])
outv = list(out["values"])

#output_faultless dataframe
cols = ["input"] + list(out["proteins"])
output_fl = pd.DataFrame(columns=cols)

#pathway_faultless dataframe
path_fl = pd.DataFrame(columns=["proteins", "values"])
path_fl.Proteins = path["proteins"]

#output vector for each input combination
i = 0
while True:
    pth.pathway([0], inpv, pathv, outv)
    output_fl.loc[i, "input"] = ' '.join(map(str, inpv))
    if i == 0:
        path_fl["values"] = pathv
    if outv == [0] * len(out.index):
        unq = list(map(int, (output_fl.loc[i, "input"]).split(" ")))
    output_fl.iloc[i, 1:] = outv
    inpv = cmb.combination(inpv)
    if inpv == False:
        break
    i = i + 1

#write to .csv file
output_fl.to_csv("outs/output_fl.csv")

#write unique_input_vector to file
コード例 #2
0
out = pd.read_csv("ins/out.csv", delimiter=",", index_col=0)
inp["values"] = [0] * len(inp.index)
path["values"] = [0] * len(path.index)
out["values"] = [0] * len(out.index)

#input,pathway and output vectors
f = open("outs/output_unq.txt", "r")
unq = f.readline()
unq = list(map(int, unq.split(" ")))
inpv = unq
pathv = list(path["values"])
outv = list(out["values"])

#output_double_fault dataframe
output_2f = pd.DataFrame(columns=["output proteins"])
output_2f["output proteins"] = out["proteins"]

start_time = time.clock()
#executing BN at ith gate
for i in range(1, 28):
    for j in range(i + 1, 28):
        pth.pathway([i, j], inpv, pathv, outv)
        output_2f[str(i) + "," + str(j)] = outv
        inpv = unq

print("Execution time: ", "%0.3f" % (time.clock() - start_time), " seconds")

#print(output_2f)

#write to .csv file
output_2f.to_csv("outs/output_2f.csv")
コード例 #3
0
out["values"] = [0] * len(out.index)

#input,pathway and output vectors
f = open("outs/output_unq.txt", "r")
unq = f.readline()
unq = list(map(int, unq.split(" ")))
inpv = unq
pathv = list(path["values"])
outv = list(out["values"])

#output_double_fault dataframe
output_4f = pd.DataFrame(columns=["output proteins"])
output_4f["output proteins"] = out["proteins"]

start_time = time.clock()
#executing BN at ith gate
for i in range(1, 28):
    for j in range(i + 1, 28):
        for k in range(j + 1, 28):
            for l in range(k + 1, 28):
                pth.pathway([i, j, k, l], inpv, pathv, outv)
                output_4f[str(i) + "," + str(j) + "," + str(k) + "," +
                          str(l)] = outv
                inpv = unq
    print("Combinations of " + str(i) + " ends.")

print("Execution time: ", "%0.3f" % (time.clock() - start_time), " seconds")
#print(output_4f)

#write to .csv file
output_4f.to_csv("outs/output_4f.csv")