def doSuccess_RefmacRigidBody(self, _edPlugin=None):
        EDVerbose.DEBUG(
            "EDPluginControlDIMPLERefmacRigidBodyPhaserv10.doSuccess_RefmacRigidBody"
        )
        self.retrieveSuccessMessages(
            _edPlugin,
            "EDPluginControlDIMPLERefmacRigidBodyPhaserv10.doSuccess_RefmacRigidBody"
        )

        dimple_FinalRFree = self._refmacrigidbody_plugin.getDataOutput(
        ).getFinalRFree().getValue()

        if dimple_FinalRFree > 0.45:
            phaser_input = CCP4DataInputPhaser(HKLIN=HKL(self._hklin),
                                               XYZIN=XYZ(self._xyzin),
                                               HKLOUT=HKL(self._hklout),
                                               XYZOUT=XYZ(self._xyzout),
                                               ColLabels=self._ColLabels)

            self._phaser_plugin.setDataInput(phaser_input)

            self._phaser_plugin.connectSUCCESS(self.doSuccess_Phaser)
            self._phaser_plugin.connectFAILURE(self.doFailure_Phaser)

            self._phaser_plugin.executeSynchronous()

        return
Пример #2
0
    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
Пример #4
0
    def _success_pdbdump(self, _edPlugin=None):
        EDVerbose.DEBUG('*** CopySpaceGroupPDBtoMTZv10._success_pdbdump')
        self.retrieveSuccessMessages(
            _edPlugin, 'CopySpaceGroupPDBtoMTZv10._success_pdbdump')

        # self._reindex_plugin.set_space_group_name(
        # self._pdbdump_plugin.get_space_group_name())

        reindex_input = CCP4DataInputREINDEX(
            HKLIN=HKL(self._hklin),
            HKLOUT=HKL(self._hklout),
            spaceGroup=self._pdbdump_plugin.getDataOutput().getSpaceGroup(),
            reindexingOperation=CCP4ReindexingOperation('h,k,l'))

        self._reindex_plugin.setDataInput(reindex_input)

        return
    def postProcess(self, _edObject = None):
        EDPluginControl.postProcess(self)
        EDVerbose.DEBUG('*** PipelineCalcDiffMapv10.postProcess')

        results = self._restrained_plugin.getDataOutput()

        xsDataResult = CCP4DataResultControlPipelineCalcDiffMap(
            HKLOUT = HKL(self._hklout),
            XYZOUT = XYZ(self._xyzout),
            initialR = results.getInitialR(),
            initialRFree = results.getInitialRFree(),
            finalR = results.getFinalR(),
            finalRFree = results.getFinalRFree(),
            returnStatus = CCP4ReturnStatus())

        self.setDataOutput(xsDataResult)            

        # and also produce a summary file? - first pull out the residuals

        refmac_out = self._restrained_plugin.readProcessLogFile().split('\n')

        residuals = { }
        collect_residuals = False

        for record in refmac_out:
            if '$TABLE: Rfactor analysis, stats vs cycle' in record:
                collect_residuals = True
                continue

            if not collect_residuals:
                continue

            if record.strip()[0] in '0123456789':
                tokens = record.split()
                cycle = int(tokens[0])
                r_rfree_fom = map(float, tokens[1:4])

                residuals[cycle] = r_rfree_fom

            if 'Final results' in record:
                collect_residuals = False

        # now need to write this someplace...

        summary = open(os.path.join(self.getWorkingDirectory(),
                                    'summary.log'), 'w')

        for c in sorted(residuals):
            summary.write('%2d %.4f %.4f %.3f\n' % (c, residuals[c][0],
                                                    residuals[c][1],
                                                    residuals[c][2]))

        summary.close()
        
        # Create a Coot script launcher
        self.createCootLauncher()
        
        return
Пример #6
0
    def postProcess(self, _edObject=None):
        EDPluginControl.postProcess(self)
        EDVerbose.DEBUG('*** CopySpaceGroupPDBtoMTZv10.postProcess')

        xsDataResult = CCP4DataResultControlCopySpaceGroupPDBtoMTZ(
            HKLOUT=HKL(self._hklout), returnStatus=CCP4ReturnStatus())
        self.setDataOutput(xsDataResult)

        return
    def postProcess(self, _edObject=None):
        EDPluginControl.postProcess(self)
        EDVerbose.DEBUG('*** PrepareMTZFileForRefinementv10.postProcess')

        postProcessColLabels = self._truncate_plugin.getDataOutput(
        ).getColLabels()

        xsDataResult = CCP4DataResultControlPrepareMTZFileForRefinement(
            HKLOUT=HKL(self._hklout),
            ColLabels=postProcessColLabels,
            returnStatus=CCP4ReturnStatus())
        self.setDataOutput(xsDataResult)
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecDIMPLEPointlessOriginv10.postProcess")

        xsDataResult = CCP4DataResultPointlessOrigin(
            HKLOUT=HKL(self._hklout), 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()

        return
Пример #9
0
    def postProcess(self, _edObject = None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG('*** EDPluginExecDIMPLECADv10.postProcess')

        self.programTermination()

        xsDataResult = CCP4DataResultCAD(
            HKLOUT = HKL(self._hklout),
            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() 
        
        
        return
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        EDVerbose.DEBUG(
            "EDPluginControlDIMPLERefmacRigidBodyPhaserv10.process")

        self._refmacrigidbody_plugin.setDataInput(
            CCP4DataInputREFMACRigidBody(XYZIN=XYZ(self._xyzin),
                                         HKLIN=HKL(self._hklin),
                                         XYZOUT=XYZ(self._xyzout),
                                         ColLabels=self._ColLabels))

        self._refmacrigidbody_plugin.connectSUCCESS(
            self.doSuccess_RefmacRigidBody)
        self._refmacrigidbody_plugin.connectFAILURE(
            self.doFailure_RefmacRigidBody)

        self._refmacrigidbody_plugin.executeSynchronous()
Пример #11
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("*** EDPluginExecDIMPLEUNIQUEv10.postProcess")

        self.programTermination()

        # call something to parse out the results

        xsDataResult = CCP4DataResultUNIQUE(HKLOUT=HKL(self._hklout),
                                            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()

        return
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        EDVerbose.DEBUG('*** PrepareMTZFileForRefinementv10.process')

        # ok, first query xyzin to get the space group for input to unique

        self._pdbdump_plugin.setDataInput(
            CCP4DataInputPDBDUMP(XYZIN=XYZ(self._xyzin)))

        self._pdbdump_plugin.connectSUCCESS(self._generic_success)
        self._pdbdump_plugin.connectFAILURE(self._generic_failure)

        self._pdbdump_plugin.executeSynchronous()

        dimple_spacegroup = self._pdbdump_plugin.getDataOutput().getSpaceGroup(
        )
        dimple_sequence = self._pdbdump_plugin.getDataOutput().getSequence()

        # then query the mtz object for the cell constants &c.

        self._mtzdump_plugin.setDataInput(
            CCP4DataInputMTZDUMP(HKLIN=HKL(self._hklin)))

        self._mtzdump_plugin.connectSUCCESS(self._generic_success)
        self._mtzdump_plugin.connectFAILURE(self._generic_failure)

        self._mtzdump_plugin.executeSynchronous()

        mtzdump_results = self._mtzdump_plugin.getDataOutput()

        dimple_unitcell = mtzdump_results.getUnitCell()

        dimple_dmin = mtzdump_results.getUpperResolutionLimit()

        # then run unique with this

        hklout = os.path.join(self.getWorkingDirectory(), 'unique.mtz')

        self._unique_plugin.setDataInput(
            CCP4DataInputUNIQUE(HKLOUT=HKL(hklout),
                                spaceGroup=dimple_spacegroup,
                                unitCell=dimple_unitcell,
                                resolutionLimit=dimple_dmin))

        self._unique_plugin.connectSUCCESS(self._generic_success)
        self._unique_plugin.connectFAILURE(self._generic_failure)

        self._unique_plugin.executeSynchronous()

        # and then freerflag on this one

        hklin = hklout
        hklout = os.path.join(self.getWorkingDirectory(), 'free.mtz')

        self._freerflag_plugin.setDataInput(
            CCP4DataInputFREERFLAG(HKLIN=HKL(hklin), HKLOUT=HKL(hklout)))

        self._freerflag_plugin.connectSUCCESS(self._generic_success)
        self._freerflag_plugin.connectFAILURE(self._generic_failure)

        self._freerflag_plugin.executeSynchronous()

        # then start processing the input reflection file - first copy
        # the spacegroup across, then run truncate, then cad together the
        # twain

        hklout = os.path.join(self.getWorkingDirectory(), 'spacegroup.mtz')

        self._copy_spacegroup_plugin.setDataInput(
            CCP4DataInputControlCopySpaceGroupPDBtoMTZ(HKLIN=HKL(self._hklin),
                                                       XYZIN=HKL(self._xyzin),
                                                       HKLOUT=HKL(hklout)))

        self._copy_spacegroup_plugin.connectSUCCESS(self._generic_success)
        self._copy_spacegroup_plugin.connectFAILURE(self._generic_failure)

        self._copy_spacegroup_plugin.executeSynchronous()

        # only run truncate if structure factors where not given in the input

        hklin = hklout
        hklout = os.path.join(self.getWorkingDirectory(), 'truncate.mtz')

        self._truncate_plugin.setDataInput(
            CCP4DataInputTRUNCATE(HKLIN=HKL(hklin),
                                  HKLOUT=HKL(hklout),
                                  sequence=dimple_sequence,
                                  ColLabels=self._ColLabels))

        self._truncate_plugin.connectSUCCESS(self._generic_success)
        self._truncate_plugin.connectFAILURE(self._generic_failure)

        self._truncate_plugin.executeSynchronous()

        # cad together free.mtz and truncate.mtz

        hklin1 = os.path.join(self.getWorkingDirectory(), 'truncate.mtz')

        hklin2 = os.path.join(self.getWorkingDirectory(), 'free.mtz')

        self._cad_plugin.setDataInput(
            CCP4DataInputCAD(
                HKLIN=[HKL(hklin1), HKL(hklin2)],
                columnLabels=[XSDataListOfStrings(),
                              XSDataListOfStrings()],
                HKLOUT=HKL(self._hklout)))

        self._cad_plugin.connectSUCCESS(self._generic_success)
        self._cad_plugin.connectFAILURE(self._generic_failure)

        self._cad_plugin.executeSynchronous()

        # we should be all good by here - clean up perhaps?

        return
    def process(self, _edObject = None):
        EDPluginControl.process(self)
        EDVerbose.DEBUG('*** PipelineCalcDiffMapv10.process')

        
        #----------------------------------------------------------------------------
        # Verify that the input file self._hklin is actually an mtz file    
        self._check_for_Validity_of_HKL.setDataInput(CCP4DataInputCheckValidHKL(HKLIN=HKL(self._hklin)))
        self._check_for_Validity_of_HKL.connectSUCCESS(self._generic_success)
        self._check_for_Validity_of_HKL.connectFAILURE(self._generic_failure)
        self._check_for_Validity_of_HKL.executeSynchronous()
        returnStatusHKL = self._check_for_Validity_of_HKL.getDataOutput()
        if returnStatusHKL.getReturnStatus().getCode().getValue() == 0:
            raise RuntimeError, returnStatusHKL.getReturnStatus().getMessage().getValue()
            return        
        #----------------------------------------------------------------------------


        #----------------------------------------------------------------------------
        # Verify that the input file self._xyzin is actually a pdb file    
        self._check_for_Validity_of_XYZ.setDataInput(CCP4DataInputCheckValidXYZ(XYZIN=XYZ(self._xyzin)))
        self._check_for_Validity_of_XYZ.connectSUCCESS(self._generic_success)
        self._check_for_Validity_of_XYZ.connectFAILURE(self._generic_failure)
        self._check_for_Validity_of_XYZ.executeSynchronous()
        returnStatusXYZ = self._check_for_Validity_of_XYZ.getDataOutput()
        if returnStatusXYZ.getReturnStatus().getCode().getValue() == 0:
            raise RuntimeError, returnStatusXYZ.getReturnStatus().getMessage().getValue()
            return
        #----------------------------------------------------------------------------
        

        #----------------------------------------------------------------------------
        # Pointless Origin Check

        hklout = os.path.join(self.getWorkingDirectory(),
                              'pointlessOriginCheck.mtz')   

        self._pointless_origin_check.setDataInput(
            CCP4DataInputPointlessOrigin(
            HKLIN=HKL(self._hklin),
            XYZIN=XYZ(self._xyzin),
            HKLOUT=HKL(hklout)))

        self._pointless_origin_check.connectSUCCESS(self._generic_success)
        self._pointless_origin_check.connectFAILURE(self._generic_failure)

        self._pointless_origin_check.executeSynchronous()

        #----------------------------------------------------------------------------


        # first prepare the input reflection file


        hklin = hklout
        hklout = os.path.join(self.getWorkingDirectory(),
                              'prepared.mtz')     
        
        
        self._prepare_mtz_plugin.setDataInput(
            CCP4DataInputControlPrepareMTZFileForRefinement(
                XYZIN = XYZ(self._xyzin),
                HKLIN = HKL(hklin),
                HKLOUT = HKL(hklout),
                ColLabels = self._ColLabels))            

        self._prepare_mtz_plugin.connectSUCCESS(self._generic_success)
        self._prepare_mtz_plugin.connectFAILURE(self._generic_failure)

        self._prepare_mtz_plugin.executeSynchronous()


        # then prepare the input pdb file

        xyzout = os.path.join(self.getWorkingDirectory(),
                              'prepared.pdb')        

        self._prepare_pdb_plugin.setDataInput(
            CCP4DataInputControlCopyUnitCellMTZtoPDB(
            XYZIN = XYZ(self._xyzin),
            HKLIN = HKL(self._hklin),
            XYZOUT = XYZ(xyzout)))

        self._prepare_pdb_plugin.connectSUCCESS(self._generic_success)
        self._prepare_pdb_plugin.connectFAILURE(self._generic_failure)

        self._prepare_pdb_plugin.executeSynchronous()


        # then run the rigid body refinement

        xyzin = xyzout
        hklin = hklout
        
        xyzout = os.path.join(self.getWorkingDirectory(),
                              'rigidbody.pdb')        

        self._rigigbody_phaser_plugin.setDataInput(
            CCP4DataInputControlRefmacRigidBodyPhaser(
            XYZIN = XYZ(xyzin),
            HKLIN = HKL(hklin),
            XYZOUT = XYZ(xyzout),
            ColLabels = self._prepare_mtz_plugin.getDataInput().getColLabels()))
            
            
        self._rigigbody_phaser_plugin.connectSUCCESS(self._generic_success)
        self._rigigbody_phaser_plugin.connectFAILURE(self._generic_failure)

        self._rigigbody_phaser_plugin.executeSynchronous()

        # and finally run the restrained refinement

        xyzin = xyzout

        self._restrained_plugin.setDataInput(
            CCP4DataInputREFMACRestrainedRefinement(
            XYZIN = XYZ(xyzin),
            HKLIN = HKL(hklin),
            XYZOUT = XYZ(self._xyzout),
            HKLOUT = HKL(self._hklout),            
            ColLabels = self._prepare_mtz_plugin.getDataInput().getColLabels()))
            
        self._restrained_plugin.connectSUCCESS(self._generic_success)
        self._restrained_plugin.connectFAILURE(self._generic_failure)

        self._restrained_plugin.executeSynchronous()

        return