def runSIGMAA(self): title = 'run of sigma-a' fillerLine() cmd1 = 'sfall ' +\ 'HKLIN {} '.format(self.inputMtz) +\ 'HKLOUT {} '.format(self.tmpMtz) +\ 'XYZIN {}'.format(self.inputPDB) cmd2 = 'title {}\n'.format(title) +\ 'LABIN FP=F{} SIGFP=SIGF{} FREE={}\n'.format( self.LabelName, self.LabelName, self.RfreeFlag) +\ 'labout -\nFC=FC PHIC=PHIC\nMODE SFCALC -\n' +\ 'XYZIN -\nHKLIN\nsymmetry {}\n'.format(self.spaceGroup) if self.noScale is True: self.commandInput2 += 'NOSCALE\nend' else: self.commandInput2 += 'end' self.outputLogfile = 'SIGMAAlogfile1.txt' # run SFALL job within SIGMAA routine job = ccp4Job(jobName='SFALL', commandInput1=cmd1, commandInput2=cmd2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.tmpMtz) self.jobSuccess = job.checkJobSuccess(self.runLog) if not self.jobSuccess: return cmd1 = 'sigmaa ' +\ 'HKLIN {} '.format(self.tmpMtz) +\ 'HKLOUT {} '.format(self.outputMtz) cmd2 = 'title {}\n'.format(title) +\ 'LABIN FP=F{} SIGFP=SIGF{} FC=FC PHIC=PHIC\n'.format( *([self.LabelName]*2)) +\ 'labout -\nDELFWT=DELFWT{} FWT=FWT{} WCMB=FOM{}\n'.format( *([self.LabelRename]*3)) +\ 'ranges 20 -\n1000\nsymmetry "{}"\n'.format(self.spaceGroup) +\ 'partial -\ndamp 1.0\nend' self.outputLogfile = 'SIGMAAlogfile2.txt' # run SIGMAA next job = ccp4Job(jobName='SIGMAA', commandInput1=cmd1, commandInput2=cmd2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMtz) self.jobSuccess = job.checkJobSuccess()
def switchAxisOrder(self, order=[], symGroup="", includeDir=False): # switch the axis order of an input .map file. # order = [1,2,3] for example self.defineCorrectOutputMap(switch=True) xyz = {'1': 'X', '2': 'Y', '3': 'Z'} axisOrder = [xyz[str(i)] for i in order] self.printPurpose(mode='switch axes', axisOrder=axisOrder) inputFiles = [self.inputMapFile] if not checkInputsExist(inputFiles, self.runLog): return False self.defineCommandInput() self.commandInput2 = 'SYMMETRY {}\nAXIS {}\nEND'.format( symGroup, ' '.join(axisOrder)) self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName='MAPMASK_switchAxisOrder', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile) self.jobSuccess = job.checkJobSuccess(self.runLog) success = self.provideFeedback() return success
def multiplyByFactor(self, includeDir=False, factor=-1.0, symGroup=""): # multiply all points in a density # map file by a constant factor self.printPurpose(mode='Multiply by factor') self.defineCorrectOutputMap(factorMultiply=True) inputFiles = [self.inputMapFile] if not checkInputsExist(inputFiles, self.runLog): return False self.defineCommandInput() self.commandInput2 = 'SYMMETRY {}\nSCALE -\nFACTOR {} 0.0\nEND'.format( symGroup, factor) self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName='MAPMASK_multipyByFactor', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile) self.jobSuccess = job.checkJobSuccess(self.runLog) success = self.provideFeedback() return success
def crop2model(self, includeDir=False, spaceGroup='P1'): # crop map to an input coordinate model self.printPurpose(mode='crop to model') self.defineCorrectOutputMap() inputFiles = [self.inputMapFile, self.inputPdbFile] if not checkInputsExist(inputFiles, self.runLog): return False self.defineCommandInput() self.commandInput2 = 'SYMMETRY {}\nBORDER 1'.format(spaceGroup) self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName='MAPMASK_crop2Model', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile) self.jobSuccess = job.checkJobSuccess(self.runLog) success = self.provideFeedback() return success
def runSCALEIT(self): # run SCALEIT job to scale 2nd dataset Fs against 1st datasets title = 'run of scaleit' # run SCALEIT from command line self.commandInput1 = 'scaleit '+\ 'HKLIN {} '.format(self.inputMtz)+\ 'HKLOUT {}'.format(self.outputMtz) self.commandInput2 = 'title SCALEIT JOB\n'+\ 'NOWT\n'+\ 'converge NCYC 4\n'+\ 'converge ABS 0.001\n'+\ 'converge TOLR -7\n'+\ 'REFINE ANISOTROPIC\n'+\ 'auto\n'+\ 'LABIN FP=FP_{} SIGFP=SIGFP_{} -\n'.format(self.Mtz1Label, self.Mtz1Label)+\ ' FPH1=FP_{} SIGFPH1=SIGFP_{}\n'.format(self.Mtz2Label, self.Mtz2Label)+\ 'END' self.outputLogfile = 'SCALEITlogfile.txt' # run SCALEIT job job = ccp4Job('SCALEIT',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.outputMtz) self.jobSuccess = job.checkJobSuccess()
def runFFT(self): self.commandInput1 = 'fft '+\ 'HKLIN {} '.format(self.inputMtzFile)+\ 'MAPOUT {} '.format(self.outputMapFile)+\ 'SYMINFO syminfo.lib ' # can distinguish here between SIMPLE and DIFFERENCE map types if self.mapType == 'SIMPLE': F2Scale = 0.0 else: F2Scale = 1.0 #if a FOM is specified exists the weighting is applied to the map if self.FOMweight in ('True','TRUE','true'): FOMstring = 'W={}'.format(self.FOM2) FOMstring2 = 'W2={}'.format(self.FOM2) else: FOMstring = '' self.commandInput2 = 'AXIS {} {} {}\n'.format(self.fastAxis,self.medAxis,self.slowAxis)+\ 'title FTT DENSITY MAP RUN\n'+\ 'grid {} {} {}\n'.format(self.gridSamp1,self.gridSamp2,self.gridSamp3)+\ 'xyzlim 0 1 0 1 0 1\n'+\ 'LABIN F1={} SIG1={} F2={} SIG2={} '.format(self.F1,self.SIG1,self.F2,self.SIG2)+\ 'PHI={} {} PHI2={} {}\n'.format(self.PHI2,FOMstring,self.PHI2,FOMstring2)+\ 'SCALE F1 1.0 0.0 F2 {} 0.0\n'.format(F2Scale)+\ 'END' self.outputLogfile = 'FFTlogfile.txt' # run FFT job job = ccp4Job('FFT',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.outputMapFile) self.jobSuccess = job.checkJobSuccess()
def cropMap2Map(self, includeDir = False): # Crop map 1 to map 2 # fillerLine() self.printPurpose(mode = 'crop to map') self.defineCorrectOutputMap(False) inputFiles = [self.inputMapFile,self.inputMapFile2] if not checkInputsExist(inputFiles,self.runLog): return False maps = [self.inputMapFile,self.inputMapFile2] if not includeDir: maps = [m.split('/')[-1] for m in maps] self.defineCommandInput() self.commandInput2 = 'EXTEND\nXYZLIM MATCH\nEND' self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName = 'MAPMASK_cropMap2Map', commandInput1 = self.commandInput1, commandInput2 = self.commandInput2, outputDir = self.outputDir, outputLog = self.outputLogfile, outputFile = self.outputMapFile) self.jobSuccess = job.checkJobSuccess() success = self.provideFeedback() return success
def extend2UnitCell(self, includeDir=False, symGroup=1): # extend map 1 to the unit cell limits self.printPurpose(mode='extend to unit cell') self.defineCorrectOutputMap() inputFiles = [self.inputMapFile] if not checkInputsExist(inputFiles, self.runLog): return False self.defineCommandInput() self.commandInput2 = 'SYMMETRY {}\nXYZLIM CELL\nEND'.format(symGroup) self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName='MAPMASK_extend2UnitCell', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile) self.jobSuccess = job.checkJobSuccess(self.runLog) success = self.provideFeedback() return success
def runSCALEIT(self): # run SCALEIT job to scale 2nd dataset Fs against 1st datasets self.printPurpose() # run SCALEIT from command line self.commandInput1 = 'scaleit ' +\ 'HKLIN {} '.format(self.inputMtz) +\ 'HKLOUT {}'.format(self.outputMtz) self.commandInput2 = 'title SCALEIT JOB\n' +\ 'NOWT\n' +\ 'converge NCYC 4\n' +\ 'converge ABS 0.001\n' +\ 'converge TOLR -7\n' +\ 'REFINE {}\n'.format(self.scaling) +\ 'auto\n' +\ 'LABIN FP=FP_{} SIGFP=SIGFP_{} -\n'.format( self.Mtz1Label, self.Mtz1Label) +\ ' FPH1=FP_{} SIGFPH1=SIGFP_{}\n'.format( self.Mtz2Label, self.Mtz2Label) +\ 'END' self.outputLogfile = 'SCALEITlogfile.txt' # run SCALEIT job job = ccp4Job(jobName='SCALEIT', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMtz) self.jobSuccess = job.checkJobSuccess(self.runLog)
def crop2AsymUnit(self, includeDir = False): # Crop map 1 to asymmetric unit # fillerLine() self.printPurpose(mode = 'crop to asym') self.defineCorrectOutputMap(False) inputFiles = [self.inputMapFile] if not checkInputsExist(inputFiles,self.runLog): return False if not includeDir: map1 = self.inputMapFile.split('/')[-1] else: map1 = self.inputMapFile self.defineCommandInput() self.commandInput2 = 'EXTEND\nXYZLIM ASU\nEND' self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job(jobName = 'MAPMASK_crop2AsymUnit', commandInput1 = self.commandInput1, commandInput2 = self.commandInput2, outputDir = self.outputDir, outputLog = self.outputLogfile, outputFile = self.outputMapFile) self.jobSuccess = job.checkJobSuccess() success = self.provideFeedback() return success
def runSIGMAA(self): title = 'run of sigma-a' self.commandInput1 = 'sfall '+\ 'HKLIN {} '.format(self.inputMtz)+\ 'HKLOUT {} '.format(self.tmpMtz)+\ 'XYZIN {}'.format(self.inputPDB) self.commandInput2 = 'title {}\n'.format(title)+\ 'LABIN FP=F{} SIGFP=SIGF{} FREE={}\n'.format(self.LabelName,self.LabelName,self.RfreeFlag)+\ 'labout -\n'+\ 'FC=FC PHIC=PHIC\n'+\ 'MODE SFCALC -\n'+\ 'XYZIN -\n'+\ 'HKLIN\n'+\ 'symmetry {}\n'.format(self.spaceGroup)+\ 'end' self.outputLogfile = 'SIGMAAlogfile1.txt' # run SFALL job within SIGMAA routine job = ccp4Job('SFALL',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.tmpMtz) self.jobSuccess = job.checkJobSuccess() if self.jobSuccess is False: return self.commandInput1 = 'sigmaa '+\ 'HKLIN {} '.format(self.tmpMtz)+\ 'HKLOUT {} '.format(self.outputMtz) self.commandInput2 = 'title {}\n'.format(title)+\ 'LABIN FP=F{} SIGFP=SIGF{} FC=FC PHIC=PHIC\n'.format(self.LabelName,self.LabelName)+\ 'labout -\n'+\ 'DELFWT=DELFWT FWT=FWT WCMB=FOM{}\n'.format(self.LabelName)+\ 'ranges 20 -\n'+\ '1000\n'+\ 'symmetry "{}"\n'.format(self.spaceGroup)+\ 'partial -\n'+\ 'damp 1.0\n'+\ 'end' self.outputLogfile = 'SIGMAAlogfile2.txt' # run SIGMAA next job = ccp4Job('SIGMAA',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.outputMtz) self.jobSuccess = job.checkJobSuccess()
def runCAD(self): # fillerLine() self.printPurpose() title = 'run of cad' self.commandInput1 = 'cad '+\ 'HKLIN1 {} '.format(self.inputMtz1)+\ 'HKLIN2 {} '.format(self.inputMtz2)+\ 'HKLIN3 {} '.format(self.inputMtz3)+\ 'HKLOUT {}'.format(self.outputMtz) self.commandInput2 = 'title CAD JOB\n'+\ 'monitor BRIEF\n'+\ 'labin file 1 - \n'+\ 'E1 = F{} - \n'.format(self.labels[0])+\ 'E2 = SIGF{} '.format(self.labels[0])+\ '{} \n'.format(self.FOMtag['in'])+\ 'labout file 1 - \n'+\ 'E1 = FP_{} - \n'.format(self.renameLabels[0])+\ 'E2 = SIGFP_{} '.format(self.renameLabels[0])+\ '{} \n'.format(self.FOMtag['out'])+\ 'ctypin file 1 - \n'+\ 'E1 = F - \n'+\ 'E2 = Q '+\ '{} \n'.format(self.FOMtag['type'])+\ 'labin file 2 - \n'+\ 'E1 = F{} - \n'.format(self.labels[1])+\ 'E2 = SIGF{} \n'.format(self.labels[1])+\ 'labout file 2 - \n'+\ 'E1 = FP_{} - \n'.format(self.renameLabels[1])+\ 'E2 = SIGFP_{} \n'.format(self.renameLabels[1])+\ 'ctypin file 2 - \n'+\ 'E1 = F - \n'+\ 'E2 = Q \n'+\ 'labin file 3 - \n'+\ 'E1 = {} -\n'.format(self.labels[2])+\ 'E2 = {} \n'.format(self.labels[3])+\ 'labout file 3 - \n'+\ 'E1 = PHIC_{} - \n'.format(self.renameLabels[2])+\ 'E2 = FC_{} \n'.format(self.renameLabels[2])+\ 'ctypin file 3 - \n'+\ 'E1 = P -\n'+\ 'E2 = F \n' self.outputLogfile = 'CADlogfile.txt' # run CAD job job = ccp4Job(jobName = 'CAD', commandInput1 = self.commandInput1, commandInput2 = self.commandInput2, outputDir = self.outputDir, outputLog = self.outputLogfile, outputFile = self.outputMtz) self.jobSuccess = job.checkJobSuccess()
def runNCONT(self): # the actual running part here self.commandInput1 = 'ncont ' +\ 'XYZIN {} '.format(self.inputPDBfile) self.commandInput2 = 'source "*"\ntarget "*"\nmindist 0.0\n' +\ 'maxdist 4.0\ncells 1\n' +\ 'symm {}\nEND'.format(self.symGroup) self.outputLogfile = '{}-NCONTlogfile.txt'.format(self.seriesName) # run NCONT job job = ccp4Job('NCONT', self.commandInput1, self.commandInput2, self.outputDir, self.outputLogfile, self.outputDir+'/'+self.outputLogfile) self.jobSuccess = job.checkJobSuccess(self.runLog)
def cropMap2Map(self): # Crop map 1 to map 2 self.defineCorrectOutputMap(False) inputFiles = [self.inputMapFile,self.inputMapFile2] if checkInputsExist(inputFiles,self.runLog) is False: return False self.runLog.writeToLog('Cropping map "{}" to map "{}"'.format(self.inputMapFile,self.inputMapFile2)) self.defineCommandInput() self.commandInput2 = 'EXTEND\nXYZLIM MATCH\nEND' self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job('MAPMASK_cropMap2Map',self.commandInput1,self.commandInput2, self.outputDir,self.outputLogfile,self.outputMapFile) self.jobSuccess = job.checkJobSuccess() success = self.provideFeedback() return success
def runCAD(self): title = 'run of cad' self.commandInput1 = 'cad '+\ 'HKLIN1 {} '.format(self.inputMtz1)+\ 'HKLIN2 {} '.format(self.inputMtz2)+\ 'HKLIN3 {} '.format(self.inputMtz3)+\ 'HKLOUT {}'.format(self.outputMtz) self.commandInput2 = 'title CAD JOB\n'+\ 'monitor BRIEF\n'+\ 'labin file 1 - \n'+\ 'E1 = F{} - \n'.format(self.labels[0])+\ 'E2 = SIGF{} - \n'.format(self.labels[0])+\ 'E3 = FOM{} \n'.format(self.labels[0])+\ 'labout file 1 - \n'+\ 'E1 = FP_{} - \n'.format(self.renameLabels[0])+\ 'E2 = SIGFP_{} - \n'.format(self.renameLabels[0])+\ 'E3 = FOM_{} \n'.format(self.renameLabels[0])+\ 'ctypin file 1 - \n'+\ 'E1 = F - \n'+\ 'E2 = Q - \n'+\ 'E3 = W \n'+\ 'labin file 2 - \n'+\ 'E1 = F{} - \n'.format(self.labels[1])+\ 'E2 = SIGF{} \n'.format(self.labels[1])+\ 'labout file 2 - \n'+\ 'E1 = FP_{} - \n'.format(self.renameLabels[1])+\ 'E2 = SIGFP_{} \n'.format(self.renameLabels[1])+\ 'ctypin file 2 - \n'+\ 'E1 = F - \n'+\ 'E2 = Q \n'+\ 'labin file 3 - \n'+\ 'E1 = PHI{} \n'.format(self.labels[2])+\ 'labout file 3 - \n'+\ 'E1 = PHIC_{} \n'.format(self.renameLabels[2])+\ 'ctypin file 3 - \n'+\ 'E1 = P \n' self.outputLogfile = 'CADlogfile.txt' # run CAD job job = ccp4Job('CAD',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.outputMtz) self.jobSuccess = job.checkJobSuccess()
def switchAxisOrder(self,order,symGroup): # switch the axis order of an input .map file. order = [1,2,3] for example self.defineCorrectOutputMap(True) xyz = {'1':'X','2':'Y','3':'Z'} axisOrder = [xyz[str(i)] for i in order] inputFiles = [self.inputMapFile] if checkInputsExist(inputFiles,self.runLog) is False: return False self.runLog.writeToLog('Switching map "{}" axis ordering to {}'.format(self.inputMapFile,axisOrder)) self.defineCommandInput() self.commandInput2 = 'SYMMETRY {}\nAXIS {}\nEND'.format(symGroup,' '.join(axisOrder)) self.outputLogfile = 'MAPMASKlogfile.txt' # run MAPMASK job job = ccp4Job('MAPMASK_switchAxisOrder',self.commandInput1,self.commandInput2, self.outputDir,self.outputLogfile,self.outputMapFile) self.jobSuccess = job.checkJobSuccess() success = self.provideFeedback() return success
def runSFALL(self): # run SFALL job using the external ccp4Job class self.printPurpose() title = 'run of sfall' self.commandInput1 = 'sfall '+\ 'XYZIN {} '.format(self.inputPDBfile)+\ 'ATOMSF atomsf.lib '+\ 'MAPOUT {} '.format(self.outputMapFile)+\ 'SYMINFO syminfo.lib ' if len(self.gridDims) == 0: self.commandInput2 = 'MODE ATMMAP {}\n'.format(self.mapoutType)+\ 'SYMMETRY {}\n'.format(self.symGroup)+\ 'VDWR {}\n'.format(self.VDWR)+\ 'title {}\n'.format(title)+\ 'END' else: self.commandInput2 = 'MODE ATMMAP {}\n'.format(self.mapoutType)+\ 'SYMMETRY {}\n'.format(self.symGroup)+\ 'VDWR {}\n'.format(self.VDWR)+\ 'title {}\n'.format(title)+\ 'GRID {} {} {}\n'.format(self.gridDims[0],self.gridDims[1],self.gridDims[2])+\ 'END' self.outputLogfile = 'SFALLlogfile.txt' # run SFALL job job = ccp4Job(jobName = 'SFALL', commandInput1 = self.commandInput1, commandInput2 = self.commandInput2, outputDir = self.outputDir, outputLog = self.outputLogfile, outputFile = self.outputMapFile) self.jobSuccess = job.checkJobSuccess()
def runPDBCUR(self): # PDBcur job to specify to remove hydrogen atoms and pick on the most probably conformation # (for two conformations with 0.5 occupancy, the first - A is chosen and occupancy # set to 1.00). Also remove all anisou info from file - since it is not needed for # current analysis self.jobName = 'PDBCUR' # run PDBCUR from command line self.commandInput1 = 'pdbcur '+\ 'XYZIN {} '.format(self.inputPDBfile)+\ 'XYZOUT {} '.format(self.outputPDBfile) self.commandInput2 = 'delhydrogen\n'+\ 'mostprob\n'+\ 'noanisou\n'+\ 'END' self.outputLogfile = 'PDBCURlogfile.txt' # run PDBCUR job job = ccp4Job('PDBCUR',self.commandInput1,self.commandInput2,self.outputDir,self.outputLogfile,self.outputPDBfile) self.jobSuccess = job.checkJobSuccess()
def runCAD(self): self.printPurpose() if not self.ignoreDset1: cmd1 = 'cad ' +\ 'HKLIN1 {} '.format(self.inputMtz1) +\ 'HKLIN2 {} '.format(self.inputMtz2) +\ 'HKLIN3 {} '.format(self.inputMtz3) +\ 'HKLOUT {}'.format(self.outputMtz) if not self.ignoreSIGFs: cmd2 = 'title CAD JOB\n' +\ 'monitor BRIEF\n' +\ 'labin file 1 - \n' +\ 'E1 = {} - \n'.format(self.Mtz1FPlabel) +\ 'E2 = {} '.format(self.Mtz1SIGFPlabel) +\ '{} \n'.format(self.FOMtag['in']) +\ 'labout file 1 - \n' +\ 'E1 = FP_{} - \n'.format(self.renameLabels[0]) +\ 'E2 = SIGFP_{} '.format(self.renameLabels[0]) +\ '{} \n'.format(self.FOMtag['out']) +\ 'ctypin file 1 - \n' +\ 'E1 = F - \n' +\ 'E2 = Q ' +\ '{} \n'.format(self.FOMtag['type']) +\ 'labin file 2 - \n' +\ 'E1 = {} - \n'.format(self.Mtz2FPlabel) +\ 'E2 = {} \n'.format(self.Mtz2SIGFPlabel) +\ 'labout file 2 - \n' +\ 'E1 = FP_{} - \n'.format(self.renameLabels[1]) +\ 'E2 = SIGFP_{} \n'.format(self.renameLabels[1]) +\ 'ctypin file 2 - \n' +\ 'E1 = F - \n' +\ 'E2 = Q \n' +\ 'labin file 3 - \n' +\ 'E1 = {} -\n'.format(self.Mtz3phaseLabel) +\ 'E2 = {} \n'.format(self.Mtz3FcalcLabel) +\ 'labout file 3 - \n' +\ 'E1 = PHIC_{} - \n'.format(self.renameLabels[2]) +\ 'E2 = FC_{} \n'.format(self.renameLabels[2]) +\ 'ctypin file 3 - \n' +\ 'E1 = P -\n' +\ 'E2 = F \n' else: cmd2 = 'title CAD JOB\n' +\ 'monitor BRIEF\n' +\ 'labin file 1 - \n' +\ 'E1 = {} \n'.format(self.Mtz1FPlabel) +\ '{} \n'.format(self.FOMtag['in']) +\ 'labout file 1 - \n' +\ 'E1 = FP_{} \n'.format(self.renameLabels[0]) +\ '{} \n'.format(self.FOMtag['out']) +\ 'ctypin file 1 - \n' +\ 'E1 = F \n' +\ '{} \n'.format(self.FOMtag['type']) +\ 'labin file 2 - \n' +\ 'E1 = {} \n'.format(self.Mtz2FPlabel) +\ 'labout file 2 - \n' +\ 'E1 = FP_{} \n'.format(self.renameLabels[1]) +\ 'ctypin file 2 - \n' +\ 'E1 = F \n' +\ 'labin file 3 - \n' +\ 'E1 = {} -\n'.format(self.Mtz3phaseLabel) +\ 'E2 = {} \n'.format(self.Mtz3FcalcLabel) +\ 'labout file 3 - \n' +\ 'E1 = PHIC_{} - \n'.format(self.renameLabels[2]) +\ 'E2 = FC_{} \n'.format(self.renameLabels[2]) +\ 'ctypin file 3 - \n' +\ 'E1 = P -\n' +\ 'E2 = F \n' else: cmd1 = 'cad ' +\ 'HKLIN1 {} '.format(self.inputMtz2) +\ 'HKLIN2 {} '.format(self.inputMtz3) +\ 'HKLOUT {}'.format(self.outputMtz) if not self.ignoreSIGFs: cmd2 = 'title CAD JOB\n' +\ 'monitor BRIEF\n' +\ 'labin file 1 - \n' +\ 'E1 = {} - \n'.format(self.Mtz2FPlabel) +\ 'E2 = {} \n'.format(self.Mtz2SIGFPlabel) +\ 'labout file 1 - \n' +\ 'E1 = FP_{} - \n'.format(self.renameLabels[1]) +\ 'E2 = SIGFP_{} \n'.format(self.renameLabels[1]) +\ 'ctypin file 1 - \n' +\ 'E1 = F - \n' +\ 'E2 = Q \n' +\ 'labin file 2 - \n' +\ 'E1 = {} -\n'.format(self.Mtz3phaseLabel) +\ 'E2 = {} \n'.format(self.Mtz3FcalcLabel) +\ 'labout file 2 - \n' +\ 'E1 = PHIC_{} - \n'.format(self.renameLabels[2]) +\ 'E2 = FC_{} \n'.format(self.renameLabels[2]) +\ 'ctypin file 2 - \n' +\ 'E1 = P -\n' +\ 'E2 = F \n' else: cmd2 = 'title CAD JOB\n' +\ 'monitor BRIEF\n' +\ 'labin file 1 - \n' +\ 'E1 = {} \n'.format(self.Mtz2FPlabel) +\ 'labout file 1 - \n' +\ 'E1 = FP_{} \n'.format(self.renameLabels[1]) +\ 'ctypin file 1 - \n' +\ 'E1 = F \n' +\ 'labin file 2 - \n' +\ 'E1 = {} -\n'.format(self.Mtz3phaseLabel) +\ 'E2 = {} \n'.format(self.Mtz3FcalcLabel) +\ 'labout file 2 - \n' +\ 'E1 = PHIC_{} - \n'.format(self.renameLabels[2]) +\ 'E2 = FC_{} \n'.format(self.renameLabels[2]) +\ 'ctypin file 2 - \n' +\ 'E1 = P -\n' +\ 'E2 = F \n' self.outputLogfile = 'CADlogfile.txt' # run CAD job job = ccp4Job(jobName='CAD', commandInput1=cmd1, commandInput2=cmd2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMtz) self.jobSuccess = job.checkJobSuccess(self.runLog)
def runFFT(self): # run FFT job using the external ccp4Job class F1, F2 = self.labels1[0], self.labels2[0] SIG1, SIG2 = self.labels1[1], self.labels2[1] FOM1, FOM2 = self.labels1[2], self.labels2[2] PHI1, PHI2 = self.labels1[3], self.labels2[3] self.printPurpose() cmd1 = 'fft ' +\ 'HKLIN {} '.format(self.inputMtzFile) +\ 'MAPOUT {} '.format(self.outputMapFile) +\ 'SYMINFO syminfo.lib ' # if FOM is specified the weighting is applied to the map if self.FOMweight.lower() == 'recalculate' or 'preset,' in self.FOMweight.lower(): FOMstring = 'W={}'.format(FOM2) FOMstring2 = 'W2={}'.format(FOM2) else: FOMstring, FOMstring2 = '', '' # DIFF is the default map option. It calculates a F-F # difference map between a low and high dataset if self.mapType == 'DIFF': if self.useSigLabs: labinStr = 'LABIN F1={} SIG1={} F2={} SIG2={} '.format( F1, SIG1, F2, SIG2) else: labinStr = 'LABIN F1={} F2={} '.format(F1, F2) phiStr = 'PHI={} {} PHI2={} {}\n'.format( PHI2, FOMstring, PHI2, FOMstring2) scaleStr = 'SCALE F1 {} 0.0 F2 {} 0.0\n'.format( self.F1Scale, self.F2Scale) # SIMPLE sets the low dataset weight to 0. This is essentially # map generated only from the high dataset. if self.mapType == 'SIMPLE': if self.useSigLabs: labinStr = 'LABIN F1={} SIG1={} F2={} SIG2={} '.format( F1, SIG1, F2, SIG2) else: labinStr = 'LABIN F1={} F2={} '.format(F1, F2) phiStr = 'PHI={} {} PHI2={} {}\n'.format( PHI2, FOMstring, PHI2, FOMstring2) scaleStr = 'SCALE F1 {} 0.0 F2 0.0 0.0\n'.format( self.F1Scale, self.F2Scale) # this option is very similar to SIMPLE above, however the # low dataset is neglected entirely. # It is designed to superseed SIMPLE now and doesn't require # a valid low dataset F column to be present if self.mapType == 'HIGHONLY': if self.useSigLabs: labinStr = 'LABIN F1={} SIG1={} '.format(F1, SIG1) else: labinStr = 'LABIN F1={} '.format(F1) phiStr = 'PHI={} {}\n'.format(PHI2, FOMstring) scaleStr = 'SCALE F1 {} 0.0 '.format(self.F1Scale) # the option below is distinct from DIFF above, since it allows # a difference map to be generated after SIGF labels have been # used here to scale datasets, however does NOT use SIGFs in the # map calculation if self.mapType == 'DIFF-NO-SIGMA': labinStr = 'LABIN F1={} F2={} '.format(F1, F2) phiStr = 'PHI={} {} PHI2={} {}\n'.format( PHI1, FOMstring, PHI2, FOMstring2) scaleStr = 'SCALE F1 {} 0.0 F2 {} 0.0\n'.format( self.F1Scale, self.F2Scale) # choose sigmaa-derived FWT and PHIC for 2FOFC map setting if self.mapType == '2FOFC': labinStr = 'LABIN F1={}'.format(F1) phiStr = 'PHI={}'.format(PHI1) scaleStr = 'SCALE F1 1.0 0.0' # for case of FC map generation if self.mapType == 'FC': labinStr = 'LABIN F1={}'.format(F1) phiStr = 'PHI={}'.format(PHI1) scaleStr = 'SCALE F1 {} 0.0'.format(self.F1Scale) # include a resolution cutoff if specified (not used for Fcalc maps) resStr = '' if self.mapType != 'FC': if self.highResCutoff != '': resStr = 'RESOLUTION {}'.format(self.highResCutoff) if self.lowResCutoff != '': resStr += ' {}'.format(self.lowResCutoff) resStr += '\n' cmd2 = 'AXIS {} {} {}\n'.format( self.fastAxis, self.medAxis, self.slowAxis) +\ 'title FTT DENSITY MAP RUN\n' +\ 'grid {} {} {}\n'.format( self.gridSamp1, self.gridSamp2, self.gridSamp3) +\ 'xyzlim 0 1 0 1 0 1\n' +\ '{}'.format(resStr) +\ '{} {}\n{}\nEND'.format(labinStr, phiStr, scaleStr) self.outputLogfile = 'FFTlogfile.txt' # run FFT job job = ccp4Job(jobName='FFT', commandInput1=cmd1, commandInput2=cmd2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile) self.jobSuccess = job.checkJobSuccess(self.runLog)
def runSFALL(self): # run SFALL job using the external ccp4Job class self.printPurpose() title = 'run of sfall' if self.task == 'atom map': # use to make an atom-tagged map from a coordinate model self.commandInput1 = 'sfall ' +\ 'XYZIN {} '.format(self.inputPDBfile) +\ 'ATOMSF atomsf.lib ' +\ 'MAPOUT {} '.format(self.outputMapFile) +\ 'SYMINFO syminfo.lib ' if len(self.gridDims) == 0: gridDims = '' else: gridDims = 'GRID {} {} {}\n'.format( self.gridDims[0], self.gridDims[1], self.gridDims[2]) self.commandInput2 = 'MODE ATMMAP {}\n'.format(self.mapoutType) +\ 'SYMMETRY {}\n'.format(self.symGroup) +\ 'VDWR {}\n'.format(self.VDWR) +\ 'title {}\n'.format(title) +\ '{}'.format(gridDims) +\ 'END' elif self.task == 'mtz from pdb': # make a new Fcalc column in a new mtz file self.commandInput1 = 'sfall ' +\ 'XYZIN {} '.format(self.inputPDBfile) +\ 'ATOMSF atomsf.lib ' +\ 'HKLOUT {} '.format(self.outputMtzFile) +\ 'SYMINFO syminfo.lib ' self.commandInput2 = 'title {}\n'.format(title) +\ 'labout FC=FCalc PHIC=PHICalc\n' +\ 'NAME -\nPROJECT RIDL -\nCRYSTAL RIDL -\n' +\ 'DATASET RIDL\nMODE SFCALC -\nXYZIN\n' +\ 'SYMMETRY {}\n'.format(self.symGroup) +\ 'BADD 0.0\nVDWR 2.5\nEND' elif self.task == 'mtz from map': # otherwise make a new Fcalc column in an input map file self.commandInput1 = 'sfall ' +\ 'MAPIN {} '.format(self.inputMapfile) +\ 'ATOMSF atomsf.lib ' +\ 'HKLOUT {} '.format(self.outputMtzFile) +\ 'SYMINFO syminfo.lib ' self.commandInput2 = 'title {}\n'.format(title) +\ 'labout FC=FCalc PHIC=PHICalc\n' +\ 'NAME -\nPROJECT RIDL -\nCRYSTAL RIDL -\n' +\ 'DATASET RIDL\nMODE SFCALC -\MAPIN\n' +\ 'SYMMETRY {}\n'.format(self.symGroup) +\ 'BADD 0.0\nVDWR 2.5\nEND' self.outputLogfile = 'SFALLlogfile.txt' # run SFALL job job = ccp4Job(jobName='SFALL', commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputFile) self.jobSuccess = job.checkJobSuccess(self.runLog)
def runFFT(self): # run FFT job using the external ccp4Job class self.printPurpose() self.commandInput1 = ( "fft " + "HKLIN {} ".format(self.inputMtzFile) + "MAPOUT {} ".format(self.outputMapFile) + "SYMINFO syminfo.lib " ) # if FOM is specified the weighting is applied to the map if self.FOMweight == "recalculate" or "preset," in self.FOMweight: FOMstring = "W={}".format(self.FOM2) FOMstring2 = "W2={}".format(self.FOM2) else: FOMstring, FOMstring2 = "", "" # if DIFFERENCE or SIMPLE map types map type chosen if self.mapType in ("DIFF", "SIMPLE"): labinStr = "LABIN F1={} SIG1={} F2={} SIG2={} ".format(self.F1, self.SIG1, self.F2, self.SIG2) phiStr = "PHI={} {} PHI2={} {}\n".format(self.PHI2, FOMstring, self.PHI2, FOMstring2) # can distinguish here between SIMPLE and DIFFERENCE map types if self.mapType == "SIMPLE": self.F2Scale = 0.0 scaleStr = "SCALE F1 {} 0.0 F2 {} 0.0\n".format(self.F1Scale, self.F2Scale) # choose sigmaa-derived FWT and PHIC for 2FOFC map setting if self.mapType == "2FOFC": labinStr = "LABIN F1={}".format(self.F1) phiStr = "PHI={}".format(self.PHI1) scaleStr = "SCALE F1 1.0 0.0" # for case of FC map generation if self.mapType == "FC": labinStr = "LABIN F1={}".format(self.F1) phiStr = "PHI={}".format(self.PHI1) scaleStr = "SCALE F1 {} 0.0".format(self.F1Scale) # include a resolution cutoff if specified (not used for Fcalc maps) resStr = "" if self.mapType != "FC": if self.highResCutoff != "": resStr = "RESOLUTION {}".format(self.highResCutoff) if self.lowResCutoff != "": resStr += " {}".format(self.lowResCutoff) resStr += "\n" self.commandInput2 = ( "AXIS {} {} {}\n".format(self.fastAxis, self.medAxis, self.slowAxis) + "title FTT DENSITY MAP RUN\n" + "grid {} {} {}\n".format(self.gridSamp1, self.gridSamp2, self.gridSamp3) + "xyzlim 0 1 0 1 0 1\n" + "{}".format(resStr) + "{} {}\n{}\n".format(labinStr, phiStr, scaleStr) + "END" ) self.outputLogfile = "FFTlogfile.txt" # run FFT job job = ccp4Job( jobName="FFT", commandInput1=self.commandInput1, commandInput2=self.commandInput2, outputDir=self.outputDir, outputLog=self.outputLogfile, outputFile=self.outputMapFile, ) self.jobSuccess = job.checkJobSuccess()