def savingLNKFile(folderName=""): fout = open(folderName + "dataPoints.csv", 'wb') mywriter = csv.writer(fout) mywriter.writerow([ "G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio", "numberOfClusterRounds", "brachingDepth", "bridgingDepth", "msaWidth", "Nbridgenoiseless", "ratioNoiseless", "clusterRounds", "fingerPrint", "clusterRatio" ]) for index in range(5): G, L, p = 50000, 200, 0.015 linter, ltriple = 100, 10 L = L - index * 20 epsilon = 0.05 ### Noisy Compute calculator = numericalCompute.thresholdCompute(p, G) liid, threshold = calculator.findRoot() threshold = threshold - 2 K = int(liid * 1.3) calculator = numericalCompute.Ncompute(G, L, epsilon) Ncov = int(calculator.findRoot()) calculator = numericalCompute.Ncompute(G, L - K, epsilon / 3) NKcov = int(calculator.findRoot()) Nbridge = int(G * math.log(3 / epsilon) / float(L - max(linter, ltriple) - 10)) #N = int ( max(NKcov, Nbridge)*1.5) N = int(max(NKcov, Nbridge) * 1.5) numberOfClusterRounds, brachingDepth, bridgingDepth, msaWidth = 6, liid * 2 / 3, liid * 2 / 3, liid * 2 / 3 ### Noiseless Compute calculator = numericalCompute.Ncompute(G, L, epsilon) Nbridgenoiseless = int(G * math.log(3 / epsilon) / float(L - max(linter, ltriple))) Noiseless = max(Nbridgenoiseless, Ncov) ratioNoiseless = Noiseless / float(Ncov) clusterRounds, fingerPrint, clusterRatio = 2, 6, 1 mywriter.writerow([ G, N, L, p, epsilon, K, liid, threshold, NKcov, Nbridge, Ncov, N / float(Ncov), numberOfClusterRounds, brachingDepth, bridgingDepth, msaWidth, Nbridgenoiseless, ratioNoiseless, clusterRounds, fingerPrint, clusterRatio ]) fout.close()
def savingLNKFile(folderName = ""): fout = open(folderName+ "dataPoints.csv", 'wb') mywriter = csv.writer(fout) mywriter.writerow(["G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio" ,"numberOfClusterRounds","brachingDepth", "bridgingDepth", "msaWidth" , "Nbridgenoiseless", "ratioNoiseless" , "clusterRounds", "fingerPrint", "clusterRatio"]) for index in range(5): G, L, p= 50000, 200, 0.015 linter , ltriple = 100, 10 L = L - index*20 epsilon = 0.05 ### Noisy Compute calculator =numericalCompute.thresholdCompute(p, G) liid , threshold = calculator.findRoot() threshold = threshold - 2 K = int(liid*1.3) calculator = numericalCompute.Ncompute(G,L,epsilon) Ncov = int(calculator.findRoot()) calculator = numericalCompute.Ncompute(G,L- K,epsilon/3) NKcov = int(calculator.findRoot()) Nbridge = int ( G*math.log(3/epsilon)/float(L-max(linter, ltriple) - 10) ) #N = int ( max(NKcov, Nbridge)*1.5) N = int ( max(NKcov, Nbridge)*1.5) numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth = 6 , liid*2/3, liid*2/3 , liid*2/3 ### Noiseless Compute calculator = numericalCompute.Ncompute(G,L,epsilon) Nbridgenoiseless = int ( G*math.log(3/epsilon)/float(L-max(linter, ltriple) ) ) Noiseless = max(Nbridgenoiseless, Ncov) ratioNoiseless = Noiseless/ float(Ncov) clusterRounds, fingerPrint, clusterRatio = 2 , 6 , 1 mywriter.writerow([G, N, L, p, epsilon, K, liid, threshold,NKcov, Nbridge, Ncov, N/float(Ncov),numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth, Nbridgenoiseless,ratioNoiseless,clusterRounds, fingerPrint, clusterRatio]) fout.close()
def savingGenomeSegmentFile(folderName): fin = open(folderName+ "genomeStat.csv", 'r') myreader = csv.reader(fin) dataList = [] firstTime = True for eachrow in myreader: if firstTime: firstTime = False else: dataList.append([int(eachrow[0]), int(eachrow[1]), int(eachrow[2]), int(eachrow[3]), int(eachrow[4]) , int(eachrow[5]), int(eachrow[6])]) fin.close() fout = open(folderName+ "dataPoints.csv", 'wb') mywriter = csv.writer(fout) #mywriter.writerow(["G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio" ,"numberOfClusterRounds","brachingDepth", "bridgingDepth", "msaWidth" , "Nbridgenoiseless", "ratioNoiseless" , "clusterRounds", "fingerPrint", "clusterRatio", "approx repeat", "Lcrit", "approxinter"]) mywriter.writerow(["G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio" ,"numberOfClusterRounds","brachingDepth", "bridgingDepth", "msaWidth" , "Nbridgenoiseless", "ratioNoiseless" , "clusterRounds", "fingerPrint", "clusterRatio", "startIndex", "endIndex", "approxinter"]) for index in range(len(dataList)): linter , ltriple = dataList[index][3], dataList[index][4] G, L, p= dataList[index][1] - dataList[index][0], dataList[index][5], 0.015 epsilon = 0.05 ### Noisy Compute calculator =numericalCompute.thresholdCompute(p, G) liid , threshold = calculator.findRoot() #K = liid*2 K = 600 calculator = numericalCompute.Ncompute(G,L,epsilon) Ncov = int(calculator.findRoot()) calculator = numericalCompute.Ncompute(G,L- liid,epsilon) NKcov = int(calculator.findRoot()) Nbridge = int ( G*math.log(9/epsilon)/float(L-max(linter, ltriple) - liid) ) N = max(NKcov, Nbridge) #numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth = 6 , liid*1/3, liid*1/3 , liid*2/3 numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth = 6 , liid*2/3, liid*2/3 , liid*2/3 ### Noiseless Compute calculator = numericalCompute.Ncompute(G,L,epsilon) Nbridgenoiseless = int ( G*math.log(3/epsilon)/float(L-max(linter, ltriple) ) ) Noiseless = max(Nbridgenoiseless, Ncov) ratioNoiseless = Noiseless/ float(Ncov) clusterRounds, fingerPrint, clusterRatio = 2 , 6 , 1 #mywriter.writerow([G, N, L, p, epsilon, K, liid, threshold,NKcov, Nbridge, Ncov, N/float(Ncov),numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth, Nbridgenoiseless,ratioNoiseless,clusterRounds, fingerPrint, clusterRatio,dataList[index][2], dataList[index][3] ,dataList[index][6]]) mywriter.writerow([G, N, L, p, epsilon, K, liid, threshold,NKcov, Nbridge, Ncov, N/float(Ncov),numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth, Nbridgenoiseless,ratioNoiseless,clusterRounds, fingerPrint, clusterRatio,dataList[index][0], dataList[index][1] ,dataList[index][6]]) fout.close()
def savingGenomeSegmentFile(folderName): fin = open(folderName + "genomeStat.csv", 'r') myreader = csv.reader(fin) dataList = [] firstTime = True for eachrow in myreader: if firstTime: firstTime = False else: dataList.append([ int(eachrow[0]), int(eachrow[1]), int(eachrow[2]), int(eachrow[3]), int(eachrow[4]), int(eachrow[5]), int(eachrow[6]) ]) fin.close() fout = open(folderName + "dataPoints.csv", 'wb') mywriter = csv.writer(fout) #mywriter.writerow(["G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio" ,"numberOfClusterRounds","brachingDepth", "bridgingDepth", "msaWidth" , "Nbridgenoiseless", "ratioNoiseless" , "clusterRounds", "fingerPrint", "clusterRatio", "approx repeat", "Lcrit", "approxinter"]) mywriter.writerow([ "G", "N", "L", "p", "epsilon", "K", "liid", "threshold", "NKcov", "Nbridge", "Ncov", "Nratio", "numberOfClusterRounds", "brachingDepth", "bridgingDepth", "msaWidth", "Nbridgenoiseless", "ratioNoiseless", "clusterRounds", "fingerPrint", "clusterRatio", "startIndex", "endIndex", "approxinter" ]) for index in range(len(dataList)): linter, ltriple = dataList[index][3], dataList[index][4] G, L, p = dataList[index][1] - dataList[index][0], dataList[index][ 5], 0.015 epsilon = 0.05 ### Noisy Compute calculator = numericalCompute.thresholdCompute(p, G) liid, threshold = calculator.findRoot() #K = liid*2 K = 600 calculator = numericalCompute.Ncompute(G, L, epsilon) Ncov = int(calculator.findRoot()) calculator = numericalCompute.Ncompute(G, L - liid, epsilon) NKcov = int(calculator.findRoot()) Nbridge = int(G * math.log(9 / epsilon) / float(L - max(linter, ltriple) - liid)) N = max(NKcov, Nbridge) #numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth = 6 , liid*1/3, liid*1/3 , liid*2/3 numberOfClusterRounds, brachingDepth, bridgingDepth, msaWidth = 6, liid * 2 / 3, liid * 2 / 3, liid * 2 / 3 ### Noiseless Compute calculator = numericalCompute.Ncompute(G, L, epsilon) Nbridgenoiseless = int(G * math.log(3 / epsilon) / float(L - max(linter, ltriple))) Noiseless = max(Nbridgenoiseless, Ncov) ratioNoiseless = Noiseless / float(Ncov) clusterRounds, fingerPrint, clusterRatio = 2, 6, 1 #mywriter.writerow([G, N, L, p, epsilon, K, liid, threshold,NKcov, Nbridge, Ncov, N/float(Ncov),numberOfClusterRounds,brachingDepth,bridgingDepth,msaWidth, Nbridgenoiseless,ratioNoiseless,clusterRounds, fingerPrint, clusterRatio,dataList[index][2], dataList[index][3] ,dataList[index][6]]) mywriter.writerow([ G, N, L, p, epsilon, K, liid, threshold, NKcov, Nbridge, Ncov, N / float(Ncov), numberOfClusterRounds, brachingDepth, bridgingDepth, msaWidth, Nbridgenoiseless, ratioNoiseless, clusterRounds, fingerPrint, clusterRatio, dataList[index][0], dataList[index][1], dataList[index][6] ]) fout.close()