def testExecute(self): self.run() # Compare results strXMLExpected = self.readAndParseFile(self.__strReferenceDataOutputFile) xsDataObtained = self.getPlugin().getDataOutput() xsDataExpected = XSDataMOSFLMOutputIntegration.parseString(strXMLExpected) # Remove the bestFileHKL part which creates problem... xsDataObtained.setBestfileHKL(None) xsDataExpected.setBestfileHKL(None) EDAssert.strAlmostEqual(xsDataExpected.marshal(), xsDataObtained.marshal(), "(MOSFLM integration result comparison - expected versus obtained)", 0.1, 5000)
def testGenerateExecutiveSummary(self): pluginIntegration = self.createPlugin() pluginIntegration.setScriptExecutable("cat") pluginIntegration.configure() from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration strMOSFLMInputIntegrationXML = self.readAndParseFile(self.strReferenceDataInputFile) strMOSFLMOutputIntegrationXML = self.readAndParseFile(self.strReferenceDataOutputFile) xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration.parseString(strMOSFLMInputIntegrationXML) xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(strMOSFLMOutputIntegrationXML) pluginIntegration.setDataInput(xsDataMOSFLMInputIntegration) pluginIntegration.setDataOutput(xsDataMOSFLMOutputIntegration) pluginIntegration.generateExecutiveSummary(pluginIntegration) pluginIntegration.verboseScreenExecutiveSummary() self.cleanUp(pluginIntegration)
def testGenerateXSDataIntegrationSubWedgeResult(self): strFilename = "XSDataMOSFLMOutputIntegration_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(strXMLMOSFLMOutputIntegration) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult(xsDataMOSFLMOutputIntegration) strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIntegrationSubWedgeResult xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString(strXMLIntegrationSubWedgeReference) EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(), xsDataIntegrationSubWedgeResult.marshal())
def testExecute(self): self.run() # Compare results strXMLExpected = self.readAndParseFile( self.__strReferenceDataOutputFile) xsDataObtained = self.getPlugin().getDataOutput() xsDataExpected = XSDataMOSFLMOutputIntegration.parseString( strXMLExpected) # Remove the bestFileHKL part which creates problem... xsDataObtained.setBestfileHKL(None) xsDataExpected.setBestfileHKL(None) EDAssert.strAlmostEqual( xsDataExpected.marshal(), xsDataObtained.marshal(), "(MOSFLM integration result comparison - expected versus obtained)", 0.1, 5000)
def testCreateDataMOSFLMOutputIntegration(self): pluginIntegration = self.createPlugin() pluginIntegration.setScriptExecutable("cat") pluginIntegration.configure() strBaseName = pluginIntegration.getBaseName() shutil.copyfile( os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfileDat_ok.txt"), os.path.join(pluginIntegration.getWorkingDirectory(), "bestfile.dat")) shutil.copyfile( os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfilePar_ok.txt"), os.path.join(pluginIntegration.getWorkingDirectory(), "bestfile.par")) shutil.copyfile( os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfileHKL_ok.txt"), os.path.join(pluginIntegration.getWorkingDirectory(), "bestfile.hkl")) shutil.copyfile( os.path.join( self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_outputDnaTables_ok.xml"), os.path.join(pluginIntegration.getWorkingDirectory(), strBaseName + "_dnaTables.xml")) strMatrixFile = os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt") pluginIntegration.setMatrixFileName(strMatrixFile) xsDataMOSFLMIntegrationOutput = pluginIntegration.createDataMOSFLMOutputIntegration( ) # Fix problem with absolute path by replacing it with a fixed one xsDataFile = XSDataFile() xsDataFile.setPath( XSDataString("/tmp/EDPluginMOSFLMIntegrationv10_process_1_1.mtz")) xsDataMOSFLMIntegrationOutput.setGeneratedMTZFile(xsDataFile) strReferenceXML = self.readAndParseFile( self.strReferenceDataOutputFile) xsDataMOSFLMIntegrationOutputReference = XSDataMOSFLMOutputIntegration.parseString( strReferenceXML) # Replace path to log file since it cannot be determined by the unit test xsDataMOSFLMIntegrationOutput.setPathToLogFile( XSDataFile(XSDataString("MOSFLMIntegrationv10.log"))) EDAssert.equal(xsDataMOSFLMIntegrationOutputReference.marshal(), xsDataMOSFLMIntegrationOutput.marshal())
def testGenerateExecutiveSummary(self): pluginIntegration = self.createPlugin() pluginIntegration.setScriptExecutable("cat") pluginIntegration.configure() from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration strMOSFLMInputIntegrationXML = self.readAndParseFile( self.strReferenceDataInputFile) strMOSFLMOutputIntegrationXML = self.readAndParseFile( self.strReferenceDataOutputFile) xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration.parseString( strMOSFLMInputIntegrationXML) xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString( strMOSFLMOutputIntegrationXML) pluginIntegration.setDataInput(xsDataMOSFLMInputIntegration) pluginIntegration.setDataOutput(xsDataMOSFLMOutputIntegration) pluginIntegration.generateExecutiveSummary(pluginIntegration) pluginIntegration.verboseScreenExecutiveSummary() self.cleanUp(pluginIntegration)
def testCreateDataMOSFLMOutputIntegration(self): pluginIntegration = self.createPlugin() pluginIntegration.setScriptExecutable("cat") pluginIntegration.configure() strBaseName = pluginIntegration.getBaseName() shutil.copyfile(os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfileDat_ok.txt"), os.path.join (pluginIntegration.getWorkingDirectory(), "bestfile.dat")) shutil.copyfile(os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfilePar_ok.txt"), os.path.join (pluginIntegration.getWorkingDirectory(), "bestfile.par")) shutil.copyfile(os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_bestfileHKL_ok.txt"), os.path.join (pluginIntegration.getWorkingDirectory(), "bestfile.hkl")) shutil.copyfile(os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMIntegrationv10_outputDnaTables_ok.xml"), os.path.join(pluginIntegration.getWorkingDirectory(), strBaseName + "_dnaTables.xml")) strMatrixFile = os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt") pluginIntegration.setMatrixFileName(strMatrixFile) xsDataMOSFLMIntegrationOutput = pluginIntegration.createDataMOSFLMOutputIntegration() # Fix problem with absolute path by replacing it with a fixed one xsDataFile = XSDataFile() xsDataFile.setPath(XSDataString("/tmp/EDPluginMOSFLMIntegrationv10_process_1_1.mtz")) xsDataMOSFLMIntegrationOutput.setGeneratedMTZFile(xsDataFile) strReferenceXML = self.readAndParseFile(self.strReferenceDataOutputFile) xsDataMOSFLMIntegrationOutputReference = XSDataMOSFLMOutputIntegration.parseString(strReferenceXML) EDAssert.equal(xsDataMOSFLMIntegrationOutputReference.marshal(), xsDataMOSFLMIntegrationOutput.marshal())
def testGenerateXSDataIntegrationSubWedgeResult(self): strFilename = "XSDataMOSFLMOutputIntegration_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString( strXMLMOSFLMOutputIntegration) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult( xsDataMOSFLMOutputIntegration) strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile( strReferencePath) from XSDataMXv1 import XSDataIntegrationSubWedgeResult xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString( strXMLIntegrationSubWedgeReference) EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(), xsDataIntegrationSubWedgeResult.marshal())