Beispiel #1
0
def multipleTesting(folderName, mummerLink, option):
	print "Experiments : "
		
	header = "/data/kakitone/May07-2015/workingMetaFinisherSC/"

	os.system("mkdir "+ header + folderName )
	
	os.system("cp "+header+"Apr10Test/*  "  + header + folderName )

	if option == "1":
		abunHouseKeeper.abunGlobalSplitParameterRobot.runGraphSurgery = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runBResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runXResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.RThres = 5
		abunHouseKeeper.abunGlobalSplitParameterRobot.BRThresB  = 2
		#abunHouseKeeper.abunGlobalSplitParameterRobot.BRThresX  = 1
		abunHouseKeeper.abunGlobalSplitParameterRobot.AbunLowerB = 1.5
		abunHouseKeeper.abunGlobalSplitParameterRobot.AbunUpperB = 1.5
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunLowerX = 0.5
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunUpperX = 1.5

	elif option == "2" : 
		abunHouseKeeper.abunGlobalSplitParameterRobot.runGraphSurgery = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runBResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runXResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.RThres = 5
		abunHouseKeeper.abunGlobalSplitParameterRobot.BRThres  = 2
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunLowerB = 2
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunUpperB = 2
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunLowerX = 0.5
		#abunHouseKeeper.abunGlobalSplitParameterRobot.AbunUpperX = 0.5
	elif option == "3": 

		abunHouseKeeper.abunGlobalSplitParameterRobot.runGraphSurgery = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runBResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.runXResolve = True
		abunHouseKeeper.abunGlobalSplitParameterRobot.RThres = 5
		abunHouseKeeper.abunGlobalSplitParameterRobot.BRThresB = 3
		abunHouseKeeper.abunGlobalSplitParameterRobot.BRThresX = 1



	abunSplitter.mainFlow(folderName, mummerLink)

	os.system("python /data/kakitone/download2/quast-2.3/quast.py " + header + folderName +"abun.fasta -o " + header + folderName + "   -R  "+ header + folderName + "reference.fasta")
Beispiel #2
0
        for eachitem in settingDataCombo:
            tmp = eachitem.split('=')
            settingDic[tmp[0]] = tmp[1]

        canLoad = abunHouseKeeper.abunGlobalSplitParameterRobot.loadData(
            settingDic)
    else:
        canLoad = True

    if canLoad:
        settingDic = abunHouseKeeper.abunGlobalSplitParameterRobot.__dict__
        with open(newFolderName + "option.json", 'w') as f:
            json.dump(settingDic, f)

    if pathExists and canLoad:
        abunSplitter.mainFlow(newFolderName, newMummerLink)

    else:
        print "Sorry. The above folders or files are missing or options are not correct. If you continue to have problems, please contact me(Ka-Kit Lam) at [email protected]"

    print "Time", time.time() - t0

    if houseKeeper.globalRunMPI == True:
        for i in range(1, nproc):
            data = "endall"
            comm.send(data, dest=i)

else:
    while True:
        data = comm.recv(source=0)
Beispiel #3
0
def test2():
	import abunSplitter
	abunSplitter.mainFlow("Apr10Test/", "/usr/bin/")
