Example #1
0
    def median(self):
        filename = airsIO.cleanFileName(str(self.infile.get()))
        filepath = airsIO.getPath(filename)
        width = str(self.Mwid.get())

        outfile = "median-%s" % (filename.strip())
        cmd0 = "proc3d %s %s rfilt=20,%s" % (filepath, outfile, width)
        print cmd0
        os.system(cmd0)

        chimera.openModels.open(outfile)
Example #2
0
    def hp(self):
        filename = airsIO.cleanFileName(str(self.infile.get()))
        filepath = airsIO.getPath(filename)
        apix = str(self.apix.get())
        filterRadius = str(self.filterRadius.get())

        outfile = "hp-%s" % (filename.strip())
        cmd0 = "proc3d %s %s hp=%s,%s" % (filepath, outfile, apix, filterRadius)
        print cmd0
        os.system(cmd0)

        chimera.openModels.open(outfile)
Example #3
0
	def Apply(self):
		target=airsIO.cleanFileName(str(self.target.get()))
		targetPath=airsIO.getPath(target)
		t=os.path.splitext(target)
		targetPRE=str(t[0])

		pseudoatoms=str(self.atoms.get())
		coeff=airsIO.cleanFileName(str(self.coeff.get()))
		apix=float(self.apix.get())
		thresh=float(self.thresh.get())
		res=float(self.res.get())
		
		mapinfo=airsIO.getMapInfo(target)
		mapSize=mapinfo[0][0]
		mapOrigin=mapinfo[1]  
		
		logfile="log-%s.txt"%(targetPRE)
		
		if coeff!="None":
			if pseudoatoms!="None":
				cmd1="ssehunter3.py %s %f %f %f coeff=%s atoms=%s > %s"%(target, apix, res, thresh, coeff, pseudoatoms, logfile)
			else:
				cmd1="ssehunter3.py %s %f %f %f coeff=%s > %s"%(target, apix, res, thresh, coeff, logfile)
		else:
			if pseudoatoms!="None":
				cmd1="ssehunter3.py %s %f %f %f atoms=%s > %s"%(target, apix, res, thresh, pseudoatoms, logfile)
			else:
				cmd1="ssehunter3.py %s %f %f %f > %s"%(target, apix, res, thresh, logfile)
		print cmd1
		os.system(cmd1)

		outfile="score-%s.pdb"%(targetPRE)
		if self.mapOri.get()==1:
			Ox=mapOrigin[0]
			Oy=mapOrigin[1]
			Oz=mapOrigin[2]			
			cmdt="procpdb.py %s %s trans=%f,%f,%f"%(outfile,outfile,Ox,Oy,Oz)
			os.system(cmdt)
		chimera.openModels.open(outfile)
Example #4
0
    def bf(self):
        filename = airsIO.cleanFileName(str(self.infile.get()))
        filepath = airsIO.getPath(filename)
        sigma1 = str(self.sigma1.get())
        sigma2 = str(self.sigma2.get())
        iteration = int(self.iteration.get())
        width = str(self.wid.get())

        outfile = "bf-%s" % (filename.strip())
        cmd0 = "proc3d %s %s blfilt=%s,%s,%d,%s" % (filepath, outfile, sigma1, sigma2, iteration, width)
        print cmd0
        os.system(cmd0)

        chimera.openModels.open(outfile)
Example #5
0
	def Generate(self):
		target=airsIO.cleanFileName(str(self.infile.get()))
		targetPath=airsIO.getPath(target)
		t=os.path.splitext(target)
		targetPRE=str(t[0])
		
		self.selectionlist=[]
		atoms=""
		selected=chimera.selection.currentAtoms()
		for i in selected:
			atoms=atoms+str(i.serialNumber)+","
		print atoms
		outfile="%s.cmm"%(targetPRE)
		cmd1="pdb2cmm.py %s %s cmm %s"%(targetPath,outfile,atoms[0:-1].strip())
		print cmd1
		os.system(cmd1)
		chimera.openModels.open(outfile)
