コード例 #1
0
ファイル: dataimport.py プロジェクト: denisfortun/scipion
    def importCTF(self, mic, fileName):
        ctf = CTFModel()
        ctf.setMicrograph(mic)
        readCtfModel(ctf, fileName, ctf4=ctffindOutputVersion(fileName) == 4)

        for suffix in ["_psd.mrc", ".mrc"]:
            if os.path.exists(pwutils.removeExt(fileName) + suffix):
                ctf.setPsdFile(pwutils.removeExt(fileName) + suffix)
        return ctf
コード例 #2
0
ファイル: dataimport.py プロジェクト: josegutab/scipion
    def importCTF(self, mic, fileName):
        defocusU, defocusV, defocusAngle = parseCtffindOutput(fileName)
        ctf = CTFModel()
        ctf.copyObjId(mic)
        ctf.setStandardDefocus(defocusU, defocusV, defocusAngle)
        ctf.setMicrograph(mic)
        ctf.setPsdFile(removeExt(fileName) + "_psd.mrc")
        return ctf


    

                
コード例 #3
0
ファイル: dataimport.py プロジェクト: azazellochg/scipion
    def importCTF(self, mic, fileName):
        ctf = CTFModel()
        ctf.setMicrograph(mic)
        readCtfModel(ctf, fileName, ctf4=ctffindOutputVersion(fileName) == 4)

        # Try to find the given PSD file associated with the cttfind log file
        # we handle special cases of .ctf extension and _ctffindX prefix for Relion runs
        fnBase = pwutils.removeExt(fileName)
        for suffix in ["_psd.mrc", ".mrc", ".ctf"]:
            psdPrefixes = [fnBase, fnBase.replace("_ctffind3", ""), fnBase.replace("_ctffind4", "")]
            for prefix in psdPrefixes:
                psdFile = prefix + suffix
                if os.path.exists(psdFile):
                    if psdFile.endswith(".ctf"):
                        psdFile += ":mrc"
                    ctf.setPsdFile(psdFile)
        return ctf
コード例 #4
0
ファイル: dataimport.py プロジェクト: I2PC/scipion
 def importCTF(self, mic, fileName):
     ctf = CTFModel()
     ctf.setMicrograph(mic)
     readCtfModel(ctf, fileName, ctf4=False)
     
     # Try to find the given PSD file associated with the cttfind log file
     # we handle special cases of .ctf extension and _ctffindX prefix for Relion runs
     fnBase = pwutils.removeExt(fileName)
     for suffix in ['_psd.mrc', '.mrc', '.ctf']:
         psdPrefixes = [fnBase, 
                        fnBase.replace('_ctffind3', ''),
                        fnBase.replace('_gctf', '')]
         for prefix in psdPrefixes:
             psdFile =  prefix + suffix
             if os.path.exists(psdFile):
                 if psdFile.endswith('.ctf'):
                     psdFile += ':mrc'
                 ctf.setPsdFile(psdFile)
     return ctf
コード例 #5
0
ファイル: dataimport.py プロジェクト: yaizar/scipion-docker
    def importCTF(self, mic, fileName):
        ctf = CTFModel()
        ctf.setMicrograph(mic)
        readCtfModel(ctf, fileName, ctf4=False)

        # Try to find the given PSD file associated with the cttfind log file
        # we handle special cases of .ctf extension and _ctffindX prefix for Relion runs
        fnBase = pwutils.removeExt(fileName)
        for suffix in ['_psd.mrc', '.mrc', '.ctf']:
            psdPrefixes = [
                fnBase,
                fnBase.replace('_ctffind3', ''),
                fnBase.replace('_gctf', '')
            ]
            for prefix in psdPrefixes:
                psdFile = prefix + suffix
                if os.path.exists(psdFile):
                    if psdFile.endswith('.ctf'):
                        psdFile += ':mrc'
                    ctf.setPsdFile(psdFile)
        return ctf
コード例 #6
0
    def importCtfStep(self, micsId, pattern):
        """ Copy movies matching the filename pattern
        Register other parameters.
        """
        inputMics = self.inputMicrographs.get()
        ctfSet = self._createSetOfCTF()
        ctfSet.setMicrographs(inputMics)

        ctfFiles = self._getFilePaths(pattern)
        ctfDict = {}
        for fn in ctfFiles:
            # Try to match the micrograph id from filename
            # this is set by the user by using #### format in the pattern
            match = self._idRegex.match(fn)
            if match is None:
                raise Exception("File '%s' doesn't match the pattern '%s'" %
                                (fn, self.pattern.get()))
            ctfId = int(match.group(1))
            ctfDict[ctfId] = fn

        from pyworkflow.em.packages.grigoriefflab.convert import parseCtffindOutput

        for mic in inputMics:
            if mic.getObjId() in ctfDict:
                defocusU, defocusV, defocusAngle = parseCtffindOutput(
                    ctfDict[mic.getObjId()])
            else:
                self.warning("CTF for micrograph id %d was not found." %
                             mic.getObjId())
                defocusU, defocusV, defocusAngle = -999, -1, -999

            # save the values of defocus for each micrograph in a list
            ctf = CTFModel()
            ctf.copyObjId(mic)
            ctf.setStandardDefocus(defocusU, defocusV, defocusAngle)
            ctf.setMicrograph(mic)
            ctfSet.append(ctf)

        self._defineOutputs(outputCTF=ctfSet)
        self._defineCtfRelation(inputMics, ctfSet)
コード例 #7
0
ファイル: protocol_import.py プロジェクト: coocoky/scipion
    def importCtfStep(self, micsId, pattern):
        """ Copy movies matching the filename pattern
        Register other parameters.
        """
        inputMics = self.inputMicrographs.get()
        ctfSet = self._createSetOfCTF()
        ctfSet.setMicrographs(inputMics)
        
        ctfFiles = self._getFilePaths(pattern)
        ctfDict = {}
        for fn in ctfFiles:
            # Try to match the micrograph id from filename
            # this is set by the user by using #### format in the pattern
            match = self._idRegex.match(fn)
            if match is None:
                raise Exception("File '%s' doesn't match the pattern '%s'" % (fn, self.pattern.get()))
            ctfId = int(match.group(1))
            ctfDict[ctfId] = fn
            
        from pyworkflow.em.packages.grigoriefflab.convert import parseCtffindOutput

        for mic in inputMics:
            if mic.getObjId() in ctfDict:
                defocusU, defocusV, defocusAngle = parseCtffindOutput(ctfDict[mic.getObjId()])
            else:
                self.warning("CTF for micrograph id %d was not found." % mic.getObjId())
                defocusU, defocusV, defocusAngle = -999, -1, -999
            
            # save the values of defocus for each micrograph in a list
            ctf = CTFModel()
            ctf.copyObjId(mic)
            ctf.setStandardDefocus(defocusU, defocusV, defocusAngle)
            ctf.setMicrograph(mic)
            ctfSet.append(ctf)
        
        self._defineOutputs(outputCTF=ctfSet)
        self._defineCtfRelation(inputMics, ctfSet)            
コード例 #8
0
 def importCTF(self, mic, fileName):
     ctf = CTFModel()
     ctf.setMicrograph(mic)
     readCTFModel(ctf, fileName)
     return ctf