def testCreateOutputFileDictionary(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles( ) pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join( self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString( strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath( xsDataResultCharacterisation) pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath) xsDataDictionary = pluginMXCuBE.createOutputFileDictionary( xsDataStringListOfOutputFiles, xsDataResultCharacterisation, strDNAFileDirectoryPath) EDAssert.equal(False, xsDataDictionary is None) shutil.rmtree(strDNAFileDirectoryPath)
def testCreateDNAFileDirectoryPath(self): pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join(self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString(strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath(xsDataResultCharacterisation) strDNAFileDirectoryPathExpected = os.path.join(EDUtilsPath.getEdnaHome(), "tests", "data", "images", "testscale_1_dnafiles") EDAssert.equal(strDNAFileDirectoryPathExpected, strDNAFileDirectoryPath)
def testGetXSDataResultCharacterisation(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles().getValue() pluginMXCuBE = self.createPlugin() xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation(strListOfOutputFiles) strPathToResultCharacterisationReference = os.path.join(self.getPluginTestsDataHome(), "EDPluginControlCharacterisationv1_1_dataOutput.xml") xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile(strPathToResultCharacterisationReference) EDAssert.equal(xsDataResultCharacterisationReference.marshal(), xsDataResultCharacterisation.marshal())
def getXSDataResultCharacterisation(self, _strListOfOutputFiles): listResult = _strListOfOutputFiles.split() # Search for the outputfile xsDataResultCharacterisation = None strPathToXSDataResultCharacteristion = None for strLine in listResult: if (strLine.find("dataOutput.xml") != -1): strPathToXSDataResultCharacteristion = strLine if (strPathToXSDataResultCharacteristion is not None): xsDataResultCharacterisation = XSDataResultCharacterisation.parseFile(strPathToXSDataResultCharacteristion) else: errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlInterfaceToMXCuBEv1_2.getXSDataResultCharacterisation", "Cannot find dataOutput.xml file in %s" % _strListOfOutputFiles) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage return xsDataResultCharacterisation
def testCreateDNAFileDirectoryPath(self): pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join( self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString( strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath( xsDataResultCharacterisation) strDNAFileDirectoryPathExpected = os.path.join( EDUtilsPath.getEdnaHome(), "tests", "data", "images", "testscale_1_dnafiles") EDAssert.equal(strDNAFileDirectoryPathExpected, strDNAFileDirectoryPath)
def testGetXSDataResultCharacterisation(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles( ).getValue() pluginMXCuBE = self.createPlugin() xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation( strListOfOutputFiles) strPathToResultCharacterisationReference = os.path.join( self.getPluginTestsDataHome(), "EDPluginControlCharacterisationv1_1_dataOutput.xml") xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile( strPathToResultCharacterisationReference) EDAssert.equal(xsDataResultCharacterisationReference.marshal(), xsDataResultCharacterisation.marshal())
def testCreateOutputFileDictionary(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles() pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join(self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString(strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath(xsDataResultCharacterisation) pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath) xsDataDictionary = pluginMXCuBE.createOutputFileDictionary(xsDataStringListOfOutputFiles, xsDataResultCharacterisation, strDNAFileDirectoryPath) EDAssert.equal(False, xsDataDictionary is None) shutil.rmtree(strDNAFileDirectoryPath)