def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("*** EDPluginExecDIMPLEPDBSETv10.postProcess") self.programTermination() # Create some output data # xsDataResult = CCP4DataResultPDBSET() # self.setDataOutput( xsDataResult ) strLog = self.readProcessLogFile() ccp4ReturnStatus = self.getPDBSETReturnStatus(strLog) ccp4DataResultPDBSET = CCP4DataResultPDBSET() # Set the output PDB file ccp4DataResultPDBSET.setXYZOUT(XSDataString(self.getDataInput().getXYZOUT().getPath().getValue())) # Set the output log file ccp4DataResultPDBSET.setOutputLogFile(XSDataString(self.getScriptLogFileName())) # Set the return status ccp4DataResultPDBSET.setReturnStatus(ccp4ReturnStatus) # Set the data output for the job self.setDataOutput(ccp4DataResultPDBSET) if not os.path.isfile(self.getDataOutput().getXYZOUT().getValue()): raise RuntimeError, "File %s does not exist" % self.getDataOutput().getXYZOUT().getValue()
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecRsync.postProcess") # Create some output data xsDataResult = XSDataResultRsync(log=XSDataString("")) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDataverv1_0.postProcess") # Create some output data xsDataResult = XSDataResultDataver() xsDataResult.outputCurve = XSDataFile(XSDataString(self.strOutFile)) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecProcessScriptAutoRgv1_0.postProcess") # Create some output data # 2.83326 0.011646 2.04258e+07 18565.3 47 81 0.783626 1 bioSaxsMerged.dat strOutput = self.readProcessLogFile() xsDataResult = XSDataResultAutoRg() listXSDOut = [] for line in strOutput.split(os.linesep): words = line.split(None, 8) if len(words) < 8: break try: xsData = XSDataAutoRg() xsData.filename = XSDataFile(XSDataString(words[-1])) xsData.rg = XSDataLength(float(words[0])) xsData.rgStdev = XSDataLength(float(words[1])) xsData.i0 = XSDataDouble(float(words[2])) xsData.i0Stdev = XSDataDouble(float(words[3])) xsData.firstPointUsed = XSDataInteger(int(words[4])) xsData.lastPointUsed = XSDataInteger(int(words[5])) xsData.quality = XSDataDouble(float(words[6])) xsData.isagregated = XSDataBoolean(bool(int(words[7]))) except Exception: strError = "Error in parsing output:" + line self.error(strError) self.setFailure() listXSDOut.append(xsData) xsDataResult.autoRgOut = listXSDOut self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecAutoPROCv1_0.postProcess") strWorkingDir = self.getWorkingDirectory() # Log file self.dataOutput.logFile = XSDataFile(XSDataString(os.path.join(strWorkingDir, self.getScriptLogFileName()))) # ISPyB XML files ispybXML = os.path.join(strWorkingDir, "autoPROC.xml") if os.path.exists(ispybXML): self.dataOutput.ispybXML = XSDataFile(XSDataString(ispybXML)) ispybXML_staraniso = os.path.join(strWorkingDir, "autoPROC_staraniso.xml") if os.path.exists(ispybXML_staraniso): self.dataOutput.ispybXML_staraniso = XSDataFile(XSDataString(ispybXML_staraniso)) # Report PDFs reportPdf = os.path.join(strWorkingDir, "report.pdf") if os.path.exists(reportPdf): self.dataOutput.reportPdf = XSDataFile(XSDataString(reportPdf)) else: self.dataOutput.reportPdf = None reportPdf_staraniso = os.path.join(strWorkingDir, "report_staraniso.pdf") if os.path.exists(reportPdf_staraniso): self.dataOutput.reportPdf_staraniso = XSDataFile(XSDataString(reportPdf_staraniso)) # Working directory self.dataOutput.workingDirectory = XSDataFile(XSDataString(strWorkingDir)) # processDirectory if self.dataInput.masterH5: processDirectory = os.path.join(strWorkingDir, "HDF5_1") if os.path.exists(processDirectory): self.dataOutput.addProcessDirectory(XSDataFile(XSDataString(processDirectory))) else: for identifier in self.dataInput.identifier: processDirectory = os.path.join(strWorkingDir, identifier.idN.value) if os.path.exists(processDirectory): self.dataOutput.addProcessDirectory(XSDataFile(XSDataString(processDirectory)))
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatGnomv1_0.postProcess") # Create some output data if not os.path.isfile(self.outFile): self.error("EDPluginExecDatGnomv1_0 did not produce output file %s as expected !" % self.outFile) self.setFailure() self.dataOutput = XSDataResultDatGnom() return gnom = XSDataGnom(gnomFile=XSDataFile(XSDataString(self.outFile))) logfile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) out = open(logfile, "r").read().split() for key, val, typ in (("Dmax", "dmax", XSDataLength), ("Guinier", "rgGuinier", XSDataLength), ("Gnom", "rgGnom", XSDataLength), ("Total", "total", XSDataDouble)): if key in out: idx = out.index(key) res = out[idx + 2] gnom.__setattr__(val, typ(float(res))) else: self.error("EDPluginExecDatGnomv1_0.postProcess No key %s in file %s" % (key, logfile)) self.setFailure() self.dataOutput = XSDataResultDatGnom(gnom=gnom)
def postProcess(self, _oedObject=None): EDPluginExecProcessScript.postProcess(self, _oedObject) # Fill in file paths xsDataXDSFilePaths = XSDataXDSFilePaths() xparmXds = os.path.join(self.getWorkingDirectory(), "XPARM.XDS") if os.path.exists(xparmXds): xsDataXDSFilePaths.xparmXds = XSDataFile(XSDataString(xparmXds)) xCorrectionsCbf = os.path.join(self.getWorkingDirectory(), "X-CORRECTIONS.cbf") if os.path.exists(xCorrectionsCbf): xsDataXDSFilePaths.xCorrectionsCbf = XSDataFile( XSDataString(xCorrectionsCbf)) yCorrectionsCbf = os.path.join(self.getWorkingDirectory(), "Y-CORRECTIONS.cbf") if os.path.exists(yCorrectionsCbf): xsDataXDSFilePaths.yCorrectionsCbf = XSDataFile( XSDataString(yCorrectionsCbf)) bkginitCbf = os.path.join(self.getWorkingDirectory(), "BKGINIT.cbf") if os.path.exists(bkginitCbf): xsDataXDSFilePaths.bkginitCbf = XSDataFile( XSDataString(bkginitCbf)) gainCbf = os.path.join(self.getWorkingDirectory(), "GAIN.cbf") if os.path.exists(gainCbf): xsDataXDSFilePaths.gainCbf = XSDataFile(XSDataString(gainCbf)) blankCbf = os.path.join(self.getWorkingDirectory(), "BLANK.cbf") if os.path.exists(blankCbf): xsDataXDSFilePaths.blankCbf = XSDataFile(XSDataString(blankCbf)) self.dataOutput.filePaths = xsDataXDSFilePaths
def postProcess(self, _oedObject=None): EDPluginExecProcessScript.postProcess(self, _oedObject) # Fill in file paths xsDataXDSFilePaths = XSDataXDSFilePaths() xparmXds = os.path.join(self.getWorkingDirectory(), "XPARM.XDS") if os.path.exists(xparmXds): xsDataXDSFilePaths.xparmXds = XSDataFile(XSDataString(xparmXds)) xCorrectionsCbf = os.path.join(self.getWorkingDirectory(), "X-CORRECTIONS.cbf") if os.path.exists(xCorrectionsCbf): xsDataXDSFilePaths.xCorrectionsCbf = XSDataFile(XSDataString(xCorrectionsCbf)) yCorrectionsCbf = os.path.join(self.getWorkingDirectory(), "Y-CORRECTIONS.cbf") if os.path.exists(yCorrectionsCbf): xsDataXDSFilePaths.yCorrectionsCbf = XSDataFile(XSDataString(yCorrectionsCbf)) bkginitCbf = os.path.join(self.getWorkingDirectory(), "BKGINIT.cbf") if os.path.exists(bkginitCbf): xsDataXDSFilePaths.bkginitCbf = XSDataFile(XSDataString(bkginitCbf)) gainCbf = os.path.join(self.getWorkingDirectory(), "GAIN.cbf") if os.path.exists(gainCbf): xsDataXDSFilePaths.gainCbf = XSDataFile(XSDataString(gainCbf)) blankCbf = os.path.join(self.getWorkingDirectory(), "BLANK.cbf") if os.path.exists(blankCbf): xsDataXDSFilePaths.blankCbf = XSDataFile(XSDataString(blankCbf)) self.dataOutput.filePaths = xsDataXDSFilePaths
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecXDSAPPv1_0.postProcess") # Populate the results prefixRunNumber = EDUtilsImage.getPrefix(self.dataInput.image.path.value) xsDataResultXDSAPP = self.parseOutputDirectory(self.getWorkingDirectory(), prefixRunNumber) self.dataOutput = xsDataResultXDSAPP
def postProcess(self): self.DEBUG('Pointless: postProcess') EDPluginExecProcessScript.postProcess(self) outputFile = self.dataInput.output_file.value self.dataOutput = self.parsePointlessOutput( os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()))
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatopv1_0.postProcess") # Create some output data xsDataResult = XSDataResultDatop( outputCurve=self.dataInput.outputCurve) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginH5ToCBFv1_0.postProcess") if self.dataInput.dataCollection is None: shutil.copy(self.tmpCBFFile, self.CBFFile) else: # Fill in metadata fileTmpCBF = open(self.tmpCBFFile) tmpCBF = fileTmpCBF.read() fileTmpCBF.close() # Replace opening line tmpCBF = tmpCBF.replace("CBF: VERSION 1.5, CBFlib v0.7.8 - SLS/DECTRIS PILATUS detectors", "CBF: VERSION 1.5, CBFlib v0.7.8") index1 = tmpCBF.find("# WARNING: FOR XDS PROCESSING ONLY.") string2 = "# SOFTWARE VERSION: 1.1.0-RELEASE" index2 = tmpCBF.find(string2) + len(string2) miniCBFHeader = self.generateMiniCBFHeader(self.dataInput) newCBF = tmpCBF[:index1] + miniCBFHeader + tmpCBF[index2:] newCBFFile = open(self.CBFFile, "w") newCBFFile.write(newCBF) newCBFFile.close()
def postProcess(self, _edObject = None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecDIMPLEPHASERv10.postProcess") self.programTermination() # Create some output data xsDataResult = CCP4DataResultPhaser( HKLOUT = HKL(self._hklout), XYZOUT = XYZ(self._xyzout), returnStatus = CCP4ReturnStatus()) self.setDataOutput(xsDataResult) xyzout = None for record in self.readProcessLogFile().split('\n'): if 'Solution' in record and 'written to PDB file:' in record and ".pdb" in record: xyzout = record.split()[-1] assert(xyzout) shutil.copyfile(os.path.join(self.getWorkingDirectory(), xyzout), self._xyzout) if not os.path.isfile(self._xyzout): raise RuntimeError, 'File %s does not exist' % self._xyzout return
def postProcess(self, _edObject = None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG( '*** EDPluginExecDIMPLEREFMACRestrainedRefinementv10.postProcess') init_r, init_r_free, final_r, final_r_free = self.parse_refmac_log() xsDataResult = CCP4DataResultREFMACRestrainedRefinement( HKLOUT = HKL(self._hklout), XYZOUT = XYZ(self._xyzout), initialR = XSDataFloat(init_r), initialRFree = XSDataFloat(init_r_free), finalR = XSDataFloat(final_r), finalRFree = XSDataFloat(final_r_free), returnStatus = CCP4ReturnStatus()) self.setDataOutput(xsDataResult) if not os.path.isfile(self.getDataOutput().getHKLOUT().getPath().getValue()): raise RuntimeError, 'File %s does not exist' % self.getDataOutput().getHKLOUT().getPath().getValue() if not os.path.isfile(self.getDataOutput().getXYZOUT().getPath().getValue()): raise RuntimeError, 'File %s does not exist' % self.getDataOutput().getXYZOUT().getPath().getValue() return
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecSaxsDelMetadatav1_0.postProcess") # Create some output data xsDataResult = XSDataResultSaxsDelMetadatav1_0() xsDataResult.setOutputImage(self.getDataInput().getInputImage()) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatPorodv1_0.postProcess") # Create some output data logfile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) out = open(logfile, "r").read().split() if self.atsasVersion < "2.6": try: res = float(out[0]) except (ValueError, IndexError): self.error("Unable to read porod log file: " + logfile) self.setFailure() else: xsDataResult = XSDataResultDatPorod( volume=XSDataDoubleWithUnit(value=res)) self.setDataOutput(xsDataResult) else: try: res = float(out[2]) except (ValueError, IndexError): self.error("Unable to read porod log file: " + logfile) self.setFailure() else: xsDataResult = XSDataResultDatPorod( volume=XSDataDoubleWithUnit(value=res)) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatcmpv2_0.postProcess") strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()), self.getScriptLogFileName()) if os.path.isfile(strResultFile): for line in open(strResultFile): words = line.split() if (self.atsasVersion == "2.5.2") and (len(words) == 5): try: self.fChi = float(words[-2]) self.fFidelity = float(words[-1]) except ValueError: self.WARNING("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line)) else: break if (self.atsasVersion == "2.6.1") and (len(words) == 6): try: self.fChi = float(words[-3]) ** 0.5 self.fFidelity = float(words[-1].strip('*')) except ValueError: self.DEBUG("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line)) else: break # Create some output data xsDataResult = XSDataResultDatcmp() if self.fChi is not None: xsDataResult.chi = XSDataDouble(self.fChi) if self.fFidelity is not None: xsDataResult.fidelity = XSDataDouble(self.fFidelity) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("*** EDPluginExecDIMPLEPDBSETv10.postProcess") self.programTermination() # Create some output data # xsDataResult = CCP4DataResultPDBSET() # self.setDataOutput( xsDataResult ) strLog = self.readProcessLogFile() ccp4ReturnStatus = self.getPDBSETReturnStatus(strLog) ccp4DataResultPDBSET = CCP4DataResultPDBSET() # Set the output PDB file ccp4DataResultPDBSET.setXYZOUT( XSDataString(self.getDataInput().getXYZOUT().getPath().getValue())) # Set the output log file ccp4DataResultPDBSET.setOutputLogFile( XSDataString(self.getScriptLogFileName())) # Set the return status ccp4DataResultPDBSET.setReturnStatus(ccp4ReturnStatus) # Set the data output for the job self.setDataOutput(ccp4DataResultPDBSET) if not os.path.isfile(self.getDataOutput().getXYZOUT().getValue()): raise RuntimeError, 'File %s does not exist' % self.getDataOutput( ).getXYZOUT().getValue()
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatcmpv1_0.postProcess") strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()), self.getScriptLogFileName()) if os.path.isfile(strResultFile): for line in open(strResultFile): words = line.split() if len(words) == 2: try: self.fChi = float(words[0]) self.fFidelity = float(words[1]) except ValueError: self.WARNING("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line)) else: break # Create some output data xsDataResult = XSDataResultDatcmp() if self.fChi is not None: xsDataResult.chi = XSDataDouble(self.fChi) if self.fFidelity is not None: xsDataResult.fidelity = XSDataDouble(self.fFidelity) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginH5ToCBFv1_0.postProcess") if self.dataInput.dataCollection is None: shutil.copy(self.tmpCBFFile, self.CBFFile) else: # Fill in metadata fileTmpCBF = open(self.tmpCBFFile) tmpCBF = fileTmpCBF.read() fileTmpCBF.close() # Replace opening line tmpCBF = tmpCBF.replace( "CBF: VERSION 1.5, CBFlib v0.7.8 - SLS/DECTRIS PILATUS detectors", "CBF: VERSION 1.5, CBFlib v0.7.8") index1 = tmpCBF.find("# WARNING: FOR XDS PROCESSING ONLY.") string2 = "# SOFTWARE VERSION: 1.1.0-RELEASE" index2 = tmpCBF.find(string2) + len(string2) miniCBFHeader = self.generateMiniCBFHeader(self.dataInput) newCBF = tmpCBF[:index1] + miniCBFHeader + tmpCBF[index2:] newCBFFile = open(self.CBFFile, "w") newCBFFile.write(newCBF) newCBFFile.close()
def postProcess(self, _edObject=None): """ Parses the labelit.screen log file and the generated MOSFLM script """ EDPluginExecProcessScript.postProcess(self, _edObject) self.DEBUG("EDPluginLabelitv10.postProcess...") strLabelitLog = self.readProcessLogFile() if strLabelitLog is None: errorMessage = EDMessage.ERROR_EXECUTION_03 % ( "EDPluginLabelitv10.postProcess", self.getClassName(), "Could not read the Labelit log file", ) self.error(errorMessage) self.addErrorMessage(errorMessage) else: xsDataLabelitScreenOutput = self.parseLabelitScreenOutput(strLabelitLog) xsDataIntegerSelectedSolutionNumber = xsDataLabelitScreenOutput.getSelectedSolutionNumber() if xsDataIntegerSelectedSolutionNumber is None: errorMessage = EDMessage.ERROR_EXECUTION_03 % ( "EDPluginLabelitv10.postProcess", self.getClassName(), "No selected solution", ) self.error(errorMessage) self.addErrorMessage(errorMessage) else: strLabelitMosflmScriptsOutput = self.readProcessFile( self.generateMosflmScriptName(xsDataIntegerSelectedSolutionNumber.getValue()) ) xsDataLabelitMosflmScriptsOutput = self.parseMosflmScriptsOutput(strLabelitMosflmScriptsOutput) xsDataResultLabelit = XSDataResultLabelit() xsDataResultLabelit.setLabelitScreenOutput(xsDataLabelitScreenOutput) xsDataResultLabelit.setLabelitMosflmScriptsOutput(xsDataLabelitMosflmScriptsOutput) self.setDataOutput(xsDataResultLabelit)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecDamminv0_1.postProcess") # Create some output data pathLogFile = XSDataString( os.path.join(self.getWorkingDirectory(), "dammin.log")) pathFitFile = XSDataString( os.path.join(self.getWorkingDirectory(), "dammin.fit")) pathMoleculeFile = XSDataString( os.path.join(self.getWorkingDirectory(), "dammin-1.pdb")) pathSolventFile = XSDataString( os.path.join(self.getWorkingDirectory(), "dammin-0.pdb")) xsLogFile = XSDataFile(pathLogFile) xsFitFile = XSDataFile(pathFitFile) xsMoleculeFile = XSDataFile(pathMoleculeFile) xsSolventFile = XSDataFile(pathSolventFile) xsDataResult = XSDataResultDammin() if os.path.exists(pathLogFile.getValue()): xsDataResult.setLogFile(xsLogFile) if os.path.exists(pathFitFile.getValue()): xsDataResult.setFitFile(xsFitFile) if os.path.exists(pathMoleculeFile.getValue()): xsDataResult.setPdbMoleculeFile(xsMoleculeFile) if os.path.exists(pathSolventFile.getValue()): xsDataResult.setPdbSolventFile(xsSolventFile) xsDataResult.setChiSqrt(self.returnDamminChiSqrt()) xsDataResult.setRfactor(self.returnDamminRFactor()) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginMinimalXds.postProcess") # Check log for warning and errors strPathToLogFile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) self.checkLogForWarningAndErrors(strPathToLogFile) # XDS is considered to have succeeded iff CORRECT.LP has been created outfile = os.path.join(self.getWorkingDirectory(), 'CORRECT.LP') self.DEBUG('looking for {0}'.format(outfile)) if not os.path.isfile(outfile): self.DEBUG('NOT FOUND') self.dataOutput.succeeded = XSDataBoolean(False) strErrorMessage = "Cannot find CORRECT.LP output file" self.ERROR(strErrorMessage) if len(self.getListOfErrorMessages()) == 0: self.addErrorMessage(strErrorMessage) else: self.addWarningMessage(strErrorMessage) self.setFailure() return else: self.DEBUG('FOUND') self.dataOutput.succeeded = XSDataBoolean(True) self.DEBUG('succeeded is {0} and succeeded.value is {1}'.format(self.dataOutput.succeeded, self.dataOutput.succeeded.value))
def postProcess(self, _edObject=None): """ Parses the labelit.screen log file and the generated MOSFLM script """ EDPluginExecProcessScript.postProcess(self, _edObject) self.DEBUG("EDPluginLabelitv10.postProcess...") strLabelitLog = self.readProcessLogFile() if (strLabelitLog is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginLabelitv10.postProcess", self.getClassName(), "Could not read the Labelit log file") self.error(errorMessage) self.addErrorMessage(errorMessage) else: xsDataLabelitScreenOutput = self.parseLabelitScreenOutput(strLabelitLog) xsDataIntegerSelectedSolutionNumber = xsDataLabelitScreenOutput.getSelectedSolutionNumber() if (xsDataIntegerSelectedSolutionNumber is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginLabelitv10.postProcess", self.getClassName(), "No selected solution") self.error(errorMessage) self.addErrorMessage(errorMessage) else: strLabelitMosflmScriptsOutput = self.readProcessFile(self.generateMosflmScriptName(xsDataIntegerSelectedSolutionNumber.getValue())) xsDataLabelitMosflmScriptsOutput = self.parseMosflmScriptsOutput(strLabelitMosflmScriptsOutput) xsDataResultLabelit = XSDataResultLabelit() xsDataResultLabelit.setLabelitScreenOutput(xsDataLabelitScreenOutput) xsDataResultLabelit.setLabelitMosflmScriptsOutput(xsDataLabelitMosflmScriptsOutput) self.setDataOutput(xsDataResultLabelit)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginMinimalXds.postProcess") # Check log for warning and errors strPathToLogFile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) self.checkLogForWarningAndErrors(strPathToLogFile) # XDS is considered to have succeeded iff CORRECT.LP has been created outfile = os.path.join(self.getWorkingDirectory(), 'CORRECT.LP') self.DEBUG('looking for {0}'.format(outfile)) if not os.path.isfile(outfile): self.DEBUG('NOT FOUND') self.dataOutput.succeeded = XSDataBoolean(False) strErrorMessage = "Cannot find CORRECT.LP output file" self.ERROR(strErrorMessage) if len(self.getListOfErrorMessages()) == 0: self.addErrorMessage(strErrorMessage) else: self.addWarningMessage(strErrorMessage) self.setFailure() return else: self.DEBUG('FOUND') self.dataOutput.succeeded = XSDataBoolean(True) self.DEBUG('succeeded is {0} and succeeded.value is {1}'.format( self.dataOutput.succeeded, self.dataOutput.succeeded.value))
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDatGnomv1_1.postProcess") # Create some output data cwd = self.getWorkingDirectory() outfile = os.path.join(cwd, os.path.basename(self.outFile)) if not os.path.isfile(outfile): self.error("EDPluginExecDatGnomv1_1 did not produce output file %s as expected !" % self.outFile) self.setFailure() self.dataOutput = XSDataResultDatGnom() return try: os.rename(outfile, self.outFile) except OSError: # may fail if src and dst on different filesystem shutil.copy(outfile, self.outFile) gnom = XSDataGnom(gnomFile=XSDataFile(XSDataString(self.outFile))) logfile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) out = open(logfile, "r").read().split() for key, val, typ in (("dmax:", "dmax", XSDataLength), ("Guinier:", "rgGuinier", XSDataLength), ("Gnom:", "rgGnom", XSDataLength), ("Total:", "total", XSDataDouble)): if key in out: idx = out.index(key) res = out[idx + 1] gnom.__setattr__(val, typ(float(res))) else: self.error("EDPluginExecDatGnomv1_1.postProcess No key %s in file %s" % (key, logfile)) self.setFailure() self.dataOutput = XSDataResultDatGnom(gnom=gnom) self.dataOutput.status = XSDataStatus(message=self.getXSDataMessage())
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecMTZDUMPUnitCellSpaceGroupv10.postProcess") # Create some output data pyStrLog = self.readProcessLogFile() xsDataResultMTZDUMPUnitCellSpaceGroup = self.parseMTZDUMPLog(pyStrLog) self.setDataOutput(xsDataResultMTZDUMPUnitCellSpaceGroup)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecSaxsAddMetadatav1_0.postProcess") # Create some output data xsDataResult = XSDataResultSaxsAddMetadatav1_0() xsDataResult.setOutputImage(self.getDataInput().getInputImage()) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecCrystFELIndexv1_0.postProcess") # Populate the results xsDataResultCrystFEL = self.parseOutputDirectory( self.getWorkingDirectory()) self.dataOutput = xsDataResultCrystFEL
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecDammifv0_1.postProcess") # Create some output data pathLogFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif.log")) pathFitFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif.fit")) pathMoleculeFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif-1.pdb")) pathSolventFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif-0.pdb")) xsLogFile = XSDataFile(pathLogFile) xsFitFile = XSDataFile(pathFitFile) xsMoleculeFile = XSDataFile(pathMoleculeFile) xsSolventFile = XSDataFile(pathSolventFile) xsDataResult = XSDataResultDammif() if os.path.exists(pathLogFile.getValue()): xsDataResult.setLogFile(xsLogFile) if os.path.exists(pathFitFile.getValue()): xsDataResult.setFitFile(xsFitFile) if os.path.exists(pathMoleculeFile.getValue()): xsDataResult.setPdbMoleculeFile(xsMoleculeFile) if os.path.exists(pathSolventFile.getValue()): xsDataResult.setPdbSolventFile(xsSolventFile) xsDataResult.setChiSqrt(self.returnDammifChiSqrt()) xsDataResult.setRfactor(self.returnDammifRFactor()) self.setDataOutput(xsDataResult)
def postProcess(self): self.DEBUG('Pointless: postProcess') EDPluginExecProcessScript.postProcess(self) output_file = self.dataInput.output_file.value sgre = re.compile(""" \* Space group = '(?P<sgstr>.*)' \(number\s+(?P<sgnumber>\d+)\)""") sgnumber = sgstr = None # returns None if the file does not exist... log = self.readProcessLogFile() if log is not None: # we'll apply the regexp to the whole file contents which # hopefully won't be that long. m = sgre.search(log) if m is not None: d = m.groupdict() sgnumber = d['sgnumber'] sgstr = d['sgstr'] res = XSDataPointlessOut() if sgnumber is not None: res.sgnumber = XSDataInteger(sgnumber) if sgstr is not None: res.sgstr = XSDataString(sgstr) status = XSDataStatus() status.isSuccess = XSDataBoolean(os.path.exists(output_file)) res.status = status self.dataOutput = res
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) strRaddoseError = self.readProcessErrorLogFile() if((strRaddoseError is not None) and (strRaddoseError != "")): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginRaddosev10.postProcess', 'EDPluginRaddosev10', strRaddoseError) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage resultDict = self.analyseScriptLogFileName(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())) strSolvent = self.__dictResults[ EDPluginRaddosev10.__strSOLVENT ] # ugly workaround while waiting for RADDOSE XML output file strAbsorbedDose = None for strAbsorbedDoseKeyword in EDPluginRaddosev10.__listABSORBED_DOSE: strAbsorbedDose = self.__dictResults[ strAbsorbedDoseKeyword ] if (strAbsorbedDose is not None): break if(strSolvent is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginRaddosev10.postProcess', "Raddose", "No Result for Keyword [" + EDPluginRaddosev10.__strSOLVENT + "] see: " + self.getScriptLogFileName()) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage if(strAbsorbedDose is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginRaddosev10.postProcess', "Raddose", "No Result for Keyword [" + strAbsorbedDoseKeyword + "] see: " + self.getScriptLogFileName()) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage self.__fSolvent = float(strSolvent) if(self.__fSolvent < EDPluginRaddosev10.__iMIN_SOLVENT_PERCENTAGE or self.__fSolvent > EDPluginRaddosev10.__iMAX_SOLVENT_PERCENTAGE): warningMessage = "Inconsistent solvent percentage value: %.1f" % self.__fSolvent EDVerbose.warning(warningMessage) self.addWarningMessage(warningMessage) iNumberOfImages = self.getDataInput().getNumberOfImages().getValue() fExposureTimePerImageInSec = self.getDataInput().getBeamExposureTime().getValue() fTotalExposureTime = iNumberOfImages * fExposureTimePerImageInSec fAbsorbedDoseSpeed = float(strAbsorbedDose) / fTotalExposureTime xsDataAbsorbedDoseRate = XSDataAbsorbedDoseRate(fAbsorbedDoseSpeed) xsDataAbsorbedDose = XSDataDouble(float(strAbsorbedDose)) self.__fTimeToReachHendersonLimit = EDPluginRaddosev10.__fHENDERSON_LIMIT / fAbsorbedDoseSpeed xsDataRaddosev10Output = XSDataRaddoseOutput() xsDataRaddosev10Output.setAbsorbedDose(xsDataAbsorbedDose) xsDataRaddosev10Output.setAbsorbedDoseRate(xsDataAbsorbedDoseRate) xsDataRaddosev10Output.setTimeToReachHendersonLimit(XSDataTime(self.__fTimeToReachHendersonLimit)) xsDataFilePathToLog = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()))) xsDataRaddosev10Output.setPathToLogFile(xsDataFilePathToLog) self.setDataOutput(xsDataRaddosev10Output)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginXOalignv1_0.postProcess") strPathLogFile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) if os.path.exists(strPathLogFile): xsDataResultXOalign = self.parseLogFile(strPathLogFile) xsDataResultXOalign.logFile = XSDataFile(XSDataString(strPathLogFile)) self.dataOutput = xsDataResultXOalign
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecSupcombv0_3.postProcess") try: self.dataOutput = self.parseSupcombOutputFile() except Exception as error: self.ERROR("Error in supcomb: parseSupcombOutputFile: %s" % error) self.setFailure()
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecXDSAPPv1_0.postProcess") # Populate the results prefixRunNumber = EDUtilsImage.getPrefix( self.dataInput.image.path.value) xsDataResultXDSAPP = self.parseOutputDirectory( self.getWorkingDirectory(), prefixRunNumber) self.dataOutput = xsDataResultXDSAPP
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecAbsCalcv0_1.postProcess") # Create some output data self.__xsDataResult = XSDataResultAbsCalc() self.parseAbsCalcOutputFile() self.setDataOutput(self.__xsDataResult)
def postProcess(self, _edObject = None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecAbsCalcv0_1.postProcess") # Create some output data self.__xsDataResult = XSDataResultAbsCalc() self.parseAbsCalcOutputFile() self.setDataOutput(self.__xsDataResult)
def postProcess( self, _edObject = None ): EDPluginExecProcessScript.postProcess( self ) EDVerbose.DEBUG( "*** EDPluginExecDIMPLEMTZDUMPv10.postProcess") # check to see if the program terminated normally self.programTermination() # Create some output data strLog=self.readProcessLogFile() dataResultFromMTZDUMP=self.parseDIMPLEMTZDUMP(strLog) self.setDataOutput(dataResultFromMTZDUMP)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDamminv0_2.postProcess") # Create some output data cwd = self.getWorkingDirectory() model = XSDataSaxsModel(name=XSDataString("dammin")) xsDataResult = XSDataResultDammin(model=model) pathLogFile = os.path.join(cwd, "dammin.log") pathFitFile = os.path.join(cwd, "dammin.fit") pathFirFile = os.path.join(cwd, "dammin.fir") pathMoleculeFile = os.path.join(cwd, "dammin-1.pdb") pathSolventFile = os.path.join(cwd, "dammin-0.pdb") try: res = parse_atsas.parsePDB(pathMoleculeFile, pathMoleculeFile) except Exception as error: self.ERROR("EDPluginExecDamminv0_2:parsePDB: %s" % error) else: for k in res: self.__setattr__(k, res[k]) if os.path.exists(pathLogFile): xsDataResult.logFile = model.logFile = XSDataFile( XSDataString(pathLogFile)) if not self.Rfactor: self.Rfactor = self.returnDamminRFactor() if self.Rfactor: xsDataResult.rfactor = model.rfactor = XSDataDouble( self.Rfactor) if os.path.exists(pathFitFile): xsDataResult.fitFile = model.fitFile = XSDataFile( XSDataString(pathFitFile)) if os.path.exists(pathFirFile): model.firFile = XSDataFile(XSDataString(pathFirFile)) xsDataResult.chiSqrt = model.chiSqrt = self.returnDamminChiSqrt() if os.path.exists(pathMoleculeFile): xsDataResult.pdbMoleculeFile = model.pdbFile = XSDataFile( XSDataString(pathMoleculeFile)) if os.path.exists(pathSolventFile): xsDataResult.pdbSolventFile = XSDataFile( XSDataString(pathSolventFile)) if self.volume: model.volume = XSDataDouble(self.volume) if self.Rg: model.rg = XSDataDouble(self.Rg) if self.Dmax: model.dmax = XSDataDouble(self.Dmax) self.generateExecutiveSummary() xsDataResult.status = XSDataStatus( message=self.getXSDataMessage(), executiveSummary=XSDataString( os.linesep.join(self.getListExecutiveSummaryLines()))) self.dataOutput = xsDataResult
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("*** EDPluginFIT2DCakev1_0.postProcess") # Create the output data xsDataResultFIT2DCake = XSDataResultFIT2DCake() if (self.m_strOutputFilePath is not None): xsDataFile = XSDataFile() xsDataFile.setPath(XSDataString(self.m_strOutputFilePath)) xsDataResultFIT2DCake.setResultFile(xsDataFile) self.setDataOutput(xsDataResultFIT2DCake)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecDamstartv0_2.postProcess") model = XSDataSaxsModel(name=XSDataString("damstart")) xsDataResult = XSDataResultDamstart(model=model) xsDataResult.outputPdbFile = model.pdbFile = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.__strOutputPdbFileName))) xsDataResult.status = XSDataStatus(message=self.getXSDataMessage(), executiveSummary=XSDataString(os.linesep.join(self.getListExecutiveSummaryLines()))) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginExecSiftDescriptorv1_0.postProcess") # Create some output data xsDataResult = XSDataResultSiftDescriptor() if os.path.isfile(self.strKeys): xsdFile = XSDataFile() xsdFile.setPath(XSDataString(self.strKeys)) xsDataResult.setDescriptorFile(xsdFile) self.setDataOutput(xsDataResult)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecDamfiltv0_1.postProcess") xsDataResult = XSDataResultDamfilt() pathOutputFile = XSDataString(os.path.join(self.getWorkingDirectory(), self.__strOutputPdbFileName)) xsDataResult.setOutputPdbFile(XSDataFile(pathOutputFile)) self.setDataOutput(xsDataResult)
def postProcess(self): self.DEBUG('Truncate: postProcess') EDPluginExecProcessScript.postProcess(self) output_file = self.dataInput.output_file.value res = XSDataResult() status = XSDataStatus() status.isSuccess = XSDataBoolean(os.path.exists(output_file)) res.status = status self.dataOutput = res
def postProcess(self, _edObject=None): """ reading back and genericly process the output """ EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginSTACv2_0.postProcess") OutputData = self.fetchOutput() self.DEBUG("EDPluginSTACv2_0.postProcess: " + str(OutputData)) if (OutputData is not None): self.setDataOutput(OutputData)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecVideov10.postProcess") # Create some output data xsDataResult = XSDataResultExecVideo() xsDataFile = XSDataFile() xsDataFile.setPath(XSDataString(self.videoFile)) xsDataResult.setVideoPath(xsDataFile) xsDataResult.setVideoPath(xsDataFile) xsDataResult.setVideoCodec(XSDataString(self.codec)) self.setDataOutput(xsDataResult)
def postProcess(self): self.DEBUG('Uniqueify: postProcess') EDPluginExecProcessScript.postProcess(self) output_file = self.dataInput.output_file.value res = XSDataResult() status = XSDataStatus() status.isSuccess = XSDataBoolean(os.path.exists(output_file)) res.status = status self.dataOutput = res