Beispiel #1
0
    def createOutputStep(self):
        micSet = self.getInputMicrographs()
        outputCoordinatesName = 'outputCoordinates'
        outputSuffix = ''

        # If in optimization phase, let's create a subset of the micrographs
        if self.isRunOptimize():
            outputSuffix = '_subset'
            outputCoordinatesName = 'outputCoordinatesSubset'
            micSubSet = self._createSetOfMicrographs(suffix=outputSuffix)
            micSubSet.copyInfo(micSet)
            # Use previously written star file for reading the subset of micrographs,
            for row in md.iterRows(self._getPath('input_micrographs.star')):
                mic = micSet[row.getValue('rlnImageId')]
                micSubSet.append(mic)
            self._defineOutputs(outputMicrographsSubset=micSubSet)
            self._defineTransformRelation(self.getInputMicrographsPointer(),
                                          micSubSet)
            micSet = micSubSet

        coordSet = self._createSetOfCoordinates(micSet)
        template = self._getExtraPath("%s_autopick.star")
        starFiles = [template % pwutils.removeBaseExt(mic.getFileName())
                     for mic in micSet]
        readSetOfCoordinates(coordSet, starFiles, micSet)

        self._defineOutputs(**{outputCoordinatesName: coordSet})
        self._defineSourceRelation(self.getInputMicrographsPointer(),
                                   coordSet)
Beispiel #2
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     """ Parse back the output star files and populate the SetOfCoordinates.
     """
     template = self._getExtraPath("%s_autopick.star")
     starFiles = [template % pwutils.removeBaseExt(mic.getFileName())
                  for mic in micList]
     readSetOfCoordinates(coordSet, starFiles, micList)
    def createOutputStep(self):
        micSet = self.getInputMicrographs()
        outputCoordinatesName = 'outputCoordinates'
        outputSuffix = ''

        # If in optimization phase, let's create a subset of the micrographs
        if self.isRunOptimize():
            outputSuffix = '_subset'
            outputCoordinatesName = 'outputCoordinatesSubset'
            micSubSet = self._createSetOfMicrographs(suffix=outputSuffix)
            micSubSet.copyInfo(micSet)
            # Use previously written star file for reading the subset of micrographs,
            for row in md.iterRows(self._getPath('input_micrographs.star')):
                mic = micSet[row.getValue('rlnImageId')]
                micSubSet.append(mic)
            self._defineOutputs(outputMicrographsSubset=micSubSet)
            self._defineTransformRelation(self.getInputMicrographsPointer(),
                                          micSubSet)
            micSet = micSubSet

        coordSet = self._createSetOfCoordinates(micSet)
        template = self._getExtraPath("%s_autopick.star")
        starFiles = [
            template % pwutils.removeBaseExt(mic.getFileName())
            for mic in micSet
        ]
        readSetOfCoordinates(coordSet, starFiles, micSet)

        self._defineOutputs(**{outputCoordinatesName: coordSet})
        self._defineSourceRelation(self.getInputMicrographsPointer(), coordSet)
Beispiel #4
0
 def readRejectedCoordsFromMics(self, micList):
     micSet = self.getInputMicrographs()
     
     rejectedCoordSqlite = self._getPath('coordinates_rejected.sqlite')
     
     if not os.path.exists(rejectedCoordSqlite):
         coordSetAux = self._createSetOfCoordinates(micSet, suffix='_rejected')
     else:
         coordSetAux = em.SetOfCoordinates(filename=rejectedCoordSqlite)
         coordSetAux.enableAppend()
        
     coordSetAux.setBoxSize(self._getBoxSize())
     readSetOfCoordinates(self.getMicrographsDir(), micList,
                          coordSetAux, suffix='_rejected.star')
     coordSetAux.write()
     coordSetAux.close()
 
     # debug output
     if self.writeCC:
         self.createDebugOutput(suffix='_ccmax')
 
     if self.writeFilt:
         self.createDebugOutput(suffix='_pref')
 
     if self.writeBg:
         self.createDebugOutput(suffix='_bg')
 
     if self.writeBgSub:
         self.createDebugOutput(suffix='_bgfree')
 
     if self.writeSigma:
         self.createDebugOutput(suffix='_lsigma')
 
     if self.writeMsk:
         self.createDebugOutput(suffix='_mask')
    def createOutputStep(self):
        micSet = self.getInputMicrographs()
        ih = em.ImageHandler()
        coordSet = self._createSetOfCoordinates(micSet)
        if self.boxSize and self.boxSize > 0:
            coordSet.setBoxSize(self.boxSize.get())
        else:
            coordSet.setBoxSize(self.inputReferences.get().getXDim or 100)

        readSetOfCoordinates(self.getMicrographsDir(), micSet, coordSet)
        coordSetAux = self._createSetOfCoordinates(micSet, suffix='_rejected')
        coordSetAux.setBoxSize(coordSet.getBoxSize())
        readSetOfCoordinates(self.getMicrographsDir(),
                             micSet,
                             coordSetAux,
                             suffix='_rejected.star')
        coordSetAux.write()

        # debug output
        if self.writeCC:
            self.createDebugOutput(suffix='_ccmax')
        if self.writeFilt:
            self.createDebugOutput(suffix='_pref')
        if self.writeBg:
            self.createDebugOutput(suffix='_bg')
        if self.writeBgSub:
            self.createDebugOutput(suffix='_bgfree')
        if self.writeSigma:
            self.createDebugOutput(suffix='_lsigma')
        if self.writeMsk:
            self.createDebugOutput(suffix='_mask')

        self._defineOutputs(outputCoordinates=coordSet)
        self._defineSourceRelation(micSet, coordSet)
