def checkConflicts(self): if self.params['stackid'] is None: apDisplay.printError("stack id was not defined") if self.params['start'] is None: apDisplay.printError("a number of starting classes was not provided") if self.params['end'] is None: apDisplay.printError("a number of ending classes was not provided") if self.params['runname'] is None: apDisplay.printError("run name was not defined") self.stackdata = apStack.getOnlyStackData(self.params['stackid'], msg=False) stackfile = os.path.join(self.stackdata['path']['path'], self.stackdata['name']) # check for virtual stack self.params['virtualdata'] = None if not os.path.isfile(stackfile): vstackdata = apStack.getVirtualStackParticlesFromId(self.params['stackid']) npart = len(vstackdata['particles']) self.params['virtualdata'] = vstackdata else: npart = apFile.numImagesInStack(stackfile) if self.params['numpart'] is None: self.params['numpart'] = npart elif self.params['numpart'] > npart: apDisplay.printError("trying to use more particles "+str(self.params['numpart']) +" than available "+str(apFile.numImagesInStack(stackfile))) self.boxsize = apStack.getStackBoxsize(self.params['stackid']) self.workingboxsize = math.floor(self.boxsize/self.params['bin']) if not self.params['mask']: self.params['mask'] = (self.boxsize/2)-2 self.workingmask = math.floor(self.params['mask']/self.params['bin']) if self.params['mramethod'] == 'imagic': self.imagicroot = apIMAGIC.checkImagicExecutablePath() self.imagicversion = apIMAGIC.getImagicVersion(self.imagicroot)
def checkConflicts(self): ### check for IMAGIC installation self.imagicroot = apIMAGIC.checkImagicExecutablePath() self.imagicversion = apIMAGIC.getImagicVersion(self.imagicroot) ### check input parameters if self.params['alignid'] is None: apDisplay.printError("There is no stack ID specified") if self.params['runname'] is None: apDisplay.printError("enter a run ID") if self.params['MSAdistance'] is None: apDisplay.printError("enter distance criteria for MSA program (i.e. eulidean, chisquare, modulation)") return
def checkConflicts(self): ### check for IMAGIC installation self.imagicroot = apIMAGIC.checkImagicExecutablePath() self.imagicversion = apIMAGIC.getImagicVersion(self.imagicroot) ### check input parameters if self.params['analysisId'] is None: apDisplay.printError("There is no imagic analysis Id specified") if self.params['runname'] is None: apDisplay.printError("enter a run ID") if self.params['num_classes'] is None: apDisplay.printError("enter number of classes that you want") return
def checkConflicts(self): ### check for IMAGIC installation self.imagicroot = apIMAGIC.checkImagicExecutablePath() self.imagicversion = apIMAGIC.getImagicVersion(self.imagicroot) ### check input parameters if self.params['analysisId'] is None: apDisplay.printError("There is no imagic analysis Id specified") if self.params['runname'] is None: apDisplay.printError("enter a run ID") if self.params['num_classes'] is None: apDisplay.printError("enter number of classes that you want") return
def checkConflicts(self): ### check for IMAGIC installation self.imagicroot = apIMAGIC.checkImagicExecutablePath() ### run parameters if self.params['templateStackId'] is None: apDisplay.printError("enter template stack Id") if self.params['stackId'] is None: apDisplay.printError("enter a stack Id") ### references if self.params['refs'] is True: if self.params['thresh_refs'] is None or self.params['maskrad_refs'] is None: apDisplay.printError("enter ALL parameters for preparing references") ### Multi Reference Alignment params if self.params['mirror'] is None: apDisplay.printError("enter option of using mirrors") return
def checkConflicts(self): ### check for IMAGIC installation self.imagicroot = apIMAGIC.checkImagicExecutablePath() ### run parameters if self.params['templateStackId'] is None: apDisplay.printError("enter template stack Id") if self.params['stackId'] is None: apDisplay.printError("enter a stack Id") ### references if self.params['refs'] is True: if self.params['thresh_refs'] is None or self.params['maskrad_refs'] is None: apDisplay.printError("enter ALL parameters for preparing references") ### Multi Reference Alignment params if self.params['mirror'] is None: apDisplay.printError("enter option of using mirrors") return
def checkConflicts(self): """ basic error handlign for running scripts """ ### check for IMAGIC installation try: self.imagicroot = apIMAGIC.checkImagicExecutablePath() except: c = "some IMAGIC functions, e.g. prealignment and angular reconstitution " c+= "may not work. Use EMAN instead" apDisplay.printWarning(c) self.imagicroot = None self.params['useEMAN1'] is True ### check class averages if self.params['templatestackid'] is not None: self.stackdata = appiondata.ApTemplateStackData.direct_query(self.params['templatestackid']) self.clsname = self.stackdata['templatename'] self.params['apix'] = self.stackdata['apix'] self.params['boxsize'] = self.stackdata['boxsize'] self.params['oldavgs'] = os.path.join(self.stackdata['path']['path'], self.clsname[:-4]+".hed") self.params['avgs'] = os.path.basename(self.clsname) elif self.params['clusterid'] is not None: self.stackdata = appiondata.ApClusteringStackData.direct_query(self.params['clusterid']) self.clsname = self.stackdata['avg_imagicfile'] self.params['apix'] = self.stackdata['clusterrun']['pixelsize'] self.params['boxsize'] = self.stackdata['clusterrun']['boxsize'] self.params['oldavgs'] = os.path.join(self.stackdata['path']['path'], self.clsname[:-4]+".hed") self.params['avgs'] = self.clsname elif self.params['classavgs'] is not None: if self.params['apix'] is None: apDisplay.printError("enter pixel size for manually uploaded classes") self.params['oldavgs'] = self.params['classavgs'] bavgs = os.path.basename(self.params['classavgs']) self.params['avgs'] = bavgs else: apDisplay.printError("enter class averages for the run") if not os.path.isfile(os.path.abspath(self.params['oldavgs'])): apDisplay.printError("cannot find input class averages") if self.params['templatestackid'] is not None and self.params['clusterid'] is not None: apDisplay.printError("enter either templatestack ID OR cluster ID") if self.params['templatestackid'] is not None and self.params['classavgs'] is not None: apDisplay.printError("enter either templatestack ID OR manually uploaded classes") if self.params['clusterid'] is not None and self.params['classavgs'] is not None: apDisplay.printError("enter either cluster ID OR manually uploaded classes") ### pretreatment if self.imagicroot is not None and self.params['prealign'] is True: warning = "particles will not be prealigned, IMAGIC is not installed or path " warning+= "to IMAGIC cannot be located" apDisplay.printWarning(warning) ### basic input parameters self.params['numpart'] = apFile.numImagesInStack(self.params['oldavgs']) if self.params['numpart'] < 3: apDisplay.printError("need at least 3 class averages in stack to run") self.params['boxsize'] = apFile.getBoxSize(self.params['oldavgs'])[0] if self.params['num_volumes'] is None: apDisplay.printError("specify the number of volumes to produce") if self.params['apix'] is None: apDisplay.printError("enter pixel size of class averages") ### refinement class averages if self.params['r_templatestackid'] is not None: self.rstackdata = appiondata.ApTemplateStackData.direct_query(self.params['r_templatestackid']) self.rclsname = self.rstackdata['templatename'] self.params['refineapix'] = self.rstackdata['apix'] self.params['refineboxsize'] = self.rstackdata['boxsize'] self.params['oldravgs'] = os.path.join(self.rstackdata['path']['path'], self.rclsname[:-4]+".hed") self.params['ravgs'] = os.path.basename(self.rclsname) elif self.params['r_clusterid'] is not None: self.rstackdata = appiondata.ApClusteringStackData.direct_query(self.params['r_clusterid']) self.rclsname = self.rstackdata['avg_imagicfile'] self.params['refineapix'] = self.rstackdata['clusterrun']['pixelsize'] self.params['refineboxsize'] = self.rstackdata['clusterrun']['boxsize'] self.params['oldravgs'] = os.path.join(self.rstackdata['path']['path'], self.rclsname[:-4]+".hed") self.params['ravgs'] = self.rclsname elif self.params['refine_classavgs'] is not None: rbavgs = os.path.basename(self.params['refine_classavgs']) self.params['ravgs'] = rbavgs self.params['refineboxsize'] = apFile.getBoxSize(self.params['oldravgs'])[0] if self.params['refineapix'] is None: warning = "refinement pixel size not specified ... assuming it is the same" apDisplay.printWarning(warning) self.params['refineapix'] = self.params['apix'] else: # self.params['ravgs'] = None self.params['oldravgs'] = self.params['avgs'] self.params['ravgs'] = self.params['avgs'] self.params['refineapix'] = self.params['apix'] self.params['refineboxsize'] = self.params['boxsize'] if not os.path.isfile(os.path.abspath(self.params['oldravgs'])): warning = "cannot find class averages for refinement using the " warning+= "specified path. Original averages will be used instead." apDisplay.printWarning(warning) self.params['oldravgs'] = self.params['avgs'] self.params['ravgs'] = self.params['avgs'] ### check for scaling if self.params['scale'] is True: self.scalefactor = float(64.0 / self.params['boxsize']) self.params['apix'] = self.params['apix'] / self.scalefactor self.params['boxsize'] = 64 else: self.scalefactor = 1 ### angular reconstitution checks if self.params['keep_ordered'] < 1.0: ### probably specified as a fraction self.params['keep_ordered'] = self.params['keep_ordered'] * 100 ### convert to percentage self.params['keep_ordered_num'] = self.params['numpart'] * self.params['keep_ordered'] / 100 ### EMAN1 cross common lines checks if self.params['useEMAN1'] is True: if self.params['images_per_volume'] is None: self.params['images_per_volume'] = int(self.params['numpart'] * 0.66) if self.params['images_per_volume'] > self.params['numpart']: warning = "number of images per volume greater than number of class averages " warning+= "in input. Setting to (0.66)*(num_averages)" apDisplay.printWarning(warning) self.params['images_per_volume'] = int(self.params['numpart'] * 0.66) if self.params['images_per_volume'] > self.params['numpart'] * 0.75: warning = "consider asking for less images per volume to provide more variety " warning = "during common lines search" apDisplay.printWarning(warning) ### number of processors for threading ONLY works on a single node self.params['threadnproc'] = apParam.getNumProcessors() ### refinement parameters if self.params['linmask'] == 0: self.params['linmask'] = (self.params['boxsize']-2)/2*self.params['apix'] if self.params['mask_radius'] is None and self.params['linmask'] != 0: self.params['mask_radius'] = self.params['linmask'] * 1.2 elif self.params['mask_radius'] is None and self.params['linmask'] == 0: self.params['mask_radius'] = self.params['boxsize'] * self.params['refineapix'] if self.params['outer_radius'] is None: self.params['outer_radius'] = self.params['mask_radius'] * 0.8 return