def insertCL2DParamsIntoDatabase(self):
		### setup cl2d run
		cl2dq = appiondata.ApXMIPP3CL2DRunData()
		cl2dq['runname'] = self.runparams['runname']
		cl2dq['run_seconds'] = self.runparams['runtime']
		cl2dq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		cl2dq['timestamp'] = self.params['timestamp']
		cl2dq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		cl2dq['finished'] = True
		cl2dq['max-iter'] = self.params['maxiter']
		cl2dq['num-ref'] = self.params['numrefs']
		if self.params['correlation'] is True:
			cl2dq['correlation'] = True
			cl2dq['correntropy'] = False
		else:
			cl2dq['correlation'] = False
			cl2dq['correntropy'] = True
		if self.params['classical'] is True:
			cl2dq['classical_multiref'] = True
			cl2dq['intracluster_multiref'] = False
		else:
			cl2dq['classical_multiref'] = False
			cl2dq['intracluster_multiref'] = True
	
		### insert if commit is true
		if self.params['commit'] is True:
			cl2dq.insert()	
		self.cl2dqdata=cl2dq
    def insertSIMPLEAlignParamsIntoDatabase(self):
        ### setup simple run
        simpleq = appiondata.ApSIMPLEClusterRunData()
        simpleq['runname'] = self.runparams['runname']
        simpleq['run_seconds'] = self.runparams['runtime']
        simpleq[
            'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(
                self.params['stackid'])
        simpleq['timestamp'] = self.params['timestamp']
        simpleq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.params['rundir']))
        simpleq['finished'] = True
        simpleq['num-ref'] = self.params['ncls']
        if self.params['no_kmeans'] is False:
            simpleq['kmeans'] = True
        else:
            simpleq['kmeans'] = False
        if self.params['no_center'] is False:
            simpleq['center'] = True
        else:
            simpleq['center'] = False

        ### insert if commit is true
        if self.params['commit'] is True:
            simpleq.insert()
        self.simpleqdata = simpleq
	def insertCL2DParamsIntoDatabase(self):
		### setup cl2d run
		cl2dq = appiondata.ApCL2DRunData()
		cl2dq['runname'] = self.runparams['runname']
		cl2dq['run_seconds'] = self.runparams['runtime']
		cl2dq['fast'] = self.runparams['fast']
		cl2dq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		cl2dq['timestamp'] = self.params['timestamp']
		cl2dq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		cl2dq['finished'] = True
		cl2dq['max-iter'] = self.params['maxiter']
		cl2dq['num-ref'] = self.params['numrefs']
		if self.params['correlation'] is True:
			cl2dq['correlation'] = True
			cl2dq['correntropy'] = False
		else:
			cl2dq['correlation'] = False
			cl2dq['correntropy'] = True
		if self.params['classical'] is True:
			cl2dq['classical_multiref'] = True
			cl2dq['intracluster_multiref'] = False
		else:
			cl2dq['classical_multiref'] = False
			cl2dq['intracluster_multiref'] = True
	
		### insert if commit is true
		if self.params['commit'] is True:
			cl2dq.insert()	
		self.cl2dqdata=cl2dq
Esempio n. 4
0
 def insertMaxLikeJob(self):
     maxjobq = appiondata.ApMaxLikeJobData()
     maxjobq['runname'] = self.params['runname']
     maxjobq['path'] = appiondata.ApPathData(
         path=os.path.abspath(self.params['rundir']))
     maxjobdatas = maxjobq.query(results=1)
     if maxjobdatas:
         alignrunq = appiondata.ApAlignRunData()
         alignrunq['runname'] = self.params['runname']
         alignrunq['path'] = appiondata.ApPathData(
             path=os.path.abspath(self.params['rundir']))
         alignrundata = alignrunq.query(results=1)
         if maxjobdatas[0]['finished'] is True or alignrundata:
             apDisplay.printError(
                 "This run name already exists as finished in the database, please change the runname"
             )
     maxjobq[
         'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(
             self.params['stackid'])
     maxjobq['timestamp'] = self.timestamp
     maxjobq['finished'] = False
     maxjobq['hidden'] = False
     if self.params['commit'] is True:
         maxjobq.insert()
     self.params['maxlikejobid'] = maxjobq.dbid
     print "self.params['maxlikejobid']", self.params['maxlikejobid']
     return
