def process(self, _edObject=None): EDPluginControl.process(self) self.DEBUG("EDPluginControlSaxsModelingv1_1.process") xsDataInputDammif = XSDataInputDammif(gnomOutputFile=self.xsGnomFile, unit=XSDataString(self.unit), symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) for i in range(self.dammif_jobs): dammif = self.loadPlugin(self.strPluginExecDammif) dammif.connectSUCCESS(self.doSuccessExecDammif) dammif.connectFAILURE(self.doFailureExecDammif) xsd = xsDataInputDammif.copyViaDict() xsd.order = XSDataInteger(i + 1) dammif.dataInput = xsd self.addPluginToActionCluster(dammif) self.dammif_plugins.append(dammif) self.executeActionCluster() self.synchronizeActionCluster() for plugin in self.dammif_plugins: if plugin.isFailure(): self.ERROR("dammif plugin %s-%08i failed" % (plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return # retrieve results from best dammif self.dammif = self.bestDammif() self.chi2plot("chi2_R.png") self.result.chiRfactorPlot = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), "chi2_R.png"))) # temporary results: use best dammif self.result.fitFile = self.dammif.dataOutput.fitFile self.result.logFile = self.dammif.dataOutput.logFile self.result.pdbMoleculeFile = self.dammif.dataOutput.pdbMoleculeFile self.result.pdbSolventFile = self.dammif.dataOutput.pdbSolventFile # align models, compute NSD and choose the reference model inputfiles = [self.dammif_plugins[idx].dataOutput.pdbMoleculeFile.path.value for idx in range(self.dammif_jobs)] align = AlignModels(inputfiles, slow=False) outputfiles = [] for i in range(self.dammif_jobs): outputfiles.append(os.path.join(self.getWorkingDirectory(), "model-%02i.pdb" % (i+1))) align.outputfiles = outputfiles #align.outputfiles = ["model-%02i.pdb" % (i+1) for i in range(self.dammif_jobs)] align.validmodels = self.valid align.assign_models() align.makeNSDarray() align.alignment_reference() self.ref = align.reference pngfile = os.path.join(self.getWorkingDirectory(), "nsd.png") align.plotNSDarray(filename=pngfile ,save=True) self.result.nsdPlot = XSDataFile(XSDataString(pngfile)) # Now that all (valid) models are aligned we can combine them using damaver pdbFiles = [XSDataFile(XSDataString(align.outputfiles[self.ref]))] for idx in range(self.dammif_jobs): if self.valid[idx] and idx != self.ref: pdbFiles.append(XSDataFile(XSDataString(align.outputfiles[idx]))) damaver = self.loadPlugin(self.strPluginExecDamaver) damaver.dataInput = XSDataInputDamaver(pdbInputFiles=pdbFiles, automatic=XSDataBoolean(False)) damaver.connectSUCCESS(self.doSuccessExecDamaver) damaver.connectFAILURE(self.doFailureExecDamaver) damaver.executeSynchronous() if self.isFailure(): return damfilt = self.loadPlugin(self.strPluginExecDamfilt) damfilt.dataInput = XSDataInputDamfilt(inputPdbFile=damaver.dataOutput.damaverPdbFile) damfilt.connectSUCCESS(self.doSuccessExecDamfilt) damfilt.connectFAILURE(self.doFailureExecDamfilt) damfilt.execute() ######################################################################## # TODO: This is a dead end : do it in parallel ######################################################################## if self.isFailure(): return damstart = self.loadPlugin(self.strPluginExecDamstart) damstart.dataInput = XSDataInputDamstart(inputPdbFile=damaver.dataOutput.damaverPdbFile) damstart.connectSUCCESS(self.doSuccessExecDamstart) damstart.connectFAILURE(self.doFailureExecDamstart) damstart.executeSynchronous() if self.isFailure(): return ######################################################################## # Finally call dammin ######################################################################## if self.config.get("do_dammin") in ["False", "0", False]: return dammin = self.loadPlugin(self.strPluginExecDammin) dammin.dataInput = XSDataInputDammin(pdbInputFile=damstart.dataOutput.outputPdbFile, gnomOutputFile=self.xsGnomFile, symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) dammin.connectSUCCESS(self.doSuccessExecDammin) dammin.connectFAILURE(self.doFailureExecDammin) dammin.executeSynchronous()
def testCheckParameters(self): xsDataInput = XSDataInputDammif() xsDataInput.gnomOutputFile = XSDataFile() edPluginExecDammif = self.createPlugin() edPluginExecDammif.setDataInput(xsDataInput) edPluginExecDammif.checkParameters()
def process(self, _edObject=None): EDPluginControl.process(self) self.DEBUG("EDPluginControlSaxsModelingv1_1.process") xsDataInputDammif = XSDataInputDammif(gnomOutputFile=self.xsGnomFile, unit=XSDataString(self.unit), symmetry=XSDataString( self.symmetry), mode=XSDataString(self.mode)) for i in range(self.dammif_jobs): dammif = self.loadPlugin(self.strPluginExecDammif) dammif.connectSUCCESS(self.doSuccessExecDammif) dammif.connectFAILURE(self.doFailureExecDammif) xsd = xsDataInputDammif.copyViaDict() xsd.order = XSDataInteger(i + 1) dammif.dataInput = xsd self.addPluginToActionCluster(dammif) self.dammif_plugins.append(dammif) self.executeActionCluster() self.synchronizeActionCluster() for plugin in self.dammif_plugins: if plugin.isFailure(): self.ERROR("dammif plugin %s-%08i failed" % (plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return # retrieve results from best dammif self.dammif = self.bestDammif() self.chi2plot("chi2_R.png") self.result.chiRfactorPlot = XSDataFile( XSDataString(os.path.join(self.getWorkingDirectory(), "chi2_R.png"))) # temporary results: use best dammif self.result.fitFile = self.dammif.dataOutput.fitFile self.result.logFile = self.dammif.dataOutput.logFile self.result.pdbMoleculeFile = self.dammif.dataOutput.pdbMoleculeFile self.result.pdbSolventFile = self.dammif.dataOutput.pdbSolventFile # align models, compute NSD and choose the reference model inputfiles = [ self.dammif_plugins[idx].dataOutput.pdbMoleculeFile.path.value for idx in range(self.dammif_jobs) ] align = AlignModels(inputfiles, slow=False) outputfiles = [] for i in range(self.dammif_jobs): outputfiles.append( os.path.join(self.getWorkingDirectory(), "model-%02i.pdb" % (i + 1))) align.outputfiles = outputfiles #align.outputfiles = ["model-%02i.pdb" % (i+1) for i in range(self.dammif_jobs)] align.validmodels = self.valid align.assign_models() align.makeNSDarray() align.alignment_reference() self.ref = align.reference pngfile = os.path.join(self.getWorkingDirectory(), "nsd.png") align.plotNSDarray(filename=pngfile, save=True) self.result.nsdPlot = XSDataFile(XSDataString(pngfile)) # Now that all (valid) models are aligned we can combine them using damaver pdbFiles = [XSDataFile(XSDataString(align.outputfiles[self.ref]))] for idx in range(self.dammif_jobs): if self.valid[idx] and idx != self.ref: pdbFiles.append( XSDataFile(XSDataString(align.outputfiles[idx]))) damaver = self.loadPlugin(self.strPluginExecDamaver) damaver.dataInput = XSDataInputDamaver(pdbInputFiles=pdbFiles, automatic=XSDataBoolean(False)) damaver.connectSUCCESS(self.doSuccessExecDamaver) damaver.connectFAILURE(self.doFailureExecDamaver) damaver.executeSynchronous() if self.isFailure(): return damfilt = self.loadPlugin(self.strPluginExecDamfilt) damfilt.dataInput = XSDataInputDamfilt( inputPdbFile=damaver.dataOutput.damaverPdbFile) damfilt.connectSUCCESS(self.doSuccessExecDamfilt) damfilt.connectFAILURE(self.doFailureExecDamfilt) damfilt.execute() ######################################################################## # TODO: This is a dead end : do it in parallel ######################################################################## if self.isFailure(): return damstart = self.loadPlugin(self.strPluginExecDamstart) damstart.dataInput = XSDataInputDamstart( inputPdbFile=damaver.dataOutput.damaverPdbFile) damstart.connectSUCCESS(self.doSuccessExecDamstart) damstart.connectFAILURE(self.doFailureExecDamstart) damstart.executeSynchronous() if self.isFailure(): return ######################################################################## # Finally call dammin ######################################################################## if self.config.get("do_dammin") in ["False", "0", False, 0]: pass #return dammin = self.loadPlugin(self.strPluginExecDammin) dammin.dataInput = XSDataInputDammin( pdbInputFile=damstart.dataOutput.outputPdbFile, gnomOutputFile=self.xsGnomFile, symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) dammin.connectSUCCESS(self.doSuccessExecDammin) dammin.connectFAILURE(self.doFailureExecDammin) dammin.executeSynchronous()
def process(self, _edObject=None): EDPluginControl.process(self) self.DEBUG("EDPluginControlSaxsModelingv1_0.process") xsDataInputDammif = XSDataInputDammif(gnomOutputFile=self.xsGnomFile, unit=XSDataString(self.unit), symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) for i in range(self.dammif_jobs): dammif = self.loadPlugin(self.strPluginExecDammif) dammif.connectSUCCESS(self.doSuccessExecDammif) dammif.connectFAILURE(self.doFailureExecDammif) xsd = xsDataInputDammif.copyViaDict() xsd.order = XSDataInteger(i + 1) dammif.dataInput = xsd self.addPluginToActionCluster(dammif) self.dammif_plugins.append(dammif) self.executeActionCluster() self.synchronizeActionCluster() for plugin in self.dammif_plugins: if plugin.isFailure(): self.ERROR("dammif plugin %s-%08i failed" % (plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return # retrieve results from best dammif self.dammif = self.bestDammif() self.chi2plot("chi2_R.png") self.result.chiRfactorPlot = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), "chi2_R.png"))) # temporary results: use best dammif self.result.fitFile = self.dammif.dataOutput.fitFile self.result.logFile = self.dammif.dataOutput.logFile self.result.pdbMoleculeFile = self.dammif.dataOutput.pdbMoleculeFile self.result.pdbSolventFile = self.dammif.dataOutput.pdbSolventFile # prepare an action cluster with all supcomb plugins self.actclust_supcomb = EDActionCluster(self.cluster_size) for idx in range(self.dammif_jobs): if self.valid[idx]: for ser in range(idx): if self.valid[ser]: supcomb = self.loadPlugin(self.strPluginExecSupcomb) supcomb.dataInput = XSDataInputSupcomb(templateFile=self.dammif_plugins[idx].dataOutput.pdbMoleculeFile, superimposeFile=self.dammif_plugins[ser].dataOutput.pdbMoleculeFile, name=self.dammif_plugins[ser].dataOutput.model.name) self.supcomb_plugins[(idx, ser)] = supcomb self.actclust_supcomb.addAction(supcomb) self.actclust_supcomb.executeSynchronous() for key, plugin in self.supcomb_plugins.items(): if plugin.isFailure(): self.ERROR("supcomb plugin for model pair (%i,%i) %s-%08i failed" % (key[0] + 1, key[1] + 1, plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return self.makeNSDarray("nsd.png") self.result.nsdPlot = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), "nsd.png"))) idx = self.ref self.actclust_supcomb = EDActionCluster(self.cluster_size) for ser in range(self.ref + 1, self.dammif_jobs): if self.valid[ser]: supcomb = self.loadPlugin(self.strPluginExecSupcomb) supcomb.dataInput = XSDataInputSupcomb(templateFile=self.dammif_plugins[self.ref].dataOutput.pdbMoleculeFile, superimposeFile=self.dammif_plugins[ser].dataOutput.pdbMoleculeFile, name=self.dammif_plugins[ser].dataOutput.model.name) self.supcomb_plugins[(self.ref, ser)] = supcomb self.actclust_supcomb.addAction(supcomb) self.actclust_supcomb.executeSynchronous() for ser in range(self.ref + 1, self.dammif_jobs): if self.valid[ser]: plugin = self.supcomb_plugins[(self.ref, ser)] if plugin.isFailure(): self.ERROR("supcomb plugin for model pair (%i,%i) %s-%08i failed" % (self.ref + 1, ser + 1, plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return for i in range(self.dammif_jobs): if i == self.ref or not self.valid[i]: model = self.dammif_plugins[i].dataOutput.model else: model = self.supcomb_plugins[(self.ref, i)].dataOutput.model model.chiSqrt = self.dammif_plugins[i].dataOutput.model.chiSqrt # model.chiSqrt = self.dammif_plugins[i].dataOutput.model.chiSqrt self.symlink(model.pdbFile.path.value, "model-%02i.pdb" % (i + 1)) self.result.dammifModels[i] = model # Now that all (valid) models are aligned we can combine them using damaver pdbFiles = [self.dammif_plugins[self.ref].dataOutput.pdbMoleculeFile] for idx in range(self.dammif_jobs): if self.valid[idx] and idx != self.ref: pdbFiles.append(self.supcomb_plugins[(self.ref, idx)].dataOutput.outputFilename) damaver = self.loadPlugin(self.strPluginExecDamaver) damaver.dataInput = XSDataInputDamaver(pdbInputFiles=pdbFiles, automatic=XSDataBoolean(False)) damaver.connectSUCCESS(self.doSuccessExecDamaver) damaver.connectFAILURE(self.doFailureExecDamaver) damaver.executeSynchronous() if self.isFailure(): return damfilt = self.loadPlugin(self.strPluginExecDamfilt) damfilt.dataInput = XSDataInputDamfilt(inputPdbFile=damaver.dataOutput.damaverPdbFile) damfilt.connectSUCCESS(self.doSuccessExecDamfilt) damfilt.connectFAILURE(self.doFailureExecDamfilt) damfilt.execute() ######################################################################## # TODO: This is a dead end : do it in parallel ######################################################################## if self.isFailure(): return damstart = self.loadPlugin(self.strPluginExecDamstart) damstart.dataInput = XSDataInputDamstart(inputPdbFile=damaver.dataOutput.damaverPdbFile) damstart.connectSUCCESS(self.doSuccessExecDamstart) damstart.connectFAILURE(self.doFailureExecDamstart) damstart.executeSynchronous() if self.isFailure(): return ######################################################################## # Finally call dammin ######################################################################## if self.config.get("do_dammin") in ["False", "0", False, 0]: return dammin = self.loadPlugin(self.strPluginExecDammin) dammin.dataInput = XSDataInputDammin(pdbInputFile=damstart.dataOutput.outputPdbFile, gnomOutputFile=self.xsGnomFile, symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) dammin.connectSUCCESS(self.doSuccessExecDammin) dammin.connectFAILURE(self.doFailureExecDammin) dammin.executeSynchronous()
def process(self, _edObject=None): EDPluginControl.process(self) self.DEBUG("EDPluginControlSaxsModelingv1_0.process") xsDataInputDammif = XSDataInputDammif(gnomOutputFile=self.xsGnomFile, unit=XSDataString(self.unit), symmetry=XSDataString( self.symmetry), mode=XSDataString(self.mode)) for i in range(self.dammif_jobs): dammif = self.loadPlugin(self.strPluginExecDammif) dammif.connectSUCCESS(self.doSuccessExecDammif) dammif.connectFAILURE(self.doFailureExecDammif) xsd = xsDataInputDammif.copyViaDict() xsd.order = XSDataInteger(i + 1) dammif.dataInput = xsd self.addPluginToActionCluster(dammif) self.dammif_plugins.append(dammif) self.executeActionCluster() self.synchronizeActionCluster() for plugin in self.dammif_plugins: if plugin.isFailure(): self.ERROR("dammif plugin %s-%08i failed" % (plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return # retrieve results from best dammif self.dammif = self.bestDammif() self.chi2plot("chi2_R.png") self.result.chiRfactorPlot = XSDataFile( XSDataString(os.path.join(self.getWorkingDirectory(), "chi2_R.png"))) # temporary results: use best dammif self.result.fitFile = self.dammif.dataOutput.fitFile self.result.logFile = self.dammif.dataOutput.logFile self.result.pdbMoleculeFile = self.dammif.dataOutput.pdbMoleculeFile self.result.pdbSolventFile = self.dammif.dataOutput.pdbSolventFile # prepare an action cluster with all supcomb plugins self.actclust_supcomb = EDActionCluster(self.cluster_size) for idx in range(self.dammif_jobs): if self.valid[idx]: for ser in range(idx): if self.valid[ser]: supcomb = self.loadPlugin(self.strPluginExecSupcomb) supcomb.dataInput = XSDataInputSupcomb( templateFile=self.dammif_plugins[idx].dataOutput. pdbMoleculeFile, superimposeFile=self.dammif_plugins[ser]. dataOutput.pdbMoleculeFile, name=self.dammif_plugins[ser].dataOutput.model.name ) self.supcomb_plugins[(idx, ser)] = supcomb self.actclust_supcomb.addAction(supcomb) self.actclust_supcomb.executeSynchronous() for key, plugin in self.supcomb_plugins.items(): if plugin.isFailure(): self.ERROR( "supcomb plugin for model pair (%i,%i) %s-%08i failed" % (key[0] + 1, key[1] + 1, plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return self.makeNSDarray("nsd.png") self.result.nsdPlot = XSDataFile( XSDataString(os.path.join(self.getWorkingDirectory(), "nsd.png"))) idx = self.ref self.actclust_supcomb = EDActionCluster(self.cluster_size) for ser in range(self.ref + 1, self.dammif_jobs): if self.valid[ser]: supcomb = self.loadPlugin(self.strPluginExecSupcomb) supcomb.dataInput = XSDataInputSupcomb( templateFile=self.dammif_plugins[ self.ref].dataOutput.pdbMoleculeFile, superimposeFile=self.dammif_plugins[ser].dataOutput. pdbMoleculeFile, name=self.dammif_plugins[ser].dataOutput.model.name) self.supcomb_plugins[(self.ref, ser)] = supcomb self.actclust_supcomb.addAction(supcomb) self.actclust_supcomb.executeSynchronous() for ser in range(self.ref + 1, self.dammif_jobs): if self.valid[ser]: plugin = self.supcomb_plugins[(self.ref, ser)] if plugin.isFailure(): self.ERROR( "supcomb plugin for model pair (%i,%i) %s-%08i failed" % (self.ref + 1, ser + 1, plugin.getName(), plugin.getId())) self.setFailure() self.retrieveMessages(plugin) if self.isFailure(): return for i in range(self.dammif_jobs): if i == self.ref or not self.valid[i]: model = self.dammif_plugins[i].dataOutput.model else: model = self.supcomb_plugins[(self.ref, i)].dataOutput.model model.chiSqrt = self.dammif_plugins[i].dataOutput.model.chiSqrt # model.chiSqrt = self.dammif_plugins[i].dataOutput.model.chiSqrt self.symlink(model.pdbFile.path.value, "model-%02i.pdb" % (i + 1)) self.result.dammifModels[i] = model # Now that all (valid) models are aligned we can combine them using damaver pdbFiles = [self.dammif_plugins[self.ref].dataOutput.pdbMoleculeFile] for idx in range(self.dammif_jobs): if self.valid[idx] and idx != self.ref: pdbFiles.append( self.supcomb_plugins[(self.ref, idx)].dataOutput.outputFilename) damaver = self.loadPlugin(self.strPluginExecDamaver) damaver.dataInput = XSDataInputDamaver(pdbInputFiles=pdbFiles, automatic=XSDataBoolean(False)) damaver.connectSUCCESS(self.doSuccessExecDamaver) damaver.connectFAILURE(self.doFailureExecDamaver) damaver.executeSynchronous() if self.isFailure(): return damfilt = self.loadPlugin(self.strPluginExecDamfilt) damfilt.dataInput = XSDataInputDamfilt( inputPdbFile=damaver.dataOutput.damaverPdbFile) damfilt.connectSUCCESS(self.doSuccessExecDamfilt) damfilt.connectFAILURE(self.doFailureExecDamfilt) damfilt.execute() ######################################################################## # TODO: This is a dead end : do it in parallel ######################################################################## if self.isFailure(): return damstart = self.loadPlugin(self.strPluginExecDamstart) damstart.dataInput = XSDataInputDamstart( inputPdbFile=damaver.dataOutput.damaverPdbFile) damstart.connectSUCCESS(self.doSuccessExecDamstart) damstart.connectFAILURE(self.doFailureExecDamstart) damstart.executeSynchronous() if self.isFailure(): return ######################################################################## # Finally call dammin ######################################################################## if self.config.get("do_dammin") in ["False", "0", False, 0]: return dammin = self.loadPlugin(self.strPluginExecDammin) dammin.dataInput = XSDataInputDammin( pdbInputFile=damstart.dataOutput.outputPdbFile, gnomOutputFile=self.xsGnomFile, symmetry=XSDataString(self.symmetry), mode=XSDataString(self.mode)) dammin.connectSUCCESS(self.doSuccessExecDammin) dammin.connectFAILURE(self.doFailureExecDammin) dammin.executeSynchronous()