def createOutputStep(self):
        # PARTICLES
        cleanPattern(self._getPath("*.sqlite"))
        partSet = self._createSetOfParticles()
        readSetOfParticles(self._getPath("particles.xmd"), partSet)
        inputSampling = self.inputCoordinates[0].get().getMicrographs(
        ).getSamplingRate()
        partSet.setSamplingRate(self._getDownFactor() * inputSampling)
        boxSize = self._getBoxSize()

        # COORDINATES
        writeSet = False
        if self.checkIfPrevRunIsCompatible("coords_"):
            writeSet = True
        if not "OR" in self.coordinatesDict:
            self.loadCoords(self._getExtraPath(
                self.CONSENSUS_COOR_PATH_TEMPLATE % 'TRUE'),
                            'OR',
                            writeSet=False)

        coordSet = SetOfCoordinates(
            filename=self._getPath("coordinates.sqlite"))
        coordSet.copyInfo(self.coordinatesDict['OR'])
        coordSet.setBoxSize(boxSize)
        coordSet.setMicrographs(self.coordinatesDict['OR'].getMicrographs())

        downFactor = self._getDownFactor()
        for part in partSet:
            coord = part.getCoordinate().clone()
            coord.scale(downFactor)

            deepZscoreLabel = '_xmipp_%s' % xmipp.label2Str(
                MD.MDL_ZSCORE_DEEPLEARNING1)
            setattr(coord, deepZscoreLabel, getattr(part, deepZscoreLabel))
            coordSet.append(coord)

        coordSet.write()
        partSet.write()

        self._defineOutputs(outputCoordinates=coordSet)
        self._defineOutputs(outputParticles=partSet)

        for inSetOfCoords in self.inputCoordinates:
            self._defineSourceRelation(inSetOfCoords.get(), coordSet)
            self._defineSourceRelation(inSetOfCoords.get(), partSet)
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