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)

        boxSize = Integer(coordSet.getBoxSize())
        self._defineOutputs(boxsize=boxSize)
        self._defineSourceRelation(self.inputMicrographs.get(), boxSize)
 def createDiscardedStep(self):
     posDir = self._getExtraPath()
     suffixRoot = self._ProtParticlePicking__getOutputSuffix()
     suffix = '' if suffixRoot=='2' or suffixRoot=='' \
              else str(int(suffixRoot)-1)
     coordSetDisc = self._createSetOfCoordinates(self.inputMics,
                                                 suffix='Discarded'+suffix)
     readSetOfCoordinates(posDir, self.inputMics, coordSetDisc,
                          readDiscarded=True)
     if coordSetDisc.getSize()>0:
         outputName = 'outputDiscardedCoordinates' + suffix
         outputs = {outputName: coordSetDisc}
         self._defineOutputs(**outputs)
         self._defineSourceRelation(self.inputMicrographs, coordSetDisc)
    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 _updateOutputCoordSet(self, micList, streamMode):

        # Do no proceed if there is not micrograph ready
        if not micList:
            return []

        outputDir = self._getExtraPath('outputCoords')
        outputCoords = self.getOutput()

        # If there are not outputCoordinates yet, it means that is the first
        # time we are updating output coordinates, so we need to first create
        # the output set
        firstTime = outputCoords is None

        if firstTime:
            if self.micsSource == SAME_AS_PICKING or self.useOtherScale.get(
            ) == 1:
                boxSize = self.getBoxSize()
                micSetPtr = self.getInputMicrographs()
            else:
                boxSize = self.inputCoordinates.get().getBoxSize()
                micSetPtr = self.inputCoordinates.get().getMicrographs()

            outputCoords = self._createSetOfCoordinates(
                micSetPtr, suffix=self.getAutoSuffix())
            outputCoords.copyInfo(self.inputCoordinates.get())
            outputCoords.setBoxSize(boxSize)
        else:
            outputCoords.enableAppend()
        self.info("Reading coordinates from mics: %s" %
                  ','.join([mic.strId() for mic in micList]))
        readSetOfCoordinates(outputDir,
                             micList,
                             outputCoords,
                             scale=self._getScale())
        self.debug(" _updateOutputCoordSet Stream Mode: %s " % streamMode)
        self._updateOutputSet(self.getOutputName(), outputCoords, streamMode)

        if firstTime:
            self._defineSourceRelation(micSetPtr, outputCoords)

        return micList
Ejemplo n.º 5
0
def readSetOfCoordsFromPosFnames(posDir, setOfInputCoords, sqliteOutName,
                                 write=True):

    """
      posDir: path where there are .pos files with coordinates
      setOfInputCoords. Set to find micrographs
      sqliteOutName. Path where sqlite map will be created. Warning, it overwrites
      content
    """

    inputMics = setOfInputCoords.getMicrographs()
    cleanPath(sqliteOutName)
    setOfOutputCoordinates= SetOfCoordinates(filename= sqliteOutName)
    setOfOutputCoordinates.setMicrographs(inputMics)
    setOfOutputCoordinates.setBoxSize(setOfInputCoords.getBoxSize())
    readSetOfCoordinates(posDir, micSet=inputMics,
                           coordSet=setOfOutputCoordinates,
                           readDiscarded=False)
    if write:
       setOfOutputCoordinates.write()
    return setOfOutputCoordinates
    def registerCoords(self, coordsDir):
        """ This method is usually inherited by all Pickers
        and it is used from the Java picking GUI to register
        a new SetOfCoordinates when the user click on +Particles button.
        """

        inputset = self.getInputMicrographs()

        mySuffix = '_Manual_%s' % coordsDir.split('manualThresholding_')[1]
        outputName = 'outputCoordinates' + mySuffix

        outputset = self._createSetOfCoordinates(inputset, suffix=mySuffix)
        readSetOfCoordinates(coordsDir, outputset.getMicrographs(), outputset)
        # summary = self.getSummary(outputset)
        # outputset.setObjComment(summary)
        outputs = {outputName: outputset}
        self._defineOutputs(**outputs)

        # Using a pointer to define the relations is more robust to scheduling
        # and id changes between the protocol run.db and the main project
        # database. The pointer defined below points to the outputset object
        self._defineSourceRelation(self.getInputMicrographs(),
                                   Pointer(value=self, extended=outputName))
        self._store()
Ejemplo n.º 7
0
 def readCoordsFromMics(self, workingDir, micList, coordSet):
     readSetOfCoordinates(workingDir, micList, coordSet)
Ejemplo n.º 8
0
 def readSetOfCoordinates(self, workingDir, coordSet):
     readSetOfCoordinates(workingDir, self.getInputMicrographs(), coordSet)