Beispiel #4
0
def continuousIntegration():
	if False:
		G = graphLib.seqGraph(10)
		for i in range(5):
			G.insertEdge(i,i+1,1997)
			G.insertEdge(i,i+2, 1997)

		resultList = abunGraphLib.BFS_revisit(1,3,G,1)

		print "resultList", resultList 

	if False : 

		folderName, mummerPath, directPathList, indirectPathList, contigFile, readFile = \
			"Apr10Test/", "/usr/bin/", [[1, 486, 217], [1, 8642, 217], [1, 13465, 217]], [[1, 486, 217]], "improved3_Double.fasta", "phasingSeedName_Double.fasta"

		abunGraphLib.formPathSeq(folderName, mummerPath, directPathList, indirectPathList, contigFile, readFile)
    
		if False:
			lenDic = IORobot.obtainLength(folderName , contigFile)
			N1 = len(lenDic)

			print "N1", N1

			G = graphLib.seqGraph(0)
			G.loadFromFile(folderName, "phaseStringGraph1")

			adj = [[] for i in range(N1)]

			for i in range(N1): 
			    adj[i] = abunGraphLib.findAllReachable(i, N1, G)

			Gnew = abunGraphLib.seqGraphDynamic(N1)

			for i in range(N1):
			    for j in adj[i]:
			        Gnew.insertEdge(i,j,1997)


			Gnew.initAdv()    
			Gnew.doubleEdgeReduction()

			contigPaths = abunGraphLib.findAllPathK(1, 217, Gnew, 3)
			contigReadPaths = abunGraphLib.findAllPathK(1, 217, G, 5)

			print "contigPaths", contigPaths
			print "contigReadPaths", contigReadPaths

			Gnew.transitiveReduction()

	if False:
		toDelete = abunGraphLib.decideCut("Apr10Test/", "/usr/bin/")
		print toDelete

	if False:
		G = graphLib.seqGraph(0)
		G.loadFromFile("Apr10TestA/", "xResolvedGraph")

		if False:
			for i in range(len(G.graphNodesList)):

				v = G.graphNodesList[i]

				if len(v.nodeIndexList) > 0:
					print i , v.listOfPrevNodes , v.listOfNextNodes

		G.reportEdge()
		lenDic = IORobot.obtainLength("Apr10TestA/", "improved3_Double.fasta")
		mylist = [401, 207, 405, 407, 344]

		json_data = open("Apr10TestA/" + "myCountDic.json", 'r')
		myCountDic = json.load(json_data)

		for x in mylist:
			print x, lenDic["Contig"+str(x/2)+"_p"], myCountDic["Segkk"+str(x/2)]


	if False:
		folderName = "Apr10TestA/"
		G = graphLib.seqGraph(0)
		G.loadFromFile(folderName , "xResolvedGraph")

		json_data = open(folderName + "mapDummyToRealDic.json", 'r')
		mapDummyToRealDic = json.load(json_data)

		lenDic = IORobot.obtainLength(folderName, "improved3_Double.fasta")
		print len(G.graphNodesList)
		print len(mapDummyToRealDic)
		
		print "fake N1 , real N1 ", len(G.graphNodesList) - len(mapDummyToRealDic), len(lenDic)


	if False:
		abunSplitter.mainFlow("Apr10TestB/", "/usr/bin/")

	if False: 
		nonRedundantResolver.removeEmbedded("Apr10TestD/", "/usr/bin/")

	if False:
		folderName, contigReadGraph = "Apr10TestA/", "phaseStringGraph1"
		G = graphLib.seqGraph(0)
		kthres, edgeThres = 3, 1
		G.loadFromFile(folderName, contigReadGraph)
		lenDic = IORobot.obtainLength(folderName , "improved3_Double.fasta")

		N1 = len(lenDic)

		adj = [[] for i in range(N1)]

		for i in range(N1): 
		    tmpList = abunGraphLib.findAllReachable(i, N1, G)
		    
		    for j in tmpList:
		        if len(abunGraphLib.findAllPathK(i,j,G,kthres)) >= edgeThres:
		            adj[i].append(j) 

		    #print i, adj[i]

	    ### Filter adaptor skipped case 

		adaptorPair = []

		for i in range(len(adj)):
		    if  i % 2 == 0:
		        if i + 1 in adj[i]:
		            adj[i].remove(i+1)
		            adaptorPair.append([i, i+1])
		    elif i % 2 ==1: 
		        if i-1 in adj[i] :
		            adj[i].remove(i-1)
		            adaptorPair.append([i, i-1])

		Gnew = abunGraphLib.seqGraphDynamic(N1)

		for i in range(N1):
		    for j in adj[i]:
		        Gnew.insertEdge(i,j,1997)

		for eachpair in adaptorPair:
		    u, v = eachpair[0], eachpair[1]
		    for x in Gnew.graphNodesList[u].listOfPrevNodes:
		        xIndex = x[0]
		        Gnew.removeEdge(xIndex, v)
		    for y in Gnew.graphNodesList[v].listOfNextNodes:
		        yIndex = y[0]
		        Gnew.removeEdge(u, yIndex)


        #Gnew.reportEdge()
		count2 = 0
		for i in range(len(Gnew.graphNodesList)):
			if  len(Gnew.graphNodesList[i].listOfPrevNodes) == 2 and  len(Gnew.graphNodesList[i].listOfNextNodes) == 2:
				count2 = count2 + 1
				print str(i)+"{color:red}"

		print "count2, ", count2

		### End filter adaptor skipped case 
	if True:
		nonRedundantResolver.removeRedundantWithFile("May11TestB/" , "/usr/bin/", "abun", "abunDebug", "abunNoEmbed")
Beispiel #5
0
if args['avoidrefine'] == "True":
    abunHouseKeeper.abunGlobalAvoidrefine = True
else:
    abunHouseKeeper.abunGlobalAvoidrefine = False


if args['readsearch'] != None:
    abunHouseKeeper.abunGlobalReadSearchDepth = int(args['readsearch']) 
else:
    abunHouseKeeper.abunGlobalReadSearchDepth = 1


if args['replace'] != None : 
    replacedName = args['replace']
    abunHouseKeeper.replaceFiles( newFolderName, replacedName) 

if args['RRDisable'] == "True":
    abunHouseKeeper.abunGlobalRRDisable = True
else:
    abunHouseKeeper.abunGlobalRRDisable = False



if pathExists:
    abunSplitter.mainFlow(newFolderName, newMummerLink)
else:
    print "Sorry. The above folders or files are missing. If you continue to have problems, please contact me(Ka-Kit Lam) at [email protected]"

print  "Time", time.time() - t0