def start(self):
		self.setFileName()

		scale =  float(self.params['oldapix'])/self.params['newapix']

		mrcname = os.path.join(self.params['rundir'], self.params['name']+".mrc")
		origmodel = self.params['file']
		if os.path.isfile(mrcname):
			apDisplay.printError("File exists")

		if (abs(self.params['oldapix'] - self.params['newapix']) > 1.0e-2 or
			abs(self.params['oldbox'] - self.params['newbox']) > 1.0e-1):
			### rescale old model to a new size
			apDisplay.printWarning("rescaling original model to a new size")
			scale = float(self.params['oldapix'])/self.params['newapix']
			apDisplay.printMsg("rescaling model by scale factor of %.4f"%(scale))
			apVolume.rescaleVolume(origmodel, mrcname,
				self.params['oldapix'], self.params['newapix'], self.params['newbox'])
		else:
			### simple upload, just copy file to models folder
			apDisplay.printMsg("copying original model to a new location: "+mrcname)
			shutil.copyfile(origmodel, mrcname)

		if self.params['viper2eman'] is True:
			apVolume.viper2eman(mrcname, mrcname, apix=self.params['newapix'])

		### render chimera images of model
		contour = self.params['contour']
		if self.params['mass'] is not None:
			apChimera.setVolumeMass(mrcname, self.params['newapix'], self.params['mass'])
			contour = 1.0
		apChimera.renderSnapshots(mrcname, contour=contour,
			zoom=self.params['zoom'], sym=self.params['symdata']['eman_name'])

		self.insertModel(mrcname)
Beispiel #2
0
	def convertPDBtoMRC(self, pdbfile):
		### create density from pdb
		spidername = self.params['name']+".spi"
		mrcname = self.params['name']+".mrc"

		if self.params['method'] == 'spider':
			if self.params['bunit'] is True:
				pdbfile = self.removeModelFlags(pdbfile)
			volFun.pdb2vol(pdbfile, self.params['apix'], self.params['boxsize'], spidername)
			if not os.path.isfile(spidername):
				apDisplay.printError("SPIDER did not create density file: "+spidername)
			### convert spider to mrc format
			apDisplay.printMsg("converting spider file to mrc")
			emancmd='proc3d %s %s apix=%.4f lp=%.2f norm=0,1 origin=0,0,0' % (spidername, mrcname,
				self.params['apix'], self.params['lowpass'])
			apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
			apFile.removeFile(spidername)

		elif self.params['method'] == 'eman':
			mult = 1.0
			### use resolution of mult*apix, because this is slow and lowpass is fast
			emancmd='pdb2mrc %s %s apix=%.4f res=%.2f box=%d center allmdl' % (pdbfile, mrcname,
				self.params['apix'], mult*self.params['apix'], self.params['boxsize'])
			apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
			### lowpass to desired resolution minus the res factor specified
			lp = math.sqrt(self.params['lowpass']**2 - (mult*self.params['apix'])**2)
			emancmd='proc3d %s %s apix=%.4f lp=%.2f norm=0,1 origin=0,0,0' % (mrcname, mrcname,
				self.params['apix'], lp)
			apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)

		if self.params['viper2eman'] is True:
			apVolume.viper2eman(mrcname, mrcname, apix=self.params['apix'])

		return mrcname
        def convertPDBtoMRC(self, pdbfile):
                ### create density from pdb
                spidername = self.params['name']+".spi"
                mrcname = self.params['name']+".mrc"

                if self.params['method'] == 'spider':
                        if self.params['bunit'] is True:
                                pdbfile = self.removeModelFlags(pdbfile)
                        volFun.pdb2vol(pdbfile, self.params['apix'], self.params['boxsize'], spidername)
                        if not os.path.isfile(spidername):
                                apDisplay.printError("SPIDER did not create density file: "+spidername)
                        ### convert spider to mrc format
                        apDisplay.printMsg("converting spider file to mrc")
                        emancmd='proc3d %s %s apix=%.4f lp=%.2f norm=0,1 origin=0,0,0' % (spidername, mrcname,
                                self.params['apix'], self.params['lowpass'])
                        apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
                        apFile.removeFile(spidername)

                elif self.params['method'] == 'eman':
                        mult = 1.0
                        ### use resolution of mult*apix, because this is slow and lowpass is fast
                        emancmd='pdb2mrc %s %s apix=%.4f res=%.2f box=%d center allmdl' % (pdbfile, mrcname,
                                self.params['apix'], mult*self.params['apix'], self.params['boxsize'])
                        apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
                        ### lowpass to desired resolution minus the res factor specified
                        lp = math.sqrt(self.params['lowpass']**2 - (mult*self.params['apix'])**2)
                        emancmd='proc3d %s %s apix=%.4f lp=%.2f norm=0,1 origin=0,0,0' % (mrcname, mrcname,
                                self.params['apix'], lp)
                        apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)

                if self.params['viper2eman'] is True:
                        apVolume.viper2eman(mrcname, mrcname, apix=self.params['apix'])

                return mrcname
	def convertRefineModelIcosSymmetry(self,modelname,extname,modelfile,apix):
		# EMAN uses (5 3 2) only
		symmetry_description = self.model['data']['symmetry']['symmetry']
		tempfile = os.path.join(self.params['rundir'], "temp.%s" % (extname))
		if '(2 3 5)' in symmetry_description:
			apVolume.viper2eman(modelfile, tempfile, apix=self.stack['apix'])
			shutil.copy(tempfile,modelfile)
		if '(2 5 3)' in symmetry_description:
			apVolume.crowther2eman(modelfile, tempfile, apix=self.stack['apix'])
			shutil.copy(tempfile,modelfile)
    def start(self):
        self.setFileName()

        scale = float(self.params['oldapix']) / self.params['newapix']

        mrcname = os.path.join(self.params['rundir'],
                               self.params['name'] + ".mrc")
        origmodel = self.params['file']
        if os.path.isfile(mrcname):
            apDisplay.printError("File exists")

        if (abs(self.params['oldapix'] - self.params['newapix']) > 1.0e-2 or
                abs(self.params['oldbox'] - self.params['newbox']) > 1.0e-1):
            ### rescale old model to a new size
            apDisplay.printWarning("rescaling original model to a new size")
            scale = float(self.params['oldapix']) / self.params['newapix']
            apDisplay.printMsg("rescaling model by scale factor of %.4f" %
                               (scale))
            apVolume.rescaleVolume(origmodel, mrcname, self.params['oldapix'],
                                   self.params['newapix'],
                                   self.params['newbox'])
        else:
            ### simple upload, just copy file to models folder
            apDisplay.printMsg("copying original model to a new location: " +
                               mrcname)
            shutil.copyfile(origmodel, mrcname)

        if self.params['viper2eman'] is True:
            apVolume.viper2eman(mrcname, mrcname, apix=self.params['newapix'])

        ### render chimera images of model
        contour = self.params['contour']
        if self.params['mass'] is not None:
            apChimera.setVolumeMass(mrcname, self.params['newapix'],
                                    self.params['mass'])
            contour = 1.0
        apChimera.renderSnapshots(mrcname,
                                  contour=contour,
                                  zoom=self.params['zoom'],
                                  sym=self.params['symdata']['eman_name'])

        self.insertModel(mrcname)
Beispiel #6
0
    def start(self):
        self.apix = None
        self.mass = None
        self.setFileName()

        mrcname = self.params['name'] + ".mrc"
        ccp4name = self.params['name'] + ".ccp4"

        ### get emdb from web
        emdbfile = self.fetchEMDB(self.params['emdbid'], ccp4name)

        ### create density from emdb
        self.getXMLInfoFromEMDB(self.params['emdbid'])
        emancmd = ("proc3d " + ccp4name + " " + mrcname)
        apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
        apFile.removeFile(ccp4name)

        if self.params['viper2eman'] is True:
            apVolume.viper2eman(mrcname, mrcname, apix=self.apix)

        ### lowpass filter, do both atan2 and Gaussian filter to sum up to requested lowpass
        ### total lowpass = sqrt( lp1^2 + lp2^2 )
        if self.params['lowpass'] is not None:
            lp = self.params['lowpass'] / math.sqrt(2.0)
        emancmd = "proc3d %s %s apix=%.3f origin=0,0,0 norm=0,1 " % (
            mrcname, mrcname, self.apix)
        if self.params['lowpass'] is not None:
            emancmd += "tlp=%.2f lp=%.2f" % (lp, lp)
        apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)

        if self.mass is not None:
            apChimera.setVolumeMass(mrcname, apix=self.apix, mass=self.mass)

        ### chimera imaging
        apChimera.renderSnapshots(mrcname,
                                  contour=1.0,
                                  zoom=1.0,
                                  sym=self.params['symdata']['eman_name'])

        ### upload it
        self.uploadDensity(mrcname)
	def start(self):
		self.apix = None
		self.mass = None
		self.setFileName()

		mrcname = self.params['name']+".mrc"
		ccp4name = self.params['name']+".ccp4"

		### get emdb from web
		emdbfile = self.fetchEMDB(self.params['emdbid'], ccp4name)

		### create density from emdb
		self.getXMLInfoFromEMDB(self.params['emdbid'])
		emancmd = ("proc3d "+ccp4name+" "+mrcname)
		apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)
		apFile.removeFile(ccp4name)

		if self.params['viper2eman'] is True:
			apVolume.viper2eman(mrcname, mrcname, apix=self.apix)

		### lowpass filter, do both atan2 and Gaussian filter to sum up to requested lowpass
		### total lowpass = sqrt( lp1^2 + lp2^2 )
		if self.params['lowpass'] is not None:
			lp = self.params['lowpass']/math.sqrt(2.0)
		emancmd = "proc3d %s %s apix=%.3f origin=0,0,0 norm=0,1 " %(mrcname, mrcname, self.apix)
		if self.params['lowpass'] is not None:
			emancmd += "tlp=%.2f lp=%.2f" % (lp, lp)
		apEMAN.executeEmanCmd(emancmd, verbose=False, showcmd=True)

		if self.mass is not None:
			apChimera.setVolumeMass(mrcname, apix=self.apix, mass=self.mass)

		### chimera imaging
		apChimera.renderSnapshots(mrcname, contour=1.0, zoom=1.0, sym=self.params['symdata']['eman_name'])

		### upload it
		self.uploadDensity(mrcname)