Exemple #1
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)
Exemple #2
0
    def generateCCP4DensMap(self,
                            labelsInit=[], labelsLater=[]):

        # run FFT job to generate density map

        self.printStepNumber()

        densMap = '{}{}_FFT.map'.format(self.outputDir, self.densMapNaming)

        if self.densMapType in ('DIFF', 'HIGHONLY'):
            # note that the distinction in these options only comes
            # apparent in FFTjob.py. Even though HIGHONLY'
            # calculate maps using only the later dataset info, dummy
            # information for labelsInit is provided anyway for simplicity
            tags = ['FP_', 'SIGFP_', 'FOM_']
            labelsInit = [i+self.Mtz1LabelRename for i in tags] +\
                         ['PHIC_'+self.Mtz3LabelRename]
            labelsLater = [i+self.Mtz2LabelRename for i in tags] +\
                          ['PHIC_'+self.Mtz3LabelRename]

        if self.densMapType == '2FOFC':
            if self.useLaterCellDims:
                labelsInit = ['']*4
                labelsLater = ['FWT{}'.format(self.Mtz2LabelRename),
                               '', '', 'PHIC']
            else:
                labelsLater = ['']*4
                labelsInit = ['FWT{}'.format(self.Mtz2LabelRename),
                              '', '', 'PHIC']

        if self.densMapType != 'END':

            fft = FFTjob(
                mapType=self.densMapType, mapTag=self.mapTag,
                FOMweight=self.FOMweight, runLog=self.runLog,
                pdbFile=self.reorderedPDBFile, outputMapFile=densMap,
                mtzFile=self.densMapMtz, useSigLabs=not self.ignoreSIGFs,
                outputDir=self.outputDir, axes=self.axes,
                gridSamps=self.gridSamps, labels1=labelsLater,
                labels2=labelsInit,
                lowResCutoff=self.mapResLimits.split(',')[1],
                highResCutoff=self.mapResLimits.split(',')[0])

            if self.useLaterCellDims:
                fft.labels1 = labelsLater
                fft.labels2 = labelsInit
            else:
                fft.labels1 = labelsInit
                fft.labels2 = labelsLater

            success = fft.run()
            self.densityMap = fft.outputMapFile

            if success and not self.useLaterCellDims:
                m = self.multiplyMapByFactor(map=self.densityMap)
                self.densityMap = m

        else:
            # run END job if required (may take time to run!!)
            endInputPDB = self.inputPDBfile
            endInputMTZ = ''.join(endInputPDB.split('.')[:-1]+['.mtz'])
            endInputEFF = ''.join(endInputPDB.split('.')[:-1]+['.eff'])

            end = ENDjob(pdbFile=endInputPDB, mtzFile=endInputMTZ,
                         effFile=endInputEFF, outputDir=self.outputDir,
                         gridSamps=self.gridSamps, runLog=self.runLog)
            success = end.run()
            self.densityMap = end.outputMapFile

        if not success:
            error(text='Failure to successfully generate density map',
                  log=self.runLog)