Beispiel #6
0
    def createOutputStep(self):
        micSet = self.getInputMicrographs()

        # If in optimization phase, let's create a subset of the micrographs
        if self.isRunOptimize():
            micSubSet = self._createSetOfMicrographs()
            micSubSet.copyInfo(micSet)
            for mic in self.getMicrographList():
                micSubSet.append(mic)
            self._defineOutputs(outputMicrographs=micSubSet)
            self._defineTransformRelation(self.getInputMicrographsPointer(),
                                          micSubSet)
            micSet = micSubSet
        else:
            # Clean up if previously created the outputMicrographs
            if self.hasAttribute('outputMicrographs'):
                self._deleteChild('outputMicrographs', self.outputMicrographs)

        coordSet = self._createSetOfCoordinates(micSet)
        template = self._getExtraPath("%s_autopick.star")
        starFiles = [
            template % pwutils.removeBaseExt(mic.getFileName())
            for mic in micSet
        ]
        readSetOfCoordinates(coordSet, starFiles, micSet)

        self._defineOutputs(outputCoordinates=coordSet)
        self._defineSourceRelation(self.getInputMicrographsPointer(), coordSet)
Beispiel #7
0
    def createOutputStep(self):
        micSet = self.getInputMicrographs()
        coordSet = self._createSetOfCoordinates(micSet)
        coordSet.setBoxSize(self.getInputReferences().getDim()[0])
        starFiles = [self._getExtraPath(pwutils.removeBaseExt(mic.getFileName()) + "_autopick.star") for mic in micSet]
        readSetOfCoordinates(coordSet, starFiles)

        self._defineOutputs(outputCoordinates=coordSet)
Beispiel #8
0
    def readCoordsFromMics(self, workingDir, micDoneList,
                           outputCoords):
        if self.boxSize and self.boxSize > 0:
            outputCoords.setBoxSize(self.boxSize.get())
        else:
            outputCoords.setBoxSize(
                self.inputReferences.get().getDim()[0])

        readSetOfCoordinates(workingDir, micDoneList, outputCoords)
    def createOutputStep(self):
        
        extradir = self._getExtraPath()
        inputset = self.tiltpair.get()
        uSet = inputset.getUntilted()
        tSet = inputset.getTilted()
        
        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix='Untilted')
        if self.typeOfSet.get() == TYPE_PARTICLES:
#             boxsize_u = self.untiltPar.get().getCoordinates().getBoxSize()
#             if boxsize_u is None:
                aux = self.untiltPar.get()
                aux2 = aux[1]
                boxsize_u, y_, z_ = aux2.getDim()
        else:
            boxsize_u = self.untiltCoor.get().getBoxSize()
        
        uCoordSet.setBoxSize(boxsize_u)    
        tCoordSet = self._createSetOfCoordinates(tSet, suffix='Tilted')
        readSetOfCoordinates(extradir, uSet, uCoordSet)
        uCoordSet.write()
        
        if self.typeOfSet.get() == TYPE_PARTICLES:
#             boxsize_t = self.tiltPar.get().getCoordinates().getBoxSize()
#             if boxsize_t is None:
                aux = self.tiltPar.get()
                aux2 = aux[1]
                boxsize_t, y_, z_ = aux2.getDim()
        else:
            boxsize_t = self.tiltCoor.get().getBoxSize()
        
        tCoordSet.setBoxSize(boxsize_t)
        readSetOfCoordinates(extradir, tSet, tCoordSet)
        tCoordSet.write()
        

        setAngles = self._createSetOfAngles()
        pathangles = self.micsFn + '/input_micrographs.xmd'
        readAnglesFromMicrographs(pathangles, setAngles)
        
        setAngles.write()
        # Create CoordinatesTiltPair object
        outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs.sqlite'))
        outputset.setTilted(tCoordSet)
        outputset.setUntilted(uCoordSet)
        outputset.setAngles(setAngles)
        outputset.setMicsPair(inputset)
        outputset.setObjComment(self.getSummary(outputset))
#         print '-----------------------------'
#         print setAngles
#         print '-----------------------------'
        for coordU, coordT in izip(uCoordSet, tCoordSet):
            outputset.append(TiltPair(coordU, coordT))

        self._defineOutputs(outputCoordinatesTiltPair=outputset)
        self._defineSourceRelation(self.tiltpair, outputset)
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     """ Parse back the output star files and populate the SetOfCoordinates.
     """
     template = self._getExtraPath("%s_autopick.star")
     starFiles = [
         template % pwutils.removeBaseExt(mic.getFileName())
         for mic in micList
     ]
     readSetOfCoordinates(coordSet, starFiles, micList)
Beispiel #11
0
 def createOutputStep(self):
     micSet = self.getInputMicrographs()
     coordSet = self._createSetOfCoordinates(micSet)
     coordSet.setBoxSize(self.getInputReferences().getDim()[0])
     starFiles = [self._getExtraPath(pwutils.removeBaseExt(mic.getFileName()) + '_autopick.star')
                  for mic in micSet]
     readSetOfCoordinates(coordSet, starFiles)
     
     self._defineOutputs(outputCoordinates=coordSet)
     self._defineSourceRelation(self.getInputMicrographsPointer(), coordSet)
Beispiel #12
0
 def writeXmippCoords(self):
     """ Write the SetOfCoordinates as expected by Xmipp
     to be display with its GUI. 
     """
     micSet = self.getInputMicrographs()
     coordSet = self._createSetOfCoordinates(micSet)
     coordSet.setBoxSize(self.getInputReferences().getDim()[0])
     starFiles = [self._getExtraPath(pwutils.removeBaseExt(mic.getFileName()) + "_autopick.star") for mic in micSet]
     readSetOfCoordinates(coordSet, starFiles)
     return self._writeXmippCoords(coordSet)
Beispiel #13
0
 def writeXmippCoords(self):
     """ Write the SetOfCoordinates as expected by Xmipp
     to be display with its GUI. 
     """
     micSet = self.getInputMicrographs()
     coordSet = self._createSetOfCoordinates(micSet)
     coordSet.setBoxSize(self.getInputReferences().getDim()[0])
     starFiles = [self._getExtraPath(pwutils.removeBaseExt(mic.getFileName()) + '_autopick.star')
                  for mic in micSet]
     readSetOfCoordinates(coordSet, starFiles)
     return self._writeXmippCoords(coordSet)
    def _readCoordinates(self, coordsDir, suffix=''):
        micTiltPairs = self.inputMicrographsTiltedPair.get()
        uSuffix = 'Untilted' + suffix
        tSuffix = 'Tilted' + suffix
        uSet = micTiltPairs.getUntilted()
        tSet = micTiltPairs.getTilted()
        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix=uSuffix)
        convert.readSetOfCoordinates(coordsDir, uSet, uCoordSet)
        uCoordSet.write()
        tCoordSet = self._createSetOfCoordinates(tSet, suffix=tSuffix)
        convert.readSetOfCoordinates(coordsDir, tSet, tCoordSet)
        tCoordSet.write()
        boxSize = self._getBoxSize()
        if boxSize:
            uCoordSet.setBoxSize(boxSize)
            tCoordSet.setBoxSize(boxSize)

        return uCoordSet, tCoordSet
    def _readCoordinates(self, coordsDir, suffix=''):
        micTiltPairs = self.inputMicrographsTiltedPair.get()
        uSuffix = 'Untilted' + suffix
        tSuffix = 'Tilted' + suffix
        uSet = micTiltPairs.getUntilted()
        tSet = micTiltPairs.getTilted()
        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix=uSuffix)
        convert.readSetOfCoordinates(coordsDir, uSet, uCoordSet)
        uCoordSet.write()
        tCoordSet = self._createSetOfCoordinates(tSet, suffix=tSuffix)
        convert.readSetOfCoordinates(coordsDir, tSet, tCoordSet)
        tCoordSet.write()
        boxSize = self._getBoxSize()
        if boxSize:
            uCoordSet.setBoxSize(boxSize)
            tCoordSet.setBoxSize(boxSize)

        return uCoordSet, tCoordSet