Example #6
0
	def Apply(self):
		target=airsIO.cleanFileName(str(self.target.get()))
		targetPath=airsIO.getPath(target)
		t=os.path.splitext(target)
		targetPRE=str(t[0])

		pseudoatoms=str(self.atoms.get())
		apix=float(self.apix.get())
		thresh=float(self.thresh.get())
		res=float(self.res.get())
		
		sseFLAG=self.sse.get()
		skeFLAG=self.skeleton.get()

		print "Generating skeletons on %s where pseudoatoms are %s. apix: %f threshold: %f resolution: %f skeletons: %d sse: %d"%(targetPath,pseudoatoms,apix,thresh,res,skeFLAG,sseFLAG)
		
		if pseudoatoms=="None":
			pseudoatoms="%s-atoms.pdb"%(targetPRE)
			cmd0="pseudoatom.py %s %s %f %f %f"%(targetPath, pseudoatoms, apix, res, thresh)
			print cmd0
			os.system(cmd0)
		else:
			pseudoatomsPath=airsIO.getPath(pseudoatoms)
			
		helixsize=float(self.helixsize.get())
		sheetsize=float(self.sheetsize.get())	

		mode=6		
		if skeFLAG==1 and sseFLAG==0:
			mode=4
		elif skeFLAG==0 and sseFLAG==1:
			mode=5
		outfile="%s-score.pdb"%(targetPRE)
		cmd1="skeleton %d %s %s %f  %f %f %f %s"%(mode,targetPath, pseudoatoms, apix, thresh, helixsize, sheetsize, outfile)
		print cmd1
		os.system(cmd1)
		
		if mode==4 or mode==6:
			helixout="%s_helix.mrc"%(targetPRE)
			chimera.openModels.open(helixout)
			sheetout="%s_sheet.mrc"%(targetPRE)
			chimera.openModels.open(sheetout)
			skeletonout="%s_skeleton.mrc"%(targetPRE)
			chimera.openModels.open(skeletonout)
		if mode==5 or mode==6:
			chimera.openModels.open(outfile)
Example #7
0
 def Apply(self):
     infile = airsIO.cleanFileName(str(self.target.get()))
     targetPath = airsIO.getPath(infile)
     alt = float(self.alt.get())
     az = float(self.az.get())
     phi = float(self.phi.get())
     dx = float(self.dx.get())
     dy = float(self.dy.get())
     dz = float(self.dz.get())
     outfile = "rt-%s" % (infile.strip())
     print outfile
     if str(infile.split(".")[-1].strip()) == ("mrc" or "map" or "ccp4"):
         cmd0 = "chimerart.py %s %s %f,%f,%f,%f,%f,%f" % (targetPath, outfile, alt, az, phi, dx, dy, dz)
     elif str(infile.split(".")[-1]) == ("pdb" or "ent"):
         cmd0 = "procpdb.py %s %s rot=%f,%f,%f trans=%f,%f,%f" % (targetPath, outfile, alt, az, phi, dx, dy, dz)
     else:
         print "bad file"
     print cmd0
     os.system(cmd0)
     chimera.openModels.open(outfile)
Example #8
0
    def Apply(self):
        target = airsIO.cleanFileName(str(self.target.get()))
        targetPath = airsIO.getPath(target)

        output = str(self.outfile.get())
        apix = float(self.apix.get())
        res = float(self.res.get())
        mapsize = float(self.boxsize.get())
        centerFLAG = self.centeratoms.get()

        if centerFLAG == 1:
            cmd0 = "pdb2mrc %s %s apix=%f res=%f box=%f centeratoms" % (targetPath, output, apix, res, mapsize)

        else:
            cmd0 = "pdb2mrc %s %s apix=%f res=%f box=%f" % (targetPath, output, apix, res, mapsize)

        print cmd0
        os.system(cmd0)

        chimera.openModels.open(output)