Esempio n. 5
0
    def insertRefinementRunData(self, iteration, reference_number=1):
        ''' fills in database entry object for ApRefineRunData table '''

        ### fill in ApMultiModelRefineRunData object, if valid
        if self.multiModelRefinementRun is True:
            multimodelq = appiondata.ApMultiModelRefineRunData()
            multimodelq['runname'] = self.params['runname']
            multimodelq[
                'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(
                    self.runparams['stackid'])
            multimodelq['session'] = apStack.getSessionDataFromStackId(
                self.runparams['stackid'])
            multimodelq['num_refinements'] = self.runparams[
                'NumberOfReferences']
            self.multimodelq = multimodelq

        ### fill in ApRefineRunData object
        runq = appiondata.ApRefineRunData()
        runq['runname'] = self.params['runname']
        runq['stack'] = self.stackdata
        runq['reference_number'] = reference_number
        earlyresult = runq.query(results=1)  # check unique run
        if earlyresult:
            apDisplay.printWarning(
                "Run already exists in the database.\nIdentical data will not be reinserted"
            )
        paramdescription = self.params['description']
        if not paramdescription:
            paramdescription = None
        runq['job'] = self.params['jobinfo']
        if len(self.modeldata) > 1:
            runq['initialModel'] = self.modeldata[reference_number - 1]
        else:
            runq['initialModel'] = self.modeldata[0]
        runq['package'] = self.package
        runq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.resultspath))
        runq['description'] = paramdescription
        runq['num_iter'] = self.runparams['numiter']
        if self.multiModelRefinementRun is True:
            runq['multiModelRefineRun'] = self.multimodelq

        result = runq.query(results=1)

        # save run entry in the parameters
        if result:
            self.refinerunq = result[0]
        elif self.params['commit'] is True:
            apDisplay.printMsg(
                "Refinement Run was not found, setting to inserted values")
            self.refinerunq = runq
        else:
            apDisplay.printWarning(
                "Refinement Run was not found, setting to 'None'")
            self.refinerunq = None

        return
	def getCL2DJob(self):
		cl2djobq = appiondata.ApCL2DRunData()
		cl2djobq['runname'] = self.runparams['runname']
		cl2djobq['path'] = appiondata.ApPathData(path=os.path.abspath(self.runparams['rundir']))
		cl2djobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.runparams['stackid'])
		cl2djobq['timestamp'] = self.params['timestamp']
		cl2djobdata = cl2djobq.query(results=1)
		if not cl2djobdata:
			return None
		return cl2djobdata[0]
	def getCL2DJob(self):
		cl2djobq = appiondata.ApCL2DRunData()
		cl2djobq['runname'] = self.runparams['runname']
		cl2djobq['path'] = appiondata.ApPathData(path=os.path.abspath(self.runparams['rundir']))
		cl2djobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.runparams['stackid'])
		cl2djobq['timestamp'] = self.params['timestamp']
		cl2djobdata = cl2djobq.query(results=1)
		if not cl2djobdata:
			return None
		return cl2djobdata[0]
Esempio n. 8
0
	def getMaxLikeJob(self, runparams):
		maxjobq = appiondata.ApMaxLikeJobData()
		maxjobq['runname'] = runparams['runname']
		maxjobq['path'] = appiondata.ApPathData(path=os.path.abspath(runparams['rundir']))
		maxjobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(runparams['stackid'])
		maxjobq['timestamp'] = self.params['timestamp']
		maxjobdata = maxjobq.query(results=1)
		if not maxjobdata:
			return None
		return maxjobdata[0]
Esempio n. 9
0
 def getHipRunData(self):
     HipRun = appiondata.ApHipRunData()
     HipRun["runname"] = self.params["runname"]
     HipRun["path"] = appiondata.ApPathData(path=os.path.abspath(self.params["rundir"]))
     HipRun["description"] = self.params["description"]
     HipRun["REF|projectdata|projects|project"] = apProject.getProjectIdFromStackId(self.params["stackid"])
     sessiondata = apDatabase.getSessionDataFromSessionName(self.params["sessionname"])
     HipRun["session"] = sessiondata
     HipRun["apix"] = self.params["step"]
     self.stackdata = apStack.getOnlyStackData(self.params["stackid"], msg=False)
     HipRun["stack"] = self.stackdata
     return HipRun
Esempio n. 10
0
 def getHipRunData(self):
         HipRun = appiondata.ApHipRunData()
         HipRun['runname'] = self.params['runname']
         HipRun['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
         HipRun['description'] = self.params['description']
         HipRun['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
         sessiondata = apDatabase.getSessionDataFromSessionName(self.params['sessionname'])
         HipRun['session'] = sessiondata
         HipRun['apix'] = self.params['step']
         self.stackdata = apStack.getOnlyStackData(self.params['stackid'], msg=False)
         HipRun['stack'] = self.stackdata
         return HipRun
    def insertRefinementRunData(self, iteration, reference_number=1):
        """ fills in database entry object for ApRefineRunData table """

        ### fill in ApMultiModelRefineRunData object, if valid
        if self.multiModelRefinementRun is True:
            multimodelq = appiondata.ApMultiModelRefineRunData()
            multimodelq["runname"] = self.params["runname"]
            multimodelq["REF|projectdata|projects|project"] = apProject.getProjectIdFromStackId(
                self.runparams["stackid"]
            )
            multimodelq["session"] = apStack.getSessionDataFromStackId(self.runparams["stackid"])
            multimodelq["num_refinements"] = self.runparams["NumberOfReferences"]
            self.multimodelq = multimodelq

        ### fill in ApRefineRunData object
        runq = appiondata.ApRefineRunData()
        runq["runname"] = self.params["runname"]
        runq["stack"] = self.stackdata
        runq["reference_number"] = reference_number
        earlyresult = runq.query(results=1)  # check unique run
        if earlyresult:
            apDisplay.printWarning("Run already exists in the database.\nIdentical data will not be reinserted")
        paramdescription = self.params["description"]
        if not paramdescription:
            paramdescription = None
        runq["job"] = self.params["jobinfo"]
        if len(self.modeldata) > 1:
            runq["initialModel"] = self.modeldata[reference_number - 1]
        else:
            runq["initialModel"] = self.modeldata[0]
        runq["package"] = self.package
        runq["path"] = appiondata.ApPathData(path=os.path.abspath(self.resultspath))
        runq["description"] = paramdescription
        runq["num_iter"] = self.runparams["numiter"]
        if self.multiModelRefinementRun is True:
            runq["multiModelRefineRun"] = self.multimodelq

        result = runq.query(results=1)

        # save run entry in the parameters
        if result:
            self.refinerunq = result[0]
        elif self.params["commit"] is True:
            apDisplay.printMsg("Refinement Run was not found, setting to inserted values")
            self.refinerunq = runq
        else:
            apDisplay.printWarning("Refinement Run was not found, setting to 'None'")
            self.refinerunq = None

        return
Esempio n. 12
0
 def insertHipRunData(self):
     HipRun = appiondata.ApHipRunData()
     HipRun["runname"] = self.params["runname"]
     HipRun["path"] = appiondata.ApPathData(path=os.path.abspath(self.params["rundir"]))
     HipRun["description"] = self.params["description"]
     HipRun["REF|projectdata|projects|project"] = apProject.getProjectIdFromStackId(self.params["stackid"])
     sessiondata = apDatabase.getSessionDataFromSessionName(self.params["sessionname"])
     HipRun["session"] = sessiondata
     HipRun["apix"] = self.params["step"]
     self.stackdata = apStack.getOnlyStackData(self.params["stackid"], msg=False)
     HipRun["stack"] = self.stackdata
     if self.params["commit"] is True:
         HipRun.insert()
     else:
         print HipRun
     self.params["HipRunID"] = HipRun.dbid
     print "self.params['HipRunID']", self.params["HipRunID"]
     self.params["HipRun"] = HipRun
     return HipRun
Esempio n. 13
0
 def insertHipRunData(self):
         HipRun = appiondata.ApHipRunData()
         HipRun['runname'] = self.params['runname']
         HipRun['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
         HipRun['description'] = self.params['description']
         HipRun['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
         sessiondata = apDatabase.getSessionDataFromSessionName(self.params['sessionname'])
         HipRun['session'] = sessiondata
         HipRun['apix'] = self.params['step']
         self.stackdata = apStack.getOnlyStackData(self.params['stackid'], msg=False)
         HipRun['stack'] = self.stackdata
         if self.params['commit'] is True:
                 HipRun.insert()
         else:
                 print HipRun
         self.params['HipRunID'] = HipRun.dbid
         print "self.params['HipRunID']",self.params['HipRunID']
         self.params['HipRun'] = HipRun
         return HipRun
Esempio n. 14
0
	def insertTopolRepJob(self):
		topoljobq = appiondata.ApTopolRepJobData()
		topoljobq['runname'] = self.params['runname']
		topoljobq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		topoljobdatas = topoljobq.query(results=1)
		if topoljobdatas:
			alignrunq = appiondata.ApAlignRunData()
			alignrunq['runname'] = self.params['runname']
			alignrunq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
			alignrundata = alignrunq.query(results=1)
			if topoljobdatas[0]['finished'] is True or alignrundata:
				apDisplay.printError("This run name already exists as finished in the database, please change the runname")
		topoljobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		topoljobq['timestamp'] = self.timestamp
		topoljobq['finished'] = False
		topoljobq['hidden'] = False
		if self.params['commit'] is True:
			topoljobq.insert()
		self.params['topoljob'] = topoljobq
		return
	def insertMaxLikeJob(self):
		maxjobq = appiondata.ApMaxLikeJobData()
		maxjobq['runname'] = self.params['runname']
		maxjobq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		maxjobdatas = maxjobq.query(results=1)
		if maxjobdatas:
			alignrunq = appiondata.ApAlignRunData()
			alignrunq['runname'] = self.params['runname']
			alignrunq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
			alignrundata = alignrunq.query(results=1)
			if maxjobdatas[0]['finished'] is True or alignrundata:
				apDisplay.printError("This run name already exists as finished in the database, please change the runname")
		maxjobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		maxjobq['timestamp'] = self.timestamp
		maxjobq['finished'] = False
		maxjobq['hidden'] = False
		if self.params['commit'] is True:
			maxjobq.insert()
		self.params['maxlikejobid'] = maxjobq.dbid
		print "self.params['maxlikejobid']",self.params['maxlikejobid']
		return
    def insertSIMPLEOrigamiParamsIntoDatabase(self):
        ### setup simple run
        simpleq = appiondata.ApSIMPLEOrigamiRunData()
        simpleq['runname'] = self.runparams['runname']
        simpleq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.params['rundir']))
        #               ### check unique run
        #               uniquerun = simpleq.query(results=1)
        #               if uniquerun:
        #                       apDisplay.printError("runname already exists in the database")

        paramsq = appiondata.ApSIMPLEOrigamiParamsData()
        paramsq['lp'] = self.params['lp']
        paramsq['hp'] = self.params['hp']
        paramsq['froms'] = self.params['froms']
        paramsq['tos'] = self.params['tos']
        paramsq['maxits'] = self.params['maxits']
        paramsq['msk'] = self.params['mask']
        paramsq['mw'] = self.params['mw']
        paramsq['amsklp'] = self.params['amsklp']
        paramsq['edge'] = self.params['edge']
        paramsq['trs'] = self.params['trs']
        paramsq['pgrp'] = self.params['pgrp']

        simpleq['description'] = self.params['description']
        simpleq['box'] = self.boxsize
        simpleq['apix'] = self.apix
        simpleq['simple_params'] = paramsq
        simpleq[
            'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(
                self.params['stackid'])
        simpleq['timestamp'] = self.params['timestamp']
        simpleq['stack'] = apStack.getOnlyStackData(self.runparams['stackid'])
        simpleq['alignstack'] = self.alignstackdata
        simpleq['clusteringstack'] = self.clusterstackq

        if self.params['commit'] is True:
            simpleq.insert()

        return
    def insertSIMPLEAlignParamsIntoDatabase(self):
        ### setup simple run
        simpleq = appiondata.ApSIMPLEClusterRunData()
        simpleq["runname"] = self.runparams["runname"]
        simpleq["run_seconds"] = self.runparams["runtime"]
        simpleq["REF|projectdata|projects|project"] = apProject.getProjectIdFromStackId(self.params["stackid"])
        simpleq["timestamp"] = self.params["timestamp"]
        simpleq["path"] = appiondata.ApPathData(path=os.path.abspath(self.params["rundir"]))
        simpleq["finished"] = True
        simpleq["num-ref"] = self.params["ncls"]
        if self.params["no_kmeans"] is False:
            simpleq["kmeans"] = True
        else:
            simpleq["kmeans"] = False
        if self.params["no_center"] is False:
            simpleq["center"] = True
        else:
            simpleq["center"] = False

        ### insert if commit is true
        if self.params["commit"] is True:
            simpleq.insert()
        self.simpleqdata = simpleq
	def insertSIMPLEAlignParamsIntoDatabase(self):
		### setup simple run
		simpleq = appiondata.ApSIMPLEClusterRunData()
		simpleq['runname'] = self.runparams['runname']
		simpleq['run_seconds'] = self.runparams['runtime']
		simpleq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		simpleq['timestamp'] = self.params['timestamp']
		simpleq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		simpleq['finished'] = True
		simpleq['num-ref'] = self.params['ncls']
		if self.params['no_kmeans'] is False:
			simpleq['kmeans'] = True
		else:
			simpleq['kmeans'] = False
		if self.params['no_center'] is False:
			simpleq['center'] = True
		else:
			simpleq['center'] = False
	
		### insert if commit is true
		if self.params['commit'] is True:
			simpleq.insert()	
		self.simpleqdata=simpleq
    def insertSIMPLEOrigamiParamsIntoDatabase(self):
        ### setup simple run
        simpleq = appiondata.ApSIMPLEOrigamiRunData()
        simpleq["runname"] = self.runparams["runname"]
        simpleq["path"] = appiondata.ApPathData(path=os.path.abspath(self.params["rundir"]))
        #               ### check unique run
        #               uniquerun = simpleq.query(results=1)
        #               if uniquerun:
        #                       apDisplay.printError("runname already exists in the database")

        paramsq = appiondata.ApSIMPLEOrigamiParamsData()
        paramsq["lp"] = self.params["lp"]
        paramsq["hp"] = self.params["hp"]
        paramsq["froms"] = self.params["froms"]
        paramsq["tos"] = self.params["tos"]
        paramsq["maxits"] = self.params["maxits"]
        paramsq["msk"] = self.params["mask"]
        paramsq["mw"] = self.params["mw"]
        paramsq["amsklp"] = self.params["amsklp"]
        paramsq["edge"] = self.params["edge"]
        paramsq["trs"] = self.params["trs"]
        paramsq["pgrp"] = self.params["pgrp"]

        simpleq["description"] = self.params["description"]
        simpleq["box"] = self.boxsize
        simpleq["apix"] = self.apix
        simpleq["simple_params"] = paramsq
        simpleq["REF|projectdata|projects|project"] = apProject.getProjectIdFromStackId(self.params["stackid"])
        simpleq["timestamp"] = self.params["timestamp"]
        simpleq["stack"] = apStack.getOnlyStackData(self.runparams["stackid"])
        simpleq["alignstack"] = self.alignstackdata
        simpleq["clusteringstack"] = self.clusterstackq

        if self.params["commit"] is True:
            simpleq.insert()

        return
	def insertSIMPLEOrigamiParamsIntoDatabase(self):
		### setup simple run	
		simpleq = appiondata.ApSIMPLEOrigamiRunData()
		simpleq['runname'] = self.runparams['runname']
		simpleq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
#		### check unique run
#		uniquerun = simpleq.query(results=1)
#		if uniquerun:
#			apDisplay.printError("runname already exists in the database")

		paramsq = appiondata.ApSIMPLEOrigamiParamsData()
		paramsq['lp'] = self.params['lp']
		paramsq['hp'] = self.params['hp']
		paramsq['froms'] = self.params['froms']
		paramsq['tos'] = self.params['tos']
		paramsq['maxits'] = self.params['maxits']
		paramsq['msk'] = self.params['mask']
		paramsq['mw'] = self.params['mw']
		paramsq['amsklp'] = self.params['amsklp']
		paramsq['edge'] = self.params['edge']
		paramsq['trs'] = self.params['trs']
		paramsq['pgrp'] = self.params['pgrp']

		simpleq['description'] = self.params['description']
		simpleq['box'] = self.boxsize
		simpleq['apix'] = self.apix
		simpleq['simple_params'] = paramsq
		simpleq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.params['stackid'])
		simpleq['timestamp'] = self.params['timestamp']
		simpleq['stack'] = apStack.getOnlyStackData(self.runparams['stackid'])
		simpleq['alignstack'] = self.alignstackdata
		simpleq['clusteringstack'] = self.clusterstackq

		if self.params['commit'] is True:
			simpleq.insert()
	
		return