Example #1
0
    def getAtomTaggedMap(self):

        # run SFALL job to generate atom tagged map

        self.printStepNumber()

        sfall = SFALLjob(inputPDBfile=self.reorderedPDBFile,
                         outputDir=self.outputDir, VDWR=self.sfall_VDWR,
                         symmetrygroup=self.spaceGroup, runLog=self.runLog,
                         outputMapFile=self.atomTaggedMap,
                         gridDimensions=self.sfallGRIDdims)
        success = sfall.run()

        sfallMap = mapTools(mapName=self.atomTaggedMap)
        self.axes = [sfallMap.fastaxis, sfallMap.medaxis, sfallMap.slowaxis]
        self.gridSamps = [sfallMap.gridsamp1, sfallMap.gridsamp2,
                          sfallMap.gridsamp3]

        if not success:
            error(text='Failure to successfully generate tagged atom map',
                  log=self.runLog)
Example #2
0
	def getAtomTaggedMap(self):

		# run SFALL job to generate atom tagged map

		self.printStepNumber()
		sfall = SFALLjob(inputPDBfile   = self.reorderedPDBFile,
						 outputDir      = self.outputDir,
						 VDWR           = self.sfall_VDWR,
						 symmetrygroup  = self.spaceGroup,
						 gridDimensions = self.sfall_GRID,
						 runLog         = self.runLog)
		success = sfall.run()

		sfallMap  = mapTools(mapName = sfall.outputMapFile)
		self.axes 	   = [sfallMap.fastaxis,
					 	  sfallMap.medaxis,
					      sfallMap.slowaxis]
		self.gridSamps = [sfallMap.gridsamp1,
					 	  sfallMap.gridsamp2,
					 	  sfallMap.gridsamp3]

		self.atomTaggedMap = sfall.outputMapFile

		return success
Example #3
0
    def generateFcalcMap(self,
                         method=3):

        # generate FC map. Three methods have currently been proposed:
        # In 1, the Fcalc map is calculated using the FC and PHIC cols
        # in the supplied phase dataset.. due to the order of columns
        # in the input mtz file, the map will take the unit cell dims
        # of the later dataset.
        # In 2, the Fcalc map is also calculated from the phase dataset
        # mtz, however is forced to take the cell dims of dataset 1.
        # In 3, the Fcalc and PHIC cols are instead generated from a
        # pdb file, and so take the cell dims of that pdb file also.
        # The important thing here is that the Fcalc map dimensions
        # must match those of the atom-map at the same dose. If the PDB
        # file is varied between datasets, then only methods 1 and 3
        # will allow this. It may be wise to use method 3 as default
        # since this does not depend on a separate mtz file for phases

        self.printStepNumber()

        fft_FC = FFTjob(
            FOMweight=self.FOMweight, pdbFile=self.reorderedPDBFile,
            outputDir=self.outputDir, axes=self.axes,
            gridSamps=self.gridSamps, runLog=self.runLog)

        if method == 1:
            fcLabels = ['FC_{}'.format(self.Mtz3LabelRename), '', '',
                        'PHIC_'+self.Mtz3LabelRename]

            fft_FC.inputMtzFile = self.fcalcMtz
            fft_FC.mapType = 'FC'
            fft_FC.labels1 = fcLabels

            success = fft_FC.run()
            self.FcalcMap = fft_FC.outputMapFile

        elif method == 2:
            tags = ['FP_', 'SIGFP_', 'FOM_']
            labels1 = [i+self.Mtz2LabelRename for i in tags] +\
                      ['PHIC_'+self.Mtz3LabelRename]
            labels2 = ['FC_{}'.format(self.Mtz3LabelRename), '', '',
                       'PHIC_'+self.Mtz3LabelRename]

            fft_FC.mapType = 'DIFF'
            fft_FC.mapTag = 'FC'
            fft_FC.inputMtzFile = self.fcalcMtz
            fft_FC.F1Scale = 0.0
            fft_FC.labels1 = labels1
            fft_FC.labels2 = labels2

            success = fft_FC.run()

            tmpMap = fft_FC.outputMapFile

            if success:
                m = self.multiplyMapByFactor(map=tmpMap)
                self.FcalcMap = m

        elif method == 3:
            sfall = SFALLjob(inputPDBfile=self.reorderedPDBFile,
                             outputDir=self.outputDir, VDWR=self.sfall_VDWR,
                             symmetrygroup=self.spaceGroup, runLog=self.runLog,
                             gridDimensions=self.sfallGRIDdims,
                             task='mtz from pdb')
            success = sfall.run()
            FcalcMtz = sfall.outputMtzFile

            fft_FC.inputMtzFile = FcalcMtz
            fft_FC.mapType = 'FC'
            fft_FC.labels1 = ['FCalc', '', '', 'PHICalc']

            success = fft_FC.run()
            self.FcalcMap = fft_FC.outputMapFile

        if not success:
            error(text='Failure to successfully generate Fcalc map',
                  log=self.runLog)
Example #4
0
	def runPipeline(self):

		# read input file first
		success = self.readInputFile()
		if success is False:
			return 1

		# create log file
		self.runLog = logFile('{}/{}_runLog_2.txt'.format(self.outputDir,self.jobName))

		# run pdbcur job 
		pdbcur = PDBCURjob(self.pdbcurPDBinputFile,self.outputDir,self.runLog)
		success = pdbcur.run()
		if success is False:
			return 2

		self.PDBCURoutputFile = pdbcur.outputPDBfile

		# reorder atoms in PDB file
		self.renumberPDBFile()

		# get space group from PDB file
		success = self.getSpaceGroup()
		if success is False:
			return 3

		# run SFALL job
		sfall = SFALLjob(self.reorderedPDBFile,self.outputDir,self.sfall_VDWR,
						 self.spaceGroup,self.sfall_GRID,'ATMMOD',self.runLog)
		success = sfall.run()
		if success is False:
			return 4

		# run FFT job
		sfallMap = mapTools(sfall.outputMapFile)
		axes = [sfallMap.fastaxis,sfallMap.medaxis,sfallMap.slowaxis]
		gridSamps = [sfallMap.gridsamp1,sfallMap.gridsamp2,sfallMap.gridsamp3]
		labelsInit = ['FP_'+self.initPDB,'SIGFP_'+self.initPDB,'FOM_'+self.initPDB,'PHIC_'+self.initPDB]
		labelsLater = ['FP_'+self.laterPDB,'SIGFP_'+self.laterPDB,'FOM_'+self.laterPDB,'PHIC_'+self.laterPDB]
		
		if self.densMapType != 'END':
			fft = FFTjob(self.densMapType,self.FOMweight,self.reorderedPDBFile,self.inputMtzFile,
						 self.outputDir,axes,gridSamps,labelsLater,labelsInit,self.runLog)
			success = fft.run()
		else:
			# run END job if required (may take time to run!!)
			endInputPDB = self.pdbcurPDBinputFile
			endInputMTZ = ''.join(endInputPDB.split('.')[:-1]+['.mtz'])
			endInputEFF = ''.join(endInputPDB.split('.')[:-1]+['.eff'])
			end = ENDjob(endInputPDB,endInputMTZ,endInputEFF,self.outputDir,gridSamps,self.runLog)
			success = end.run()

		if success is False:
			return 5

		# crop fft and atom-tagged maps to asymmetric unit:
		mapmask1 = MAPMASKjob(sfall.outputMapFile,'',self.outputDir,self.runLog)
		success = mapmask1.crop2AsymUnit()
		if success is False:
			return 6

		# choose correct density map to include in MAPMASK cropping below
		if self.densMapType != 'END':
			inputDensMap = fft.outputMapFile
		else: 
			inputDensMap = end.outputMapFile

		# switch END map axes to match SFALL atom-tagged map if required
		if self.densMapType == 'END':
			mapmask_ENDmap = MAPMASKjob(inputDensMap,'',self.outputDir,self.runLog)
			success = mapmask_ENDmap.switchAxisOrder(axes,self.spaceGroup)
		if success is False:
			return 7.0
		else: inputDensMap = mapmask_ENDmap.outputMapFile

		# run MAPMASK job to crop fft density map to asym unit
		mapmask2 = MAPMASKjob(inputDensMap,'',self.outputDir,self.runLog)
		success = mapmask2.crop2AsymUnit()
		if success is False:
			return 7.1

		# run MAPMASK job to crop fft density map to same grid 
		# sampling dimensions as SFALL atom map
		mapmask3 = MAPMASKjob(mapmask2.outputMapFile,mapmask1.outputMapFile,self.outputDir,self.runLog)
		success = mapmask3.cropMap2Map()
		if success is False:
			return 8

		# perform map consistency check between cropped fft and sfall maps
		fftMap = mapTools(mapmask3.outputMapFile)
		fftMap.readHeader()
		sfallMap = mapTools(mapmask1.outputMapFile)
		sfallMap.readHeader()
		success = self.mapConsistencyCheck(sfallMap,fftMap)
		if success is False:
			return 9
		else:
			return 0