Example #9
0
	def Dock (self):
		apix=float(self.apix.get())
		res=float(self.res.get())
		angle=float(self.angle.get())
		trans=float(self.trans.get())
		
		target=airsIO.cleanFileName(str(self.target.get()))
		targetPath=airsIO.getPath(target)
		t=os.path.splitext(target)
		targetName=str(t[0])
		
		mapInfo=airsIO.getMapInfo(target)
		mapSize=mapInfo[0][0]
			
		probePDB=self.outfile
		cmdCenter="procpdb.py %s probe.pdb centeratoms"%(probePDB)
		os.system(cmdCenter)
		cmdMRC="pdb2mrc probe.pdb probe.mrc apix=%f res=%f box=%f"%(apix, res, mapSize)
		os.system(cmdMRC)
		self.outFit="fh-mode-%s"%(targetName)
		
		cmdDock="foldhunterP %s probe.mrc fh-mode.mrc log=log-mode-fit.txt da=1 startangle=0,0,0 range=%f sphere_region=0,0,0,%f"%(targetPath, angle, trans)
		print cmdDock
		os.system(cmdDock)
		
		file=open("log-mode-fit.txt", "r")
		lines=file.readlines()
		file.close()
		fh = {}
		pattern=re.compile(r"Solution\s(?P<solnum>\d+)\:\trotation\s=\s\(\s(?P<rotx>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<rotz1>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<rotz2>-?\d+(\.\d+)?(e.\d+)?)\s\)\ttranslation\s=\s\(\s(?P<dx>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<dy>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<dz>-?\d+(\.\d+)?(e.\d+)?)\s\)")
		for line in lines:
			ps=pattern.search(line)
			if ps:
				fh[int(ps.group('solnum'))]=[float(ps.group('rotx')),float(ps.group('rotz1')),float(ps.group('rotz2')),float(ps.group('dx')),float(ps.group('dy')),float(ps.group('dz'))]
 		outRefinePDB="flex-fh-%s.pdb"%(targetName)
		cmd1="procpdb.py %s r.pdb rot=%f,%f,%f"%(self.outfile,fh[0][0],fh[0][1],fh[0][2])
		os.system(cmd1)
		cmd2="procpdb.py r.pdb %s apix=%f trans=%f,%f,%f"%(outRefinePDB,apix,fh[0][3],fh[0][4],fh[0][5])
		os.system(cmd2)
		chimera.openModels.open(outRefinePDB)
