Ejemplo n.º 1
0
	def insertOtrRun(self, volfile):
		### setup resolutions
		fscresq = appiondata.ApResolutionData()
		fscresq['type'] = "fsc"
		fscresq['half'] = self.fscresolution
		fscresq['fscfile'] = "fscdata"+self.timestamp+".fsc"
		rmeasureq = appiondata.ApResolutionData()
		rmeasureq['type'] = "rmeasure"
		rmeasureq['half'] = self.rmeasureresolution
		rmeasureq['fscfile'] = None

		### insert rct run data
		otrrunq = appiondata.ApOtrRunData()
		otrrunq['runname']    = self.params['runname']
		tempstr = ""
		for cnum in self.classlist:
			tempstr += str(cnum)+","
		classliststr = tempstr[:-1]
		otrrunq['classnums']  = classliststr
		otrrunq['numiter']    = self.params['numiters']
		otrrunq['euleriter']  = self.params['refineiters']
		otrrunq['maskrad']    = self.params['radius']
		otrrunq['lowpassvol'] = self.params['lowpassvol']
		otrrunq['highpasspart'] = self.params['highpasspart']
		otrrunq['median'] = self.params['median']
		otrrunq['description'] = self.params['description']
		otrrunq['path']  = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		otrrunq['alignstack'] = self.alignstackdata
		otrrunq['tiltstack']  = apStack.getOnlyStackData(self.params['tiltstackid'])
		otrrunq['numpart']  = self.numpart
		otrrunq['fsc_resolution'] = fscresq
		otrrunq['rmeasure_resolution'] = rmeasureq
		if self.params['commit'] is True:
			otrrunq.insert()

		### insert 3d volume density
		densq = appiondata.Ap3dDensityData()
		densq['otrrun'] = otrrunq
		densq['path'] = appiondata.ApPathData(path=os.path.dirname(os.path.abspath(volfile)))
		densq['name'] = os.path.basename(volfile)
		densq['hidden'] = False
		densq['norm'] = True
		densq['symmetry'] = appiondata.ApSymmetryData.direct_query(25)
		densq['pixelsize'] = apStack.getStackPixelSizeFromStackId(self.params['tiltstackid'])*self.params['tiltbin']
		densq['boxsize'] = self.getBoxSize()
		densq['lowpass'] = self.params['lowpassvol']
		densq['highpass'] = self.params['highpasspart']
		densq['mask'] = self.params['radius']
		#densq['iterid'] = self.params['numiters']
		densq['description'] = self.params['description']
		densq['resolution'] = self.fscresolution
		densq['rmeasure'] = self.rmeasureresolution
		densq['session'] = apStack.getSessionDataFromStackId(self.params['tiltstackid'])
		densq['md5sum'] = apFile.md5sumfile(volfile)
		if self.params['commit'] is True:
			densq.insert()

		return
Ejemplo n.º 2
0
    def insertRefinementIterationData(self,
                                      iteration,
                                      package_table=None,
                                      package_database_object=None,
                                      reference_number=1):
        ''' fills in database entry for ApRefineIterData table '''

        if not self.params['euleronly']:
            ### get resolution
            try:
                fscfile = os.path.join(self.resultspath, "recon_%s_it%.3d_vol%.3d.fsc" \
                 % (self.params['timestamp'], iteration, reference_number))
                fscRes = apRecon.getResolutionFromGenericFSCFile(
                    fscfile,
                    self.runparams['boxsize'],
                    self.runparams['apix'],
                    filtradius=3,
                    criterion=self.fscResCriterion)
                apDisplay.printColor(
                    "FSC " + str(self.fscResCriterion) + " Resolution: " +
                    str(fscRes), "cyan")
                resq = appiondata.ApResolutionData()
                resq['half'] = fscRes
                resq['fscfile'] = os.path.basename(fscfile)
            except Exception, e:
                apDisplay.printWarning(
                    "An error occured while reading fsc data: ")
                print e
                apDisplay.printWarning(
                    "The following FSC file does not exist or is unreadable: %s "
                    % (fscfile))
                resq = None
Ejemplo n.º 3
0
        def getResolutionData(self, avgpath, iternum):
                evenvol = os.path.join(avgpath, "avglist3_%dp1.mrc"%(self.params['rescut']))
                oddvol = os.path.join(avgpath, "avglist3_%dp2.mrc"%(self.params['rescut']))
                evenhed = os.path.join(avgpath, "avglist3_%dp1.hed"%(self.params['rescut']))
                oddhed = os.path.join(avgpath, "avglist3_%dp2.hed"%(self.params['rescut']))
                emancmd1 = 'proc3d %s %s' % (evenvol, evenhed)
                apEMAN.executeEmanCmd(emancmd1, verbose=True)
                emancmd2 = 'proc3d %s %s' % (oddvol, oddhed)
                apEMAN.executeEmanCmd(emancmd2, verbose=True)
                fscfile = 'fsc.eotest.%d'%(iternum)
                fscpath = os.path.join(avgpath, fscfile)
                emancmd3 = 'proc3d %s %s fsc=%s' % (evenhed, oddhed, fscpath)
                apEMAN.executeEmanCmd(emancmd3, verbose=True)

                if not os.path.isfile(fscpath):
                        apDisplay.printWarning("Could not find FSC file: "+fscpath)
                        return None
                f = open(fscpath, 'r')
                xy = f.readlines()
                lines = len(xy)
                boxsize = (lines * 2.0)
                f.close()
                # calculate the resolution:
                halfres = apRecon.calcRes(fscpath, boxsize, self.params['step'])
                apDisplay.printColor("FSC 0.5 Resolution of %.3f Angstroms"%(halfres), "cyan")

                # save to database
                resq=appiondata.ApResolutionData()
                resq['half'] = halfres
                resq['fscfile'] = fscpath

                return resq
Ejemplo n.º 4
0
	def getResolutionData(self, iternum):
		fscfile = 'fsc.eotest.%d'%(iternum)
		fscpath = os.path.join(self.params['rundir'], "iter%03d"%(iternum), fscfile)

		if not os.path.isfile(fscpath):
			apDisplay.printWarning("Could not find FSC file: "+fscpath)
			return None

		# calculate the resolution:
		halfres = apRecon.calcRes(fscpath, self.boxsize, self.apix)
		apDisplay.printColor("FSC 0.5 Resolution of %.3f Angstroms"%(halfres), "cyan")

		# save to database
		resq=appiondata.ApResolutionData()
		resq['half'] = halfres
		resq['fscfile'] = fscfile

		return resq
Ejemplo n.º 5
0
	def getResolutionData(self, iteration):
		fsc = 'fsc.eotest.'+iteration['num']
		fscfile = os.path.join(self.params['rundir'],fsc)

		if not os.path.isfile(fscfile):
			apDisplay.printWarning("Could not find FSC file: "+fscfile)

		iteration['fscfile'] = fscfile
		if not fsc in self.params['fscs']:
			return None

		# calculate the resolution:
		halfres = apRecon.calcRes(fscfile, self.params['boxsize'], self.params['apix'])

		# save to database
		resq=appiondata.ApResolutionData()
		resq['half'] = halfres
		resq['fscfile'] = fsc

		return resq