def testSetDataInput(self): from XSDataRaddosev10 import XSDataRaddoseInput edPluginRaddose = self.createPlugin() strXMLInputData = self.readAndParseFile(self.strReferenceInputFile) edPluginRaddose.setDataInput(strXMLInputData) edPluginRaddose.setScriptExecutable("cat") edPluginRaddose.preProcess() xsDataInput = edPluginRaddose.getDataInput() xsDataInput.exportToFile("XSDataInputRaddosev10FromObject.xml") strExpectedInput = self.readAndParseFile(self.strReferenceInputFile) strObtainedInput = self.readAndParseFile( "XSDataInputRaddosev10FromObject.xml") xsDataRaddoseInputExpected = XSDataRaddoseInput.parseString( strExpectedInput) xsDataRaddoseInputObtained = XSDataRaddoseInput.parseString( strObtainedInput) EDAssert.equal(xsDataRaddoseInputExpected.marshal(), xsDataRaddoseInputObtained.marshal()) EDAssert.equal("CELL 78.9 95.162 104.087 90.0 90.0 90.0", edPluginRaddose.getCommandCrystalCell()) EDAssert.equal("NRES 295", edPluginRaddose.getCommandCrystalNRES()) EDAssert.equal("NMON 8", edPluginRaddose.getCommandCrystalNMON()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalNDNA()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalNRNA()) EDAssert.equal( "S", xsDataInput.getCrystalPATM().getAtom()[0].getSymbol().getValue()) EDAssert.equal( 4, xsDataInput.getCrystalPATM().getAtom()[0].getNumberOf().getValue()) EDAssert.equal( "Se", xsDataInput.getCrystalPATM().getAtom()[1].getSymbol().getValue()) EDAssert.equal( 4, xsDataInput.getCrystalPATM().getAtom()[1].getNumberOf().getValue()) EDAssert.equal("PATM S 4.0 Se 4.0", edPluginRaddose.getCommandCrystalPATM()) EDAssert.equal(None, xsDataInput.getCrystalSATM()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalSATM()) EDAssert.equal("CRYSTAL 0.1 0.1 0.1", edPluginRaddose.getCommandCrystalSize()) EDAssert.equal("BEAM 0.1 0.1", edPluginRaddose.getCommandBeamSize()) EDAssert.equal("PHOSEC 1e+12", edPluginRaddose.getCommandBeamFlux()) EDAssert.equal("WAVELENGTH 2.41", edPluginRaddose.getCommandBeamWavelength()) EDAssert.equal("EXPOSURE 1.0", edPluginRaddose.getCommandExposureTime()) EDAssert.equal("IMAGES 1", edPluginRaddose.getCommandImages()) self.cleanUp(edPluginRaddose)
def testSetDataInput(self): from XSDataRaddosev10 import XSDataRaddoseInput edPluginRaddose = self.createPlugin() strXMLInputData = self.readAndParseFile (self.strReferenceInputFile) edPluginRaddose.setDataInput(strXMLInputData) edPluginRaddose.setScriptExecutable("cat") edPluginRaddose.preProcess() xsDataInput = edPluginRaddose.getDataInput() xsDataInput.exportToFile("XSDataInputRaddosev10FromObject.xml") strExpectedInput = self.readAndParseFile(self.strReferenceInputFile) strObtainedInput = self.readAndParseFile("XSDataInputRaddosev10FromObject.xml") xsDataRaddoseInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataRaddoseInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataRaddoseInputExpected.marshal(), xsDataRaddoseInputObtained.marshal()) EDAssert.equal("CELL 78.9 95.162 104.087 90.0 90.0 90.0", edPluginRaddose.getCommandCrystalCell()) EDAssert.equal("NRES 295", edPluginRaddose.getCommandCrystalNRES()) EDAssert.equal("NMON 8", edPluginRaddose.getCommandCrystalNMON()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalNDNA()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalNRNA()) EDAssert.equal("S", xsDataInput.getCrystalPATM().getAtom()[0].getSymbol().getValue()) EDAssert.equal(4, xsDataInput.getCrystalPATM().getAtom()[0].getNumberOf().getValue()) EDAssert.equal("Se", xsDataInput.getCrystalPATM().getAtom()[1].getSymbol().getValue()) EDAssert.equal(4, xsDataInput.getCrystalPATM().getAtom()[1].getNumberOf().getValue()) EDAssert.equal("PATM S 4.0 Se 4.0", edPluginRaddose.getCommandCrystalPATM()) EDAssert.equal(None, xsDataInput.getCrystalSATM()) EDAssert.equal(None, edPluginRaddose.getCommandCrystalSATM()) EDAssert.equal("CRYSTAL 0.1 0.1 0.1", edPluginRaddose.getCommandCrystalSize()) EDAssert.equal("BEAM 0.1 0.1", edPluginRaddose.getCommandBeamSize()) EDAssert.equal("PHOSEC 1e+12", edPluginRaddose.getCommandBeamFlux()) EDAssert.equal("WAVELENGTH 2.41", edPluginRaddose.getCommandBeamWavelength()) EDAssert.equal("EXPOSURE 1.0", edPluginRaddose.getCommandExposureTime()) EDAssert.equal("IMAGES 1", edPluginRaddose.getCommandImages()) self.cleanUp(edPluginRaddose)
def getXSDataRaddoseInput(self, _xsDataBeam, _xsDataSample, _inumOperators, _iNumberOfImages): xsDataRaddoseInput = XSDataRaddoseInput() # Beam xsDataRaddoseInput.setBeamSize(_xsDataBeam.getSize()) xsDataRaddoseInput.setBeamFlux(_xsDataBeam.getFlux()) xsDataRaddoseInput.setBeamWavelength(_xsDataBeam.getWavelength()) xsDataRaddoseInput.setBeamExposureTime(_xsDataBeam.getExposureTime()) xsDataRaddoseInput.setNumberOfImages(XSDataInteger(_iNumberOfImages)) xsDataRaddoseInput.setCrystalCell(_xsDataSample.getCrystal().getCell()) xsDataRaddoseInput.setCrystalSize(_xsDataSample.getSize()) xsDataComposition = _xsDataSample.getChemicalComposition() xsDataSolvent = xsDataComposition.getSolvent() if (xsDataSolvent is not None): xsDataRaddoseInput.setCrystalSATM(xsDataSolvent.getAtoms()) xsDataStructure = xsDataComposition.getStructure() if (xsDataStructure is not None): xsDataChains = xsDataStructure.getChain() totalNRESInStructure = 0 totalNDNAInStructure = 0 totalNRNAInStructure = 0 totalPATM = XSDataAtomicComposition() for chain in xsDataChains: # heavy atoms of each chain to be added in the PATM xsDataAtomicCompositionHeavyAtoms = chain.getHeavyAtoms() if (xsDataAtomicCompositionHeavyAtoms is not None): iterator = 1 while iterator <= chain.getNumberOfCopies().getValue(): totalPATM = self.mergeAtomicComposition( totalPATM, xsDataAtomicCompositionHeavyAtoms) iterator = iterator + 1 type = chain.getType().getValue() numberOfMonomers = chain.getNumberOfMonomers().getValue( ) * chain.getNumberOfCopies().getValue() if (type == "protein"): totalNRESInStructure = totalNRESInStructure + numberOfMonomers elif (type == "dna"): totalNDNAInStructure = totalNDNAInStructure + numberOfMonomers elif (type == "rna"): totalNRNAInStructure = totalNRNAInStructure + numberOfMonomers xsDataLigands = xsDataStructure.getLigand() for ligand in xsDataLigands: # Light atoms to be added to the NRES nres = ligand.getNumberOfLightAtoms().getValue( ) * ligand.getNumberOfCopies().getValue() / 7.85 totalNRESInStructure = totalNRESInStructure + nres # Heavy atoms to be added to the PATM if (ligand.getHeavyAtoms() is not None): iterator = 1 while iterator <= ligand.getNumberOfCopies().getValue(): totalPATM = self.mergeAtomicComposition( totalPATM, ligand.getHeavyAtoms()) iterator = iterator + 1 if (totalNRESInStructure != 0): xsDataRaddoseInput.setCrystalNRES( XSDataInteger(int(round(totalNRESInStructure)))) if (totalNDNAInStructure != 0): xsDataRaddoseInput.setCrystalNDNA( XSDataInteger(int(totalNDNAInStructure))) if (totalNRNAInStructure != 0): xsDataRaddoseInput.setCrystalNRNA( XSDataInteger(int(totalNRNAInStructure))) if (len(totalPATM.getAtom()) != 0): xsDataRaddoseInput.setCrystalPATM(totalPATM) xsDataNumberNumStructInAU = xsDataStructure.getNumberOfCopiesInAsymmetricUnit( ) xsDataNumberNumStructInUC = int( xsDataNumberNumStructInAU.getValue() * _inumOperators) xsDataRaddoseInput.setCrystalNMON( XSDataInteger(xsDataNumberNumStructInUC)) return xsDataRaddoseInput
def testSetDataModelInput(self): # Crystal from XSDataRaddosev10 import XSDataRaddoseInput xsDataRaddoseInput = XSDataRaddoseInput() from XSDataCommon import XSDataString from XSDataCommon import XSDataDouble from XSDataCommon import XSDataAngle from XSDataCommon import XSDataLength from XSDataCommon import XSDataSize from XSDataCommon import XSDataInteger from XSDataRaddosev10 import XSDataCell from XSDataRaddosev10 import XSDataAtom from XSDataRaddosev10 import XSDataAtomicComposition xsDataAtomSulfur = XSDataAtom() xsDataAtomSulfur.setNumberOf(XSDataDouble(4)) xsDataAtomSulfur.setSymbol(XSDataString("S")) xsDataAtomSelenium = XSDataAtom() xsDataAtomSelenium.setNumberOf(XSDataDouble(4)) xsDataAtomSelenium.setSymbol(XSDataString("Se")) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomicComposition.addAtom(xsDataAtomSulfur) xsDataAtomicComposition.addAtom(xsDataAtomSelenium) xsDataRaddoseInput.setCrystalPATM(xsDataAtomicComposition) xsDataRaddoseInput.setCrystalNRES(XSDataInteger(295)) xsDataRaddoseInput.setCrystalNMON(XSDataInteger(8)) xsDataCell = XSDataCell(angle_alpha=XSDataAngle(90.0), angle_beta=XSDataAngle(90.0), angle_gamma=XSDataAngle(90.0), length_a=XSDataLength(78.9), length_b=XSDataLength(95.162), length_c=XSDataLength(104.087)) xsDataSizeCrystal = XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1)) xsDataRaddoseInput.setCrystalCell(xsDataCell) xsDataRaddoseInput.setCrystalSize(xsDataSizeCrystal) # Beam from XSDataCommon import XSDataFlux from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataTime xsDataSize = XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1)) xsDataRaddoseInput.setBeamSize(xsDataSize) xsDataRaddoseInput.setBeamFlux(XSDataFlux(1e+12)) xsDataRaddoseInput.setBeamWavelength(XSDataWavelength(2.41)) xsDataRaddoseInput.setBeamExposureTime(XSDataTime(1)) xsDataRaddoseInput.setNumberOfImages(XSDataInteger(1)) xsDataRaddoseInput.exportToFile(self.strObtainedInputFile) strExpectedInput = self.readAndParseFile(self.strReferenceInputFile) strObtainedInput = self.readAndParseFile(self.strObtainedInputFile) xsDataRaddoseInputExpected = XSDataRaddoseInput.parseString( strExpectedInput) xsDataRaddoseInputObtained = XSDataRaddoseInput.parseString( strObtainedInput) EDAssert.equal(xsDataRaddoseInputExpected.marshal(), xsDataRaddoseInputObtained.marshal())
def testGetXSDataRaddoseInput(self): """ """ from XSDataCommon import XSDataLength from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataFlux from XSDataCommon import XSDataSize from XSDataCommon import XSDataDouble from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataTime from XSDataCommon import XSDataInteger from XSDataMXv1 import XSDataBeam from XSDataMXv1 import XSDataStructure from XSDataMXv1 import XSDataChain from XSDataMXv1 import XSDataAtom from XSDataMXv1 import XSDataLigand from XSDataMXv1 import XSDataCrystal from XSDataMXv1 import XSDataSpaceGroup from XSDataMXv1 import XSDataSampleCrystalMM from XSDataMXv1 import XSDataChemicalCompositionMM from XSDataMXv1 import XSDataAtomicComposition from XSDataMXv1 import XSDataSolvent from XSDataMXv1 import XSDataCell from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10 EDFactoryPluginStatic.loadModule("XSDataRaddosev10") from XSDataRaddosev10 import XSDataRaddoseInput xsDataBeam = XSDataBeam() xsDataBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1))) xsDataBeam.setWavelength(XSDataWavelength(2.41)) xsDataBeam.setFlux(XSDataFlux(1e+12)) xsDataSample = XSDataSampleCrystalMM() xsDataStructure = XSDataStructure() xsDataComposition = XSDataChemicalCompositionMM() xsDataChain = XSDataChain() xsDataChain.setType(XSDataString("protein")) xsDataChain.setNumberOfCopies(XSDataDouble(2)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom1 = XSDataAtom() xsDataAtom1.setSymbol(XSDataString("Se")) xsDataAtom1.setNumberOf(XSDataDouble(4)) xsDataAtomicComposition.addAtom(xsDataAtom1) xsDataAtom2 = XSDataAtom() xsDataAtom2.setSymbol(XSDataString("S")) xsDataAtom2.setNumberOf(XSDataDouble(5)) xsDataAtomicComposition.addAtom(xsDataAtom2) xsDataChain.setHeavyAtoms(xsDataAtomicComposition) xsDataChain.setNumberOfMonomers(XSDataDouble(100)) xsDataStructure.addChain(xsDataChain) xsDataChain2 = XSDataChain() xsDataChain2.setType(XSDataString("rna")) xsDataChain2.setNumberOfCopies(XSDataDouble(1)) xsDataChain2.setNumberOfMonomers(XSDataDouble(60)) xsDataStructure.addChain(xsDataChain2) xsDataLigand = XSDataLigand() xsDataLigand.setNumberOfCopies(XSDataDouble(2)) xsDataLigand.setNumberOfLightAtoms(XSDataDouble(42)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom3 = XSDataAtom() xsDataAtom3.setSymbol(XSDataString("Fe")) xsDataAtom3.setNumberOf(XSDataDouble(1)) xsDataAtomicComposition.addAtom(xsDataAtom3) xsDataLigand.setHeavyAtoms(xsDataAtomicComposition) xsDataStructure.addLigand(xsDataLigand) xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataDouble(0.25)) xsDataSolvent = XSDataSolvent() xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomNa = XSDataAtom() xsDataAtomNa.setSymbol(XSDataString("Na")) xsDataAtomNa.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomNa) xsDataAtomCl = XSDataAtom() xsDataAtomCl.setSymbol(XSDataString("Cl")) xsDataAtomCl.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomCl) xsDataSolvent.setAtoms(xsDataAtomicComposition) xsDataComposition.setStructure(xsDataStructure) xsDataComposition.setSolvent(xsDataSolvent) xsDataSample.setChemicalComposition(xsDataComposition) xsDataSample.setSize(XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1))) xsDataCell = XSDataCell(angle_alpha=XSDataAngle(90.0), angle_beta=XSDataAngle(90.0), angle_gamma=XSDataAngle(90.0), length_a=XSDataLength(78.9), length_b=XSDataLength(95.162), length_c=XSDataLength(104.087)) xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataCrystal.setCell(xsDataCell) xsDataSpaceGroup.setITNumber(XSDataInteger(16)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataSample.setCrystal(xsDataCrystal) iNumSymOperators = 4 xsDataRaddosev01Input = EDHandlerXSDataRaddosev10().getXSDataRaddoseInput(xsDataBeam, xsDataSample, iNumSymOperators) xsDataRaddosev01Input.exportToFile(self.strObtainedInputFile2) strExpectedInput = EDUtilsTest.readAndParseFile (self.strReferenceInputFile2) strObtainedInput = EDUtilsTest.readAndParseFile (self.strObtainedInputFile2) xsDataInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
def testGetXSDataRaddoseInput(self): """ """ from XSDataCommon import XSDataLength from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataFlux from XSDataCommon import XSDataSize from XSDataCommon import XSDataDouble from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataTime from XSDataCommon import XSDataInteger from XSDataMXv1 import XSDataBeam from XSDataMXv1 import XSDataStructure from XSDataMXv1 import XSDataChain from XSDataMXv1 import XSDataAtom from XSDataMXv1 import XSDataLigand from XSDataMXv1 import XSDataCrystal from XSDataMXv1 import XSDataSpaceGroup from XSDataMXv1 import XSDataSampleCrystalMM from XSDataMXv1 import XSDataChemicalCompositionMM from XSDataMXv1 import XSDataAtomicComposition from XSDataMXv1 import XSDataSolvent from XSDataMXv1 import XSDataCell from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10 EDFactoryPluginStatic.loadModule("XSDataRaddosev10") from XSDataRaddosev10 import XSDataRaddoseInput xsDataBeam = XSDataBeam() xsDataBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1))) xsDataBeam.setWavelength(XSDataWavelength(2.41)) xsDataBeam.setFlux(XSDataFlux(1e+12)) xsDataBeam.setExposureTime(XSDataTime(0.037)) xsDataSample = XSDataSampleCrystalMM() xsDataStructure = XSDataStructure() xsDataComposition = XSDataChemicalCompositionMM() xsDataChain = XSDataChain() xsDataChain.setType(XSDataString("protein")) xsDataChain.setNumberOfCopies(XSDataDouble(2)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom1 = XSDataAtom() xsDataAtom1.setSymbol(XSDataString("Se")) xsDataAtom1.setNumberOf(XSDataDouble(4)) xsDataAtomicComposition.addAtom(xsDataAtom1) xsDataAtom2 = XSDataAtom() xsDataAtom2.setSymbol(XSDataString("S")) xsDataAtom2.setNumberOf(XSDataDouble(5)) xsDataAtomicComposition.addAtom(xsDataAtom2) xsDataChain.setHeavyAtoms(xsDataAtomicComposition) xsDataChain.setNumberOfMonomers(XSDataDouble(100)) xsDataStructure.addChain(xsDataChain) xsDataChain2 = XSDataChain() xsDataChain2.setType(XSDataString("rna")) xsDataChain2.setNumberOfCopies(XSDataDouble(1)) xsDataChain2.setNumberOfMonomers(XSDataDouble(60)) xsDataStructure.addChain(xsDataChain2) xsDataLigand = XSDataLigand() xsDataLigand.setNumberOfCopies(XSDataDouble(2)) xsDataLigand.setNumberOfLightAtoms(XSDataDouble(42)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom3 = XSDataAtom() xsDataAtom3.setSymbol(XSDataString("Fe")) xsDataAtom3.setNumberOf(XSDataDouble(1)) xsDataAtomicComposition.addAtom(xsDataAtom3) xsDataLigand.setHeavyAtoms(xsDataAtomicComposition) xsDataStructure.addLigand(xsDataLigand) xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataDouble(0.25)) xsDataSolvent = XSDataSolvent() xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomNa = XSDataAtom() xsDataAtomNa.setSymbol(XSDataString("Na")) xsDataAtomNa.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomNa) xsDataAtomCl = XSDataAtom() xsDataAtomCl.setSymbol(XSDataString("Cl")) xsDataAtomCl.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomCl) xsDataSolvent.setAtoms(xsDataAtomicComposition) xsDataComposition.setStructure(xsDataStructure) xsDataComposition.setSolvent(xsDataSolvent) xsDataSample.setChemicalComposition(xsDataComposition) xsDataSample.setSize( XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1))) xsDataCell = XSDataCell(angle_alpha=XSDataAngle(90.0), angle_beta=XSDataAngle(90.0), angle_gamma=XSDataAngle(90.0), length_a=XSDataLength(78.9), length_b=XSDataLength(95.162), length_c=XSDataLength(104.087)) xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataCrystal.setCell(xsDataCell) xsDataSpaceGroup.setITNumber(XSDataInteger(16)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataSample.setCrystal(xsDataCrystal) iNumSymOperators = 4 iNumberOfImages = 2 xsDataRaddosev01Input = EDHandlerXSDataRaddosev10( ).getXSDataRaddoseInput(xsDataBeam, xsDataSample, iNumSymOperators, iNumberOfImages) xsDataRaddosev01Input.exportToFile(self.strObtainedInputFile2) strExpectedInput = EDUtilsTest.readAndParseFile( self.strReferenceInputFile2) strObtainedInput = EDUtilsTest.readAndParseFile( self.strObtainedInputFile2) xsDataInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
def getXSDataRaddoseInput(self, _xsDataBeam, _xsDataSample, _inumOperators): xsDataRaddoseInput = XSDataRaddoseInput() # Beam xsDataRaddoseInput.setBeamSize(_xsDataBeam.getSize()) xsDataRaddoseInput.setBeamFlux(_xsDataBeam.getFlux()) xsDataRaddoseInput.setBeamWavelength(_xsDataBeam.getWavelength()) xsDataRaddoseInput.setBeamExposureTime(XSDataTime(1.0)) xsDataRaddoseInput.setNumberOfImages(XSDataInteger(1)) xsDataRaddoseInput.setCrystalCell(_xsDataSample.getCrystal().getCell()) xsDataRaddoseInput.setCrystalSize(_xsDataSample.getSize()) xsDataComposition = _xsDataSample.getChemicalComposition() xsDataSolvent = xsDataComposition.getSolvent() if(xsDataSolvent is not None): xsDataRaddoseInput.setCrystalSATM(xsDataSolvent.getAtoms()) xsDataStructure = xsDataComposition.getStructure() if(xsDataStructure is not None): xsDataChains = xsDataStructure.getChain() totalNRESInStructure = 0 totalNDNAInStructure = 0 totalNRNAInStructure = 0 totalPATM = XSDataAtomicComposition() for chain in xsDataChains: # heavy atoms of each chain to be added in the PATM xsDataAtomicCompositionHeavyAtoms = chain.getHeavyAtoms() if (xsDataAtomicCompositionHeavyAtoms is not None): iterator = 1 while iterator <= chain.getNumberOfCopies().getValue(): totalPATM = self.mergeAtomicComposition(totalPATM, xsDataAtomicCompositionHeavyAtoms) iterator = iterator + 1 type = chain.getType().getValue() numberOfMonomers = chain.getNumberOfMonomers().getValue() * chain.getNumberOfCopies().getValue() if (type == "protein"): totalNRESInStructure = totalNRESInStructure + numberOfMonomers elif(type == "dna"): totalNDNAInStructure = totalNDNAInStructure + numberOfMonomers elif(type == "rna"): totalNRNAInStructure = totalNRNAInStructure + numberOfMonomers xsDataLigands = xsDataStructure.getLigand() for ligand in xsDataLigands: # Light atoms to be added to the NRES nres = ligand.getNumberOfLightAtoms().getValue() * ligand.getNumberOfCopies().getValue() / 7.85 totalNRESInStructure = totalNRESInStructure + nres # Heavy atoms to be added to the PATM if (ligand.getHeavyAtoms() is not None): iterator = 1 while iterator <= ligand.getNumberOfCopies().getValue(): totalPATM = self.mergeAtomicComposition(totalPATM, ligand.getHeavyAtoms()) iterator = iterator + 1 if(totalNRESInStructure != 0): xsDataRaddoseInput.setCrystalNRES(XSDataInteger(int(round(totalNRESInStructure)))) if(totalNDNAInStructure != 0): xsDataRaddoseInput.setCrystalNDNA(XSDataInteger(int(totalNDNAInStructure))) if(totalNRNAInStructure != 0): xsDataRaddoseInput.setCrystalNRNA(XSDataInteger(int(totalNRNAInStructure))) if(len(totalPATM.getAtom()) != 0): xsDataRaddoseInput.setCrystalPATM(totalPATM) xsDataNumberNumStructInAU = xsDataStructure.getNumberOfCopiesInAsymmetricUnit() xsDataNumberNumStructInUC = int(xsDataNumberNumStructInAU.getValue() * _inumOperators) xsDataRaddoseInput.setCrystalNMON(XSDataInteger(xsDataNumberNumStructInUC)) return xsDataRaddoseInput
def testSetDataModelInput(self): # Crystal from XSDataRaddosev10 import XSDataRaddoseInput xsDataRaddoseInput = XSDataRaddoseInput() from XSDataCommon import XSDataString from XSDataCommon import XSDataFloat from XSDataCommon import XSDataAngle from XSDataCommon import XSDataLength from XSDataCommon import XSDataSize from XSDataCommon import XSDataInteger from XSDataRaddosev10 import XSDataCell from XSDataRaddosev10 import XSDataAtom from XSDataRaddosev10 import XSDataAtomicComposition xsDataAtomSulfur = XSDataAtom() xsDataAtomSulfur.setNumberOf(XSDataFloat(4)) xsDataAtomSulfur.setSymbol(XSDataString("S")) xsDataAtomSelenium = XSDataAtom() xsDataAtomSelenium.setNumberOf(XSDataFloat(4)) xsDataAtomSelenium.setSymbol(XSDataString("Se")) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomicComposition.addAtom(xsDataAtomSulfur) xsDataAtomicComposition.addAtom(xsDataAtomSelenium) xsDataRaddoseInput.setCrystalPATM(xsDataAtomicComposition) xsDataRaddoseInput.setCrystalNRES(XSDataInteger(295)) xsDataRaddoseInput.setCrystalNMON(XSDataInteger(8)) xsDataCell = XSDataCell(angle_alpha = XSDataAngle(90.0), angle_beta = XSDataAngle(90.0), angle_gamma = XSDataAngle(90.0), length_a = XSDataLength(78.9), length_b = XSDataLength(95.162), length_c = XSDataLength(104.087)) xsDataSizeCrystal = XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1)) xsDataRaddoseInput.setCrystalCell(xsDataCell) xsDataRaddoseInput.setCrystalSize(xsDataSizeCrystal) # Beam from XSDataCommon import XSDataFlux from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataTime xsDataSize = XSDataSize(x = XSDataLength(0.1), y = XSDataLength(0.1)) xsDataRaddoseInput.setBeamSize(xsDataSize) xsDataRaddoseInput.setBeamFlux(XSDataFlux(1e+12)) xsDataRaddoseInput.setBeamWavelength(XSDataWavelength(2.41)) xsDataRaddoseInput.setBeamExposureTime(XSDataTime(1)) xsDataRaddoseInput.setNumberOfImages(XSDataInteger(1)) xsDataRaddoseInput.exportToFile(self.strObtainedInputFile) strExpectedInput = self.readAndParseFile (self.strReferenceInputFile) strObtainedInput = self.readAndParseFile (self.strObtainedInputFile) xsDataRaddoseInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataRaddoseInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataRaddoseInputExpected.marshal(), xsDataRaddoseInputObtained.marshal())