Example #10
0
	def Apply(self):
		target=airsIO.cleanFileName(str(self.target.get()))
		targetPath=airsIO.getPath(target).strip()
		shutil.copy(targetPath, 'target.mrc')
		t=target.split('.')
		targetExt=str(t[-1])
		
		refineFLAG=0
		maskFLAG=0		
		if (self.rs.get()==1):	
			refineFLAG=1
			if self.ms.get()==1:
				maskFLAG=1

        	probe=airsIO.cleanFileName(str(self.probe.get()))
		print str(self.probe.get())
		print probe
		probePath=airsIO.getPath(probe)
		print probePath
		probesplit=probe.split('.')
		probeExt=str(probesplit[-1])
		probeName=str(probesplit[0])
		print probeExt
		print probeName
		#probesplit=os.path.split(probe)
		#probeName=str(probesplit[0])

		mapinfo=airsIO.getMapInfo(target)
		mapSize=mapinfo[0][0]
		mapOrigin=mapinfo[1] 

		if probeExt=="mrc" or probeExt=="map" or probeExt=="ccp4":
			probeinfo=airsIO.getMapInfo(probe)
			tempSizeX=probeinfo[0][0]
			tempSizeY=probeinfo[0][1]
			tempSizeZ=probeinfo[0][2]
		 

		#openfiles=chimera.openModels.list()
		#mapSize=0
		#from VolumeViewer import volume_list
		#for v in volume_list():
		#	if v.data.name == volume_name.strip():
		#		mapSize = v.data.size[0]
		#		mapOrigin= v.data.origin
		#		if probeExt=="mrc":
		#			tempSizeX,tempSizeY,tempSizeZ = v.data.size
		apix=float(self.apix.get())
		res= float(self.res.get())
		shrink = int(self.shrink.get())
		keep=int(self.keep.get())

		if ((self.filter.get()=='None') or (self.filter.get()=='Normalize')): 
			value=None	
		else:
			value=float(self.filterValue.get())
		
		hs=0
		hs=int(self.hs.get())
					
		if hs==1:
			depth= int(self.depth.get())
			pixel=int(self.pixel.get())
		else:
			depth=1
			pixel=1
		########create user selection
		if (refineFLAG==1):
			selectedLength=0
			selected=chimera.selection.currentAtoms()
			selectedLength=len(selected)
			
			if (selectedLength!=0) and (probeExt=='pdb' or probeExt=='ent'):
				print "ENTERED USER SELECTION"	
				i=0
				selectedAtoms=[]
				while (i < selectedLength):
					selectedAtoms.append(chimera.selection.currentAtoms()[i].serialNumber)
					i=i+1
	
				selectedAtoms.sort()
				print selectedAtoms
				fileRefine=open(probe, "r")
				linesRefine=fileRefine.readlines()
				fileRefine.close()
				
				refinePDB=open("refine.pdb", "w")
				maskPDB=open("mask.pdb", "w")
				for lineRefine in linesRefine:
					isatom=str(lineRefine[0:6].strip())
					serialNum=str(lineRefine[6:11].strip())
					if (isatom=="ATOM"):
						serialNum=int(lineRefine[6:11].strip())
						if (serialNum in selectedAtoms):
							refinePDB.write(lineRefine)
						else :
							maskPDB.write(lineRefine)
				refinePDB.close()
				maskPDB.close()

				cmdRS0="pdb2mrc refine.pdb refine.mrc apix=%f res=%f box=%d"%(apix, res, mapSize)
				os.system(cmdRS0)
				cmdRS1="pdb2mrc mask.pdb mask.mrc apix=%f res=%f box=%d"%(apix, res, mapSize)
				os.system(cmdRS1)
				cmdRS2="proc3d refine.mrc refine.mrc norm"
				os.system(cmdRS2)

				if self.mask.get()!="Unselected":
					maskfile=str(self.mask.get())
					maskPath=airsIO.getPath(maskfile)
					maskEXT=str(maskfile[-1])
					
					if (maskExt=='pdb' or maskExt=='ent'):
						cmdRS3="pdb2mrc %s mask.mrc apix=%f res=%f box=%d"%(maskPath, apix, res, mapSize)
						os.system(cmdRS3)	
					else:
						shutil.copy(targetpath, 'mask.mrc')
					
#					for f in openfiles:
#        	        		        if f.name==maskfile:
#							mask=str(f.name)
#                                                       from VolumeViewer import Volume
#                                                       from chimera import Molecule
#							if isinstance(p,Volume):
#								maskpath=str(os.path.abspath(mask))
#    		   		                     	elif isinstance(p,Molecule):
#								mf=f.openedAs
#								maskpath=mf[0]
#
#
#						maskExt=str(probesplit2[-1])
#						maskName=str(probesplit2[0])
#
#						if (maskExt=='pdb' or maskExt=='ent'):
#							cmdRS3="pdb2mrc %s mask.mrc apix=%f res=%f box=%d"%(msplit, apix, res, mapSize)
#						else:
#							if os.system("copy")==1:
#								cmdRS3="copy %s mask.mrc"%(msplit)
#							else:
#								cmdRS3="cp %s mask.mrc"%(msplit)
#						os.system(cmdRS3)

				cmdRS9="proc3d mask.mrc mask.mrc norm"
				os.system(cmdRS9)
				
				if (maskFLAG!=0):
					cmdRS4="proc3d mask.mrc mask-bin.mrc bin=0.5"
					cmdRS5="proc3d mask-bin.mrc mask-inv.mrc mult=-1"
					cmdRS6="proc3d mask-inv.mrc mask-add.mrc add=1"
					cmdRS7="proc3d target.mrc target.mrc maskfile=mask-add.mrc"
					cmdRS8="proc3d target.mrc target.mrc rfilt=0,0.5"
					os.system(cmdRS4)
					os.system(cmdRS5)
					os.system(cmdRS6)
					os.system(cmdRS7)
					os.system(cmdRS8)
					tempfiles=["mask.mrc","mask-bin.mrc","mask-inv.mrc","mask-add.mrc"]
					airsIO.cleanTempFiles(tempfiles)

			else:
				shutil.copy(probePath, 'refine.mrc')	
			selected=chimera.selection.currentEmpty()
			selectedLength=0

		########Transform PDB file and generate MRC file
		if (probeExt=='pdb' or probeExt=='ent') and (refineFLAG==0):
                        print probe
			shutil.copy(probe, 'probe.pdb')
			cmd1="procpdb.py probe.pdb probe.pdb centeratoms"
			os.system(cmd1)
			cmd2="pdb2mrc probe.pdb probe.mrc apix=%f res=%f box=%d"%(apix, res, mapSize)
			os.system(cmd2)
			cmd3="proc3d probe.mrc probe.mrc norm"
			os.system(cmd3)
		elif (refineFLAG!=0):
			print "Selection transformed"
		else:
			shutil.copy(probePath, 'probe.mrc')
			if (tempSizeX!=tempSizeY!=tempSizeZ!=mapSize):
				cmd3a="proc3d probe.mrc probe.mrc clip=%d,%d,%d"%(mapSize,mapSize,mapSize)
				os.system(cmd3a)
		print "filter"		
		########Filter and Scale MRC files
		if (self.filter.get()=='Threshold'):
			print("Tresholding target map")
			cmdF1="proc3d target.mrc target.mrc rfilt=0,%f"%(value)
			os.system(cmdF1)
		if (self.filter.get()=='Binary'):
			print("Binerizing target map")
			cmdF2="proc3d target.mrc target.mrc rfilt=2,%f"%(value)
			os.system(cmdF2)
		if (self.filter.get()=='Normalize'):
			print("Normalizing target map")
			cmdF3="proc3d target.mrc target.mrc  norm"
			os.system(cmdF3)
		if (self.filter.get()=='Laplacian'):
			print("Laplacian filter")
			cmdF4="proc3d target.mrc target.mrc rfilt=80,%f"%(value)
			os.system(cmdF4)
		if (refineFLAG==0):	
			print("Shrinking maps")
			cmdST="proc3d target.mrc target-shrink.mrc shrink=%f"%(shrink)
			os.system(cmdST)
			cmdSP="proc3d probe.mrc probe-shrink.mrc shrink=%f"%(shrink)
			os.system(cmdSP)
		pattern=re.compile(r"Solution\s(?P<solnum>\d+)\:\trotation\s=\s\(\s(?P<rotx>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<rotz1>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<rotz2>-?\d+(\.\d+)?(e.\d+)?)\s\)\ttranslation\s=\s\(\s(?P<dx>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<dy>-?\d+(\.\d+)?(e.\d+)?)\s,\s(?P<dz>-?\d+(\.\d+)?(e.\d+)?)\s\)")

		self.listResults=[]
		
		###############################
		####### Run foldhunterP #######
		###############################

		########SMART option
		if (self.smart.get()==1 and refineFLAG==0):
			print "RUNNING SMART FOLDHUNTER"
			logSmart="log-fh-%s.txt"%(probeName)
			outSmart="fh-smart-%s.mrc"%(probeName)
			cmdS1="foldhunterP target.mrc probe.mrc %s log=%s da=1 keep=%d "%(outSmart, logSmart, keep)
			print cmdS1
			os.system(cmdS1)
			if (probeExt=='pdb' or probeExt=='ent'):
				file0=open(logSmart, "r")
				lines0=file0.readlines()
				file0.close()
				fh0 = {}
				for line in lines0:
					ps=pattern.search(line)
					if ps:
						fh0[int(ps.group('solnum'))]=[float(ps.group('rotx')),float(ps.group('rotz1')),float(ps.group('rotz2')),float(ps.group('dx')),float(ps.group('dy')),float(ps.group('dz'))]

				fhSmart="fh-smart-%s.pdb"%(probeName)
				self.transformPDB('probe.pdb', fhSmart, apix, mapSize, mapOrigin,fh0[0][0],fh0[0][1],fh0[0][2],fh0[0][3],fh0[0][4],fh0[0][5])
 			else:
				chimera.openModels.open(outSmart)
				
		########Scale foldhunter	
		if (refineFLAG==0) and (self.smart.get()==0):
			print "RUNNING FOLDHUNTER ON SMALL MAPS"
			outShrink="fh-shrink-%s.mrc"%(probeName)
			da=((180*res)/(math.pi*(mapSize/(2*shrink))))*1.5
			if da>30:
				da=30
			cmdFHS="foldhunterP target-shrink.mrc probe-shrink.mrc %s log=log-fh-shrink.txt da=%f keep=%d"%(outShrink,da,keep)
			print cmdFHS
			os.system(cmdFHS)

			########Parse output and repeat foldhunterP
			file1=open('log-fh-shrink.txt', "r")
			lines1=file1.readlines()
			file1.close()
			fh1 = {}
			for line in lines1:
				ps=pattern.search(line)
				if ps:
					fh1[int(ps.group('solnum'))]=[float(ps.group('rotx')),float(ps.group('rotz1')),float(ps.group('rotz2')),float(ps.group('dx')),float(ps.group('dy')),float(ps.group('dz'))]
			print("RUNNING FOLDHUNTER")
			count=0
			children=0
			while ((count < depth) and (children < keep)):
				angle_range=da/2
				da2=1
				if ((angle_range >=10) and (mapSize>=80)):
					da2=2
				sphere_radius=mapSize/10

				x1=shrink*fh1[children][3]
				y1=shrink*fh1[children][4]
				z1=shrink*fh1[children][5]

				dist = []
				solution=0
				while (solution <= children):
					x2=shrink*fh1[solution][3]
					y2=shrink*fh1[solution][4]
					z2=shrink*fh1[solution][5]
					if (solution!=children):
						distance=math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
					else:
						distance=10000
					dist.append(distance)
					print "%d verse %d: %f"%(children,solution,dist[solution])
					solution=solution+1
				pixel_distance=min(dist)
	
				if ((pixel_distance >= pixel) or (count==0)):
					logfile="log-%s-%d.txt"%(probeName,count)
					cmdFH="foldhunterP target.mrc probe.mrc fh-%d.mrc log=%s da=%f startangle=%f,%f,%f range=%f sphere_region=%f,%f,%f,%f"%(children,logfile,da2,fh1[children][0],fh1[children][1],fh1[children][2],angle_range,x1,y1,z1,sphere_radius)
					print cmdFH
					os.system(cmdFH)
					num=count
					count=count+1
		
					########Transform PDB
					if (probeExt=='pdb' or probeExt=='ent'):
						print("Transforming PDB")
						file2=open(logfile, "r")
						lines2=file2.readlines()
						file2.close()
						fh2 = {}
						for line in lines2:
							ps=pattern.search(line)
							if ps:
								fh2[int(ps.group('solnum'))]=[float(ps.group('rotx')),float(ps.group('rotz1')),float(ps.group('rotz2')),float(ps.group('dx')),float(ps.group('dy')),float(ps.group('dz'))]
						addFile="fh-solution-%d-%s.pdb"%(num,probeName)
						self.transformPDB('probe.pdb', addFile, apix, mapSize, mapOrigin,fh2[0][0],fh2[0][1],fh2[0][2],fh2[0][3],fh2[0][4],fh2[0][5])

					else:
						addFile="fh-%d.mrc"%(children)
				children=children+1
				self.listResults.append(addFile)
#			bestResult=self.listResults[0]
#			chimera.openModels.open(bestResult)
			self.resultSelector()
		
		########Refinement option
		if (refineFLAG==1)and (self.smart.get()==0):
			print "RUNNING REFINEMENT"
			outRefine="fh-refine-%s.mrc"%(probeName)
			angl=float(self.angle.get())
			refdis=float(self.refdist.get())
			cmdREF1="foldhunterP target.mrc refine.mrc %s log=log-fh-refine.txt keep=%d da=1 startangle=0,0,0 range=%f sphere_region=0,0,0,%f"%(outRefine, keep, angl, refdis)
			os.system(cmdREF1)
			if (probeExt=='pdb' or probeExt=='ent'):
				fileR=open("log-fh-refine.txt", "r")
				linesR=fileR.readlines()
				fileR.close()
				fhR = {}
				for lineR in linesR:
					ps=pattern.search(lineR)
					if ps:
						fhR[int(ps.group('solnum'))]=[float(ps.group('rotx')),float(ps.group('rotz1')),float(ps.group('rotz2')),float(ps.group('dx')),float(ps.group('dy')),float(ps.group('dz'))]
 				outRefinePDB="fh-refine-%s.pdb"%(probeName)
				self.transformPDB('refine.pdb', outRefinePDB, apix, mapSize, mapOrigin,fhR[0][0],fhR[0][1],fhR[0][2],fhR[0][3],fhR[0][4],fhR[0][5])

			else:
				chimera.openModels.open(outRefine)		

		tempfiles=["target.mrc", "probe.mrc", "target-shrink.mrc", "probe-shrink.mrc", "r.pdb", "refine.mrc", "refine.pdb"] 
		airsIO.cleanTempFiles(tempfiles)
Example #11
0
    def Apply(self):
        inputfile = airsIO.cleanFileName(str(self.infile.get()))
        fullPath = airsIO.getPath(inputfile)
        shutil.copy(fullPath, "hh.mrc")
        a = os.path.splitext(inputfile)
        name = str(a[0])

        apix = float(self.apix.get())
        da = float(self.da.get())
        percen = float(self.percen.get())

        if self.bf.get() == 1:
            sigma1 = float(self.sigma1.get())
            sigma2 = float(self.sigma2.get())
            it = int(self.iter.get())
            width = float(self.wid.get())
        else:
            sigma1 = 0
            sigma2 = 0
            it = 0
            width = 0

        if self.norm.get() == 1:
            print "Normalizing map"
            cmd2 = "proc3d hh.mrc hh.mrc norm"
            os.system(cmd2)

        if it >= 1:
            print "Filtering Map"
            cmd3 = "proc3d hh.mrc hh.mrc blfilt=%f,%f,%d,%f" % (sigma1, sigma2, iter, width)
            os.system(cmd3)

        print "Running helixhunter2"
        file0 = "hh2-%s-%f" % (name, percen)
        if self.coeff.get() == 1:
            cmd4 = (
                "helixhunter2 hh.mrc %s.iv %f percen=%f docylccffirst int=int-%s dejavu=%s.sse da=%d minlen=8 maxlen=50"
                % (file0, apix, percen, name, file0, da)
            )
            os.system(cmd4)
        else:
            cmd4 = "helixhunter2 hh.mrc %s.iv %f percen=%f dejavu=%s.sse minlen=8 maxlen=50 da=%d" % (
                file0,
                apix,
                percen,
                file0,
                da,
            )
            os.system(cmd4)

        print "Saving results as a PDB file"

        trash = ["hh.mrc"]
        airsIO.cleanTempFiles(trash)

        file1 = "%s.sse" % (file0)
        file2 = "%s.pdb" % (file0)

        check = os.path.exists(file1)
        if check == 1:
            cmd5 = "dejavu2pdb.py %s %s" % (file1, file2)
            os.system(cmd5)
            chimera.openModels.open(file2)