def cropMapToAtomTaggedMap(self, densMap='untitled.map'): # crop the density map to exact same dimensions # as SFALL atom-tagged map # run MAPMASK job to crop fft density map to asym unit mapmask2 = MAPMASKjob(mapFile1=densMap, outputDir=self.outputDir, runLog=self.runLog) success = mapmask2.crop2AsymUnit() if not success: return False # run MAPMASK job to crop fft density map to same # grid sampling dimensions as SFALL atom map mapmask3 = MAPMASKjob(mapFile1=mapmask2.outputMapFile, mapFile2=self.atomTaggedMap, outputDir=self.outputDir, runLog=self.runLog) success = mapmask3.cropMap2Map() croppedDensityMap = mapmask3.outputMapFile if not success: error(text='Failure to successfully crop atom map', log=self.runLog) else: return croppedDensityMap
def multiplyMapByFactor(self, factor=-1.0, map='./untitled.map'): # multiply all points in a density map by a value. # useful to switch positive and negative in a map mapmask = MAPMASKjob(mapFile1=map, outputDir=self.outputDir, runLog=self.runLog) mapmask.multiplyByFactor(factor=factor, symGroup=self.spaceGroup) return mapmask.outputMapFile
def cropAtmTaggedMapToAsymUnit(self): # crop atom-tagged map to asymmetric unit: self.printStepNumber() mapmask1 = MAPMASKjob(mapFile1 = self.atomTaggedMap, outputDir = self.outputDir, runLog = self.runLog) success = mapmask1.crop2AsymUnit() self.atomTaggedMap = mapmask1.outputMapFile return success
def cropAtmTaggedMapToAsymUnit(self): # crop atom-tagged map to asymmetric unit: self.printStepNumber() mapmask1 = MAPMASKjob(mapFile1=self.atomTaggedMap, outputDir=self.outputDir, runLog=self.runLog) success = mapmask1.crop2AsymUnit() if not success: error(text='Failure to crop map in MAPMASK', log=self.runLog) self.atomTaggedMap = mapmask1.outputMapFile
def ensureSameMapAxesOrder(self): # switch map axes to match SFALL atom-tagged map if # required(only typically required for END maps) mapmask = MAPMASKjob(mapFile1 = self.densityMap, outputDir = self.outputDir, runLog = self.runLog) success = mapmask.switchAxisOrder(order = self.axes, symGroup = self.spaceGroup) self.densityMap = mapmask.outputMapFile return success
def cropMapToModel(self, map=''): # crop a map to the input coordinate model self.printStepNumber() mapmask1 = MAPMASKjob( mapFile1=map, pdbFile=self.inputPDBfile, outputDir=self.outputDir, runLog=self.runLog) success = mapmask1.crop2model(spaceGroup=self.spaceGroup) if not success: error(text='Failure to crop map in MAPMASK', log=self.runLog) croppedMap = mapmask1.outputMapFile return croppedMap
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