Beispiel #16
0
    def readRejectedCoordsFromMics(self, micList):
        micSet = self.getInputMicrographs()

        rejectedCoordSqlite = self._getPath('coordinates_rejected.sqlite')

        if not os.path.exists(rejectedCoordSqlite):
            coordSetAux = self._createSetOfCoordinates(micSet,
                                                       suffix='_rejected')
        else:
            coordSetAux = em.SetOfCoordinates(filename=rejectedCoordSqlite)
            coordSetAux.enableAppend()

        coordSetAux.setBoxSize(self._getBoxSize())
        readSetOfCoordinates(self.getMicrographsDir(),
                             micList,
                             coordSetAux,
                             suffix='_rejected.star')
        coordSetAux.write()
        coordSetAux.close()

        # debug output
        if self.writeCC:
            self.createDebugOutput(suffix='_ccmax')

        if self.writeFilt:
            self.createDebugOutput(suffix='_pref')

        if self.writeBg:
            self.createDebugOutput(suffix='_bg')

        if self.writeBgSub:
            self.createDebugOutput(suffix='_bgfree')

        if self.writeSigma:
            self.createDebugOutput(suffix='_lsigma')

        if self.writeMsk:
            self.createDebugOutput(suffix='_mask')
 def createOutputStep(self):
     posDir = self._getExtraPath()
     coordSet = self._createSetOfCoordinates(self.inputMics)
     readSetOfCoordinates(posDir, self.inputMics, coordSet)
     self._defineOutputs(outputCoordinates=coordSet)
     self._defineSourceRelation(self.inputMicrographs, coordSet)
 def createOutputStep(self):
     posDir = self._getExtraPath()
     coordSet = self._createSetOfCoordinates(self.inputMics)
     readSetOfCoordinates(posDir, self.inputMics, coordSet)
     self._defineOutputs(outputCoordinates=coordSet)
     self._defineSourceRelation(self.inputMicrographs, coordSet)
Beispiel #19
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     coordSet.setBoxSize(self.boxSize.get())
     readSetOfCoordinates(workingDir, micList, coordSet)
Beispiel #20
0
 def readSetOfCoordinates(self, workingDir, coordSet):
     readSetOfCoordinates(workingDir, self.inputMicrographs.get(), coordSet)
Beispiel #21
0
 def readSetOfCoordinates(self, workingDir, coordSet):
     readSetOfCoordinates(workingDir, self.inputMics, coordSet)
Beispiel #22
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     if coordSet.getBoxSize() is None:
         coordSet.setBoxSize(self._getBoxSize())
     
     readSetOfCoordinates(self.getMicrographsDir(), micList, coordSet)
     self.readRejectedCoordsFromMics(micList)
Beispiel #23
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     readSetOfCoordinates(workingDir, micList, coordSet)
 def readSetOfCoordinates(self, workingDir, coordSet):
     readSetOfCoordinates(workingDir, self.inputMics, coordSet)
Beispiel #25
0
    def readCoordsFromMics(self, workingDir, micList, coordSet):
        if coordSet.getBoxSize() is None:
            coordSet.setBoxSize(self._getBoxSize())

        readSetOfCoordinates(self.getMicrographsDir(), micList, coordSet)
        self.readRejectedCoordsFromMics(micList)
Beispiel #26
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     coordSet.setBoxSize(self.diameter.get())
     readSetOfCoordinates(workingDir, micList, coordSet)
 def readSetOfCoordinates(self, workingDir, coordSet):
     readSetOfCoordinates(workingDir, self.inputMicrographs.get(), coordSet)