def readCtfModel(ctfModel, filename, ctf4=False, ctfTilt=False): if ctfTilt: result = parseCtftiltOutput(filename) if result is None: setWrongDefocus(ctfModel) tiltAxis, tiltAngle, ctfFit = -999, -999, -999 else: defocusU, defocusV, defocusAngle, tiltAxis, tiltAngle, ctfFit = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) ctfModel.setFitQuality(ctfFit) ctfModel._ctftilt_tiltAxis = Float(tiltAxis) ctfModel._ctftilt_tiltAngle = Float(tiltAngle) if not ctf4: result = parseCtffindOutput(filename) if result is None: setWrongDefocus(ctfModel) else: defocusU, defocusV, defocusAngle = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) else: result = parseCtffind4Output(filename) if result is None: setWrongDefocus(ctfModel) ctfFit, ctfResolution, ctfPhaseShift = -999, -999, -999 else: defocusU, defocusV, defocusAngle, ctfPhaseShift, ctfFit, ctfResolution = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) ctfModel.setFitQuality(ctfFit) ctfModel.setResolution(ctfResolution) # Avoid creation of phaseShift ctfPhaseShiftDeg = np.rad2deg(ctfPhaseShift) if ctfPhaseShiftDeg != 0: ctfModel.setPhaseShift(ctfPhaseShiftDeg)
def _postprocessVolume(self, vol, row): self._counter += 1 vol.setObjComment('ransac volume %02d' % self._counter) vol._xmipp_volScoreSum = Float(row.getValue(emlib.MDL_VOLUME_SCORE_SUM)) vol._xmipp_volScoreSumTh = Float(row.getValue(emlib.MDL_VOLUME_SCORE_SUM_TH)) vol._xmipp_volScoreMean = Float(row.getValue(emlib.MDL_VOLUME_SCORE_MEAN)) vol._xmipp_volScoreMin = Float(row.getValue(emlib.MDL_VOLUME_SCORE_MIN))
def _setWeight(self, item, row): item._xmipp_scoreAlignabilityPrecision = Float( row.getValue(md.MDL_SCORE_BY_ALIGNABILITY_PRECISION)) item._xmipp_scoreAlignabilityAccuracy = Float( row.getValue(md.MDL_SCORE_BY_ALIGNABILITY_ACCURACY)) item._xmipp_scoreMirror = Float(row.getValue(md.MDL_SCORE_BY_MIRROR)) item._xmipp_weight = Float( float(item._xmipp_scoreAlignabilityAccuracy)*float(item._xmipp_scoreAlignabilityPrecision))
def updateItemMaxCC(self, item, row): from convert import locationToXmipp # ToDo: uncomment this lines when the output metadata has ITEM_ID # if item.getObjId() != row.getValue(xmipp.MDL_ITEM_ID): # raise Exception("The objId is not equal to ITEM_ID. Please, sort the metadata.") if isinstance(item, Class2D): img = item.getRepresentative() index, fn = img.getLocation() else: index, fn = item.getLocation() # objLoc = locationToXmipp(index, fn) # mdLoc = row.getValue(md.MDL_IMAGE) # if objLoc != mdLoc: # raise Exception("The image isn't the same. Please, sort the metadata.") if item.getObjId() != row.getValue(md.MDL_ITEM_ID): raise Exception( "The image isn't the same. Please, sort the metadata.") item._xmipp_imageRef = String(row.getValue(md.MDL_IMAGE_REF)) item._xmipp_image = String(row.getValue(md.MDL_IMAGE)) item._xmipp_imageResidual = String(row.getValue(md.MDL_IMAGE_RESIDUAL)) item._xmipp_maxCC = Float(row.getValue(md.MDL_MAXCC)) item._xmipp_cost = Float(row.getValue(md.MDL_COST)) if isinstance(item, Class2D): particle = item.getRepresentative() else: particle = item
def _initializeZscores(self): # Store the set for later access , ;-( self.minZScore = Float() self.maxZScore = Float() self.sumZScore = Float() self.varThreshold = Float() self._store()
def __init__(self, **kwargs): EMObject.__init__(self, **kwargs) self.grid = String() self.gridSquare = String() self.hole = String() self.x = Float() self.y = Float()
def _createOutputStep(self): """ Create outputs: Train: Create and save one plot of the training loss. Predict: Create two SetOfMicrograph for each class. """ if self.predictEnable: self.positiveMicrographs = self._createSetOfMicrographs() self.positiveMicrographs.setSamplingRate( self.imgSet.getSamplingRate()) for i, img in enumerate(self.imgSet): img._probability = Float(self.results[i]['Probability']) if self.results[i]['Class'] == 1: self.positiveMicrographs.append(img) self._defineOutputs(positiveMicrographs=self.positiveMicrographs) self.negativeMicrographs = self._createSetOfMicrographs() self.negativeMicrographs.setSamplingRate( self.imgSet.getSamplingRate()) for i, img in enumerate(self.imgSet): img._probability = Float(self.results[i]['Probability']) if self.results[i]['Class'] == 0: self.negativeMicrographs.append(img) self._defineOutputs(negativeMicrographs=self.negativeMicrographs) # self._defineSourceRelation(self.inputImgs, self.out) else: self.plot_loss_screening(self.loss_list, self.accuracy_list)
def _updateItem30(self, particle, row): particle.setCTF(convert.rowToCtfModel(row)) # TODO: Add other field from the .star file when other options? # check if beamtilt is available and save it if hasattr(row, 'rlnBeamTiltX'): particle._rlnBeamTiltX = Float(row.rlnBeamTiltX) particle._rlnBeamTiltY = Float(row.rlnBeamTiltY)
def _updateParticle(self, item, row): item.setClassId(row.getValue(md.MDL_REF)) item.setTransform(rowToAlignment(row, ALIGN_2D)) if self.flag_relion: item._rlnLogLikeliContribution = Float(None) item._rlnMaxValueProbDistribution = Float(None) item._rlnGroupName = String(None) item._rlnNormCorrection = Float(None)
def _updateParticle(self, item, row): vals = OrderedDict(zip(HEADER_COLUMNS, row)) item.setClassId(vals.get('FILM')) item.setTransform(rowToAlignment(vals, item.getSamplingRate())) item._cistemLogP = Float(vals.get('LogP')) item._cistemSigma = Float(vals.get('SIGMA')) item._cistemOCC = Float(vals.get('OCC')) item._cistemScore = Float(vals.get('SCORE'))
def createOutputStep(self): outputVols = self._createSetOfVolumes() for i, vol in enumerate(self._iterInputVols()): volDir = self._getVolDir(i + 1) volume = vol.clone() volPrefix = 'vol%03d_' % (i + 1) m_pruned = md.MetaData() m_pruned.read(volDir + '/pruned_particles_alignability.xmd') prunedMd = self._getExtraPath( volPrefix + 'pruned_particles_alignability.xmd') moveFile(join(volDir, 'pruned_particles_alignability.xmd'), prunedMd) m_volScore = md.MetaData() m_volScore.read(volDir + '/validationAlignability.xmd') validationMd = self._getExtraPath( volPrefix + 'validation_alignability.xmd') moveFile(join(volDir, 'validationAlignability.xmd'), validationMd) imgSet = self.inputParticles.get() outImgSet = self._createSetOfParticles(volPrefix) outImgSet.copyInfo(imgSet) outImgSet.copyItems(imgSet, updateItemCallback=self._setWeight, itemDataIterator=md.iterRows(prunedMd, sortByLabel=md.MDL_ITEM_ID)) mdValidatoin = md.getFirstRow(validationMd) weight = mdValidatoin.getValue(md.MDL_WEIGHT_PRECISION_ALIGNABILITY) volume.weightAlignabilityPrecision = Float(weight) weight = mdValidatoin.getValue(md.MDL_WEIGHT_ACCURACY_ALIGNABILITY) volume.weightAlignabilityAccuracy = Float(weight) weight = mdValidatoin.getValue(md.MDL_WEIGHT_PRECISION_MIRROR) volume.weightMirror = Float(weight) volume.cleanObjId() # clean objects id to assign new ones inside the set outputVols.append(volume) self._defineOutputs(outputParticles=outImgSet) self.createPlot2D(volPrefix, m_pruned) outputVols.setSamplingRate(volume.getSamplingRate()) self._defineOutputs(outputVolumes=outputVols) cleanPattern(self._getPath("reference_particles.*")) cleanPattern(self._getExtraPath("scaled_particles.*")) cleanPattern(self._getExtraPath("reference_particles.*")) cleanPattern(self._getExtraPath("corrected_ctf_particles.*")) cleanPattern(self._getFileName("volume")) cleanPattern(self._getExtraPath("params.txt"))
def _updateClass(self, item): classId = item.getObjId() index, fn, _, c = self._classesInfo[classId] item.setAlignment2D() rep = item.getRepresentative() rep.setLocation(index, fn) rep.setSamplingRate(self.inputClasses.get().getSamplingRate()) rep._c_x = Float(c[0]) rep._c_y = Float(c[1])
def readCtfModel(ctfModel, filename, ctf4=False): result = parseGctfOutput(filename) if result is None: setWrongDefocus(ctfModel) ctfFit, ctfResolution = -999, -999 else: defocusU, defocusV, defocusAngle, ctfFit, ctfResolution = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) ctfModel._gctf_crossCorrelation = Float(ctfFit) ctfModel._gctf_ctfResolution = Float(ctfResolution)
def _updateClass(self, item): classId = item.getObjId() if classId in self._classesDict: index, fn, row = self._classesDict[classId] if fn.endswith('.mrc'): fn += ':mrc' # Specify that are volumes to read them properly in xmipp item.getRepresentative().setLocation(index, fn) item._rlnclassDistribution = Float(row.getValue('rlnClassDistribution')) item._rlnAccuracyRotations = Float(row.getValue('rlnAccuracyRotations')) item._rlnAccuracyTranslations = Float(row.getValue('rlnAccuracyTranslations'))
def _updateClass(self, item): classId = item.getObjId() avgFile = self._getPath(self.CLASS_DIR, self._params['msa_cls_img'] + '_avg.img') rep = item.getRepresentative() rep.setSamplingRate(item.getSamplingRate()) rep.setLocation(classId, avgFile) item._intraClassVariance = Float(self.varianceDict[classId]) item._representationQuality = Float(self.quality1Dict[classId]) item._overallQuality = Float(self.quality2Dict[classId])
def _updateClass(self, item): classId = item.getObjId() if classId in self._classesInfo: index, fn, row = self._classesInfo[classId] item.setAlignment(self._alignType) if self._alignType == ALIGN_PROJ: fn += ':mrc' # mark reference as a MRC volume item.getRepresentative().setLocation(index, fn) item._rlnclassDistribution = Float(row.rlnClassDistribution) item._rlnAccuracyRotations = Float(row.rlnAccuracyRotations) item._rlnAccuracyTranslationsAngst = Float( row.rlnAccuracyTranslationsAngst)
def _relionTomoStar2Subtomograms(prot, outputSubTomogramsSet, tomoTable, invert): ih = ImageHandler() samplingRate = outputSubTomogramsSet.getSamplingRate() for row, inSubtomo in zip(tomoTable, prot.inputSubtomos.get()): subtomo = SubTomogram() coordinate3d = Coordinate3D() transform = Transform() origin = Transform() volname = row.get(TOMO_NAME, FILE_NOT_FOUND) subtomoFn = row.get(SUBTOMO_NAME, FILE_NOT_FOUND) subtomo.setVolName(managePath4Sqlite(volname)) subtomo.setTransform(transform) subtomo.setAcquisition(TomoAcquisition()) subtomo.setClassId(row.get('rlnClassNumber', 0)) subtomo.setSamplingRate(samplingRate) subtomo.setCoordinate3D(coordinate3d) # Needed to get later the tomogram pointer via getCoordinate3D() x = row.get(COORD_X, 0) y = row.get(COORD_Y, 0) z = row.get(COORD_Z, 0) tiltPrior = row.get(TILT_PRIOR, 0) psiPrior = row.get(PSI_PRIOR, 0) # ctf3d = row.get(CTF_MISSING_WEDGE, FILE_NOT_FOUND) coordinate3d = subtomo.getCoordinate3D() coordinate3d.setX(float(x), BOTTOM_LEFT_CORNER) coordinate3d.setY(float(y), BOTTOM_LEFT_CORNER) coordinate3d.setZ(float(z), BOTTOM_LEFT_CORNER) coordinate3d._3dcftMrcFile = inSubtomo.getCoordinate3D()._3dcftMrcFile # Used for the ctf3d in Relion 3.0 (tomo) M = _getTransformMatrix(row, invert) transform.setMatrix(M) subtomo.setCoordinate3D(coordinate3d) subtomo._tiltPriorAngle = Float(tiltPrior) subtomo._psiPriorAngle = Float(psiPrior) # Set the origin and the dimensions of the current subtomogram x, y, z, n = ih.getDimensions(subtomoFn) zDim, _ = manageIhDims(subtomoFn, z, n) origin.setShifts(x / -2. * samplingRate, y / -2. * samplingRate, zDim / -2. * samplingRate) subtomo.setOrigin(origin) subtomo.setFileName(managePath4Sqlite(subtomoFn)) # if subtomo is in a vesicle if 'tid_' in subtomoFn: vesicleId = subtomoFn.split('tid_')[1] vesicleId = vesicleId[0] scoor = subtomo.getCoordinate3D() scoor.setGroupId(vesicleId) subtomo.setCoordinate3D(scoor) # Add current subtomogram to the output set outputSubTomogramsSet.append(subtomo)
def _parseLogFile(self, logFile): with open(logFile) as f: line = f.readline() while line: words = line.strip().split() if len(words) > 1: if (words[0] == 'RMSD' and words[1] == 'between' and words[6] == '(start):'): self.startRMSD = Float(words[7]) elif (words[0] == 'RMSD' and words[1] == 'between' and words[6] == '(final):'): self.finalRMSD = Float(words[7]) line = f.readline()
def updateSubTomogram(subTomogram, index): particleParams = particlesParams.get(index) if not particleParams: print("Could not get params for particle %d" % index) setattr(subTomogram, "_appendItem", False) else: setattr(subTomogram, 'coverage', Float(particleParams["coverage"])) setattr(subTomogram, 'score', Float(particleParams["score"])) # Create 4x4 matrix from 4x3 e2spt_sgd align matrix and append row [0,0,0,1] am = particleParams["alignMatrix"] angles = numpy.array([am[0:3], am[4:7], am[8:11], [0, 0, 0]]) samplingRate = outputSetOfSubTomograms.getSamplingRate() shift = numpy.array([am[3] * samplingRate, am[7] * samplingRate, am[11] * samplingRate, 1]) matrix = numpy.column_stack((angles, shift.T)) subTomogram.setTransform(Transform(matrix))
def createOutputStep(self): outputVols = self._createSetOfVolumes() imgSet = self.inputParticles.get() for i, vol in enumerate(self._iterInputVols()): volume = vol.clone() volDir = self._getVolDir(i + 1) volPrefix = 'vol%03d_' % (i + 1) validationMd = self._getExtraPath(volPrefix + 'validation.xmd') moveFile(join(volDir, 'validation.xmd'), validationMd) clusterMd = self._getExtraPath(volPrefix + 'clusteringTendency.xmd') moveFile(join(volDir, 'clusteringTendency.xmd'), clusterMd) outImgSet = self._createSetOfParticles(volPrefix) outImgSet.copyInfo(imgSet) outImgSet.copyItems(imgSet, updateItemCallback=self._setWeight, itemDataIterator=md.iterRows( clusterMd, sortByLabel=md.MDL_ITEM_ID)) mdValidatoin = md.MetaData(validationMd) weight = mdValidatoin.getValue(md.MDL_WEIGHT, mdValidatoin.firstObject()) volume.weight = Float(weight) volume.clusterMd = String(clusterMd) volume.cleanObjId( ) # clean objects id to assign new ones inside the set outputVols.append(volume) self._defineOutputs(outputParticles=outImgSet) outputVols.setSamplingRate(volume.getSamplingRate()) self._defineOutputs(outputVolumes=outputVols)
def createOutputStep(self): tilt_series = self.tiltSeries.get() out_tilt_series = self.getOutputSetOfTiltSeries(tilt_series) json_paths = self._getJsonPaths() for tilt_serie in tilt_series.iterItems(): out_tilt_serie = tomoObj.TiltSeries(tsId=tilt_serie.getTsId()) out_tilt_serie.copyInfo(tilt_serie) out_tilt_series.append(out_tilt_serie) item_basename = os.path.basename(os.path.dirname(tilt_serie.getFirstItem().getFileName())) +\ '-' + tilt_serie.getTsId() + '_info' json_path = [ path for path in json_paths if item_basename == pwutils.removeBaseExt(path) ] params = loadJson(json_path[0])['tlt_params'] for idx, tiltImage in enumerate(tilt_serie.iterItems()): out_tiltImage = tomoObj.TiltImage() out_tiltImage.copyInfo(tiltImage, copyId=True) out_tiltImage.setLocation(tiltImage.getLocation()) matrix = np.eye(3) matrix[0, 0] = matrix[1, 1] = np.cos(np.deg2rad(params[idx][2])) matrix[0, 1], matrix[1, 0] = np.sin(np.deg2rad(params[idx][2])), \ -np.sin(np.deg2rad(params[idx][2])) out_tiltImage.tiltAngleAxis = Float(params[idx][4]) out_tiltImage.setTiltAngle(params[idx][3]) matrix[0, 2], matrix[1, 2] = params[idx][0], params[idx][1] transform = data.Transform() transform.setMatrix(matrix) out_tiltImage.setTransform(transform) out_tilt_serie.append(out_tiltImage) self._defineOutputs(alignedTiltSeries=out_tilt_series) self._defineSourceRelation(self.tiltSeries, out_tilt_series)
def _readValidationPklFile(self, fileName): self.SUMMARYFILENAME = self._getTmpPath(self.SUMMARYFILENAME) command = """import pickle import collections import json def pickleData(file): with open(file,"r") as f: return pickle.load(f) # process file {VALIDATIONCRYOEMPKLFILENAME}" data = pickleData('{VALIDATIONCRYOEMPKLFILENAME}') dictSummary = collections.OrderedDict() dictSummary['Rhama_Outliers'] = data.model.geometry.ramachandran.outliers dictSummary['Rhama_Favored'] = data.model.geometry.ramachandran.favored dictSummary['Rota_Outliers'] = data.model.geometry.rotamer.outliers dictSummary['Cbeta_Outliers_n'] = data.model.geometry.c_beta.cbetadev.n_outliers dictSummary['Clash_score'] = data.model.geometry.clash.score dictSummary['MolProbity_score'] = data.model.geometry.molprobity_score """.format(VALIDATIONCRYOEMPKLFILENAME=fileName) command += """with open('%s',"w") as f: f.write(json.dumps(dictSummary)) """ % (self.SUMMARYFILENAME) pythonFileName = self.SUMMARYFILENAME.replace('.txt', '.py') # write script file with open(pythonFileName, "w") as f: f.write(command) # execute file with phenix.python Plugin.runPhenixProgram("", pythonFileName) # read file in scipion python with open(self.SUMMARYFILENAME, "r") as f: dictSummary = f.read() dictSummary = json.loads(dictSummary, object_pairs_hook=collections.OrderedDict) self.ramachandranOutliers = Float(dictSummary['Rhama_Outliers']) self.ramachandranFavored = Float(dictSummary['Rhama_Favored']) self.rotamerOutliers = Float(dictSummary['Rota_Outliers']) self.cbetaOutliers = Integer(dictSummary['Cbeta_Outliers_n']) self.clashscore = Float(dictSummary['Clash_score']) self.overallScore = Float(dictSummary['MolProbity_score'])
def _updateParticle(self, item, row): item.setClassId(row.rlnClassNumber) self._reader.setParticleTransform(item, row) # Try to create extra objects only once if item is reused if not hasattr(item, '_rlnNormCorrection'): item._rlnNormCorrection = Float() item._rlnLogLikeliContribution = Float() item._rlnMaxValueProbDistribution = Float() item._rlnNormCorrection.set(row.rlnNormCorrection) item._rlnLogLikeliContribution.set(row.rlnLogLikeliContribution) item._rlnMaxValueProbDistribution.set(row.rlnMaxValueProbDistribution) if hasattr(item, '_rlnGroupName'): item._rlnGroupName.set(row.rlnGroupName) elif hasattr(row, 'rlnGroupName'): item._rlnGroupName = String(row.rlnGroupName)
def createOutputSingle(self, fnSite, fnStructureFile, score, dscore, srcObj): n = fnSite.split('@')[0] fnDir = self._getPath("grid-%s" % n) if os.path.exists(fnDir): fnBase = os.path.split(fnDir)[1] fnGrid = os.path.join(fnDir, '%s.zip' % fnBase) if os.path.exists(fnGrid): gridFile = SchrodingerGrid(filename=fnGrid) gridFile.structureFile = String(fnStructureFile) gridFile.bindingSiteScore = Float(score) gridFile.bindingSiteDScore = Float(dscore) n = fnDir.split('grid-')[1] outputDict = {'outputGrid%s' % n: gridFile} self._defineOutputs(**outputDict) self._defineSourceRelation(srcObj, gridFile)
def _parseFile(self, fileName): with open(fileName, encoding="ISO-8859-1") as f: line = f.readline() while line: words = line.strip().split() if len(words) > 1: if (words[0] == 'Ramachandran' and words[1] == 'outliers'): self.ramachandranOutliers = Float(words[3]) elif (words[0] == 'favored' and words[1] == '='): self.ramachandranFavored = Float(words[2]) elif (words[0] == 'Rotamer' and words[1] == 'outliers'): self.rotamerOutliers = Float(words[3]) elif (words[0] == 'C-beta' and words[1] == 'deviations'): self.cbetaOutliers = Integer(words[3]) elif (words[0] == 'Clashscore' and words[1] == '='): self.clashscore = Float(words[2]) elif (words[0] == 'MolProbity' and words[1] == 'score'): self.overallScore = Float(words[3]) line = f.readline()
def readCtfModel(ctfModel, filename, ctf4=False): if not ctf4: result = parseCtffindOutput(filename) if result is None: setWrongDefocus(ctfModel) else: defocusU, defocusV, defocusAngle = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) else: result = parseCtffind4Output(filename) if result is None: setWrongDefocus(ctfModel) ctfFit, ctfResolution, ctfPhaseShift = -999, -999, -999 else: defocusU, defocusV, defocusAngle, ctfPhaseShift, ctfFit, ctfResolution = result ctfModel.setStandardDefocus(defocusU, defocusV, defocusAngle) ctfModel._ctffind4_crossCorrelation = Float(ctfFit) ctfModel._ctffind4_ctfResolution = Float(ctfResolution) ctfModel._ctffind4_ctfPhaseShift = Float(ctfPhaseShift)
def appendCoordFromParticle(part): coord = part.getCoordinate() # Try micname micName = coord.getMicName() mic = micDict.get(micName, None) # Try micid if mic is None: micKey = coord.getMicId() mic = micDict.get(micKey, None) if mic is None: print("Skipping particle, %s or id %s not found" % (micName, micKey)) else: newCoord.copyObjId(part) x, y = coord.getPosition() if self.applyShifts: # Get the shifts, they are returned with the sign reverted shifts = self.getShifts(part.getTransform(), alignType) # Add the shifts (values are inverted so subtract) x -= shifts[0] y -= shifts[1] # Apply the scale x *= scale y *= scale # Round coordinates to closer integer 39.9 --> 40 and not 39 finalX = round(x) finalY = round(y) # Annotate fractions if shifts applied if self.applyShifts: newCoord.xFrac = Float(finalX - x) newCoord.yFrac = Float(finalY - y) newCoord.setPosition(finalX, finalY) newCoord.setMicrograph(mic) outputCoords.append(newCoord)
def createAnalyzeFilesStep(self): """ This method will add a column with a relative consistence table """ ctfs = self._createSetOfCTF() inputCTF1 = self.inputCTF1.get() ctfs.copyInfo(inputCTF1) ctfs.setMicrographs(inputCTF1.getMicrographs()) for ctf in inputCTF1: ctfAux = ctf.clone() ctfId = ctf.getObjId() key = ctfId resolution = self._freqResol[key] ctfAux._discrepancy_resolution = Float(resolution) ctfAux._discrepancy_astigmatism = Float(ctf.getDefocusU() - ctf.getDefocusV()) ctfs.append(ctfAux) self._defineOutputs(outputCTF=ctfs) self._defineTransformRelation(self.inputCTF1.get(), ctfs)
def _updateClass(self, item): classId = item.getObjId() if classId in self._classesInfo: index, fn, row = self._classesInfo[classId] fn += ":mrc" if (self.IS_3D): item.setAlignmentProj() else: item.setAlignment(ALIGN_2D) item.getRepresentative().setLocation(index, fn) item._rlnclassDistribution = Float( row.getValue('rlnClassDistribution')) item._rlnAccuracyRotations = Float( row.getValue('rlnAccuracyRotations')) item._rlnAccuracyTranslations = Float( row.getValue('rlnAccuracyTranslations')) item._rlnEstimatedResolution = Float( row.getValue('rlnEstimatedResolution')) #JV
def convertCTFXmippStep(self, ctfModel): #defocus comes from here inputSet = self.inputParticles.get() if self.inputCTF.hasValue(): ctf = self.inputCTF.get() mic = ctf.getMicrograph() acquisition = mic.getAcquisition() sampling = mic.getSamplingRate() else: ctf = inputSet.getFirstItem().getCTF() acquisition = inputSet.getAcquisition() sampling = inputSet.getSamplingRate() # Spherical aberration in mm ctf._xmipp_ctfVoltage = Float(acquisition.getVoltage()) ctf._xmipp_ctfSphericalAberration = Float( acquisition.getSphericalAberration()) ctf._xmipp_ctfQ0 = Float(acquisition.getAmplitudeContrast()) ctf._xmipp_ctfSamplingRate = Float(sampling) writeCTFModel(ctf, ctfModel) ##ROB writeCTFModel(ctf, '/tmp/ctf.xmd')