def createContextShowj(request, inputParams, dataset, table, paramStats, volPath=None, labelsToRender=None): showjForm = ShowjForm(dataset, inputParams[sj.COLS_CONFIG], labelsToRender, inputParams) # A form bound for the POST data and unbound for the GET if showjForm.is_valid() is False: print showjForm.errors context = createContext(dataset, table, inputParams[sj.COLS_CONFIG], request, showjForm, inputParams) if inputParams[sj.MODE]==sj.MODE_VOL_CHIMERA or inputParams[sj.MODE]==sj.MODE_VOL_JSMOL: context.update(create_context_volume(request, inputParams, volPath, paramStats)) elif inputParams[sj.MODE]==sj.MODE_GALLERY or inputParams[sj.MODE]==sj.MODE_TABLE : context.update({"showj_alt_js": getResourceJs('showj_' + inputParams[sj.MODE] + '_utils')}) elif inputParams[sj.MODE]=='column': context.update({"showj_alt_js": getResourceJs('showj_' + sj.MODE_TABLE + '_utils')}) # IMPROVE TO KEEP THE ITEMS (SELECTED, ENABLED, CHANGES) context.update({sj.SELECTEDITEMS : inputParams[sj.SELECTEDITEMS], sj.ENABLEDITEMS: inputParams[sj.ENABLEDITEMS], sj.CHANGES: inputParams[sj.CHANGES], }) return_page = 'showj/%s%s%s' % ('showj_', showjForm.data[sj.MODE], '.html') return context, return_page
def createContextShowj(request, inputParams, dataset, table, paramStats, volPath=None, labelsToRender=None): showjForm = ShowjForm(dataset, inputParams[sj.COLS_CONFIG], labelsToRender, inputParams) # A form bound for the POST data and unbound for the GET if showjForm.is_valid() is False: print showjForm.errors context = createContext(dataset, table, inputParams[sj.COLS_CONFIG], request, showjForm, inputParams) if inputParams[sj.MODE] == sj.MODE_VOL_NGL: context.update(create_context_volume(request, inputParams, volPath, paramStats)) elif inputParams[sj.MODE] == sj.MODE_GALLERY or inputParams[sj.MODE] == sj.MODE_TABLE: context.update({"showj_alt_js": getResourceJs('showj_' + inputParams[sj.MODE] + '_utils')}) elif inputParams[sj.MODE] == 'column': context.update({"showj_alt_js": getResourceJs('showj_' + sj.MODE_TABLE + '_utils')}) # IMPROVE TO KEEP THE ITEMS (SELECTED, ENABLED, CHANGES) context.update({sj.SELECTEDITEMS: inputParams[sj.SELECTEDITEMS], sj.ENABLEDITEMS: inputParams[sj.ENABLEDITEMS], sj.CHANGES: inputParams[sj.CHANGES], }) return_page = 'showj/%s%s%s' % ('showj_', showjForm.data[sj.MODE], '.html') return context, return_page
def _run(self, protocol, request): if not protocol.useSplitVolume: emptyInput = protocol.inputVolume.pointsNone() else: emptyInput = (protocol.volumeHalf1.pointsNone() or protocol.volumeHalf2.pointsNone()) if emptyInput: return HttpResponse("Error: select the input volume(s) first.") else: plotUrl, min_ang = getPlotResMap(request, protocol) ang = protocol.prewhitenAng.get() if ang < min_ang: ang = min_ang context = { # Params 'ang': round(ang, 2), 'ramp': protocol.prewhitenRamp.get(), # Extra Params 'pValue': protocol.pVal.get(), 'minRes': protocol.minRes.get(), 'maxRes': protocol.maxRes.get(), 'stepRes': protocol.stepRes.get(), # Others 'plot': plotUrl, 'min_ang': round(min_ang, 2), 'messi_js': getResourceJs('messi'), 'messi_css': getResourceCss('messi'), } if protocol.useSplitVolume: context.update({ 'useSplit': 1, 'inputId': protocol.volumeHalf1.getUniqueId(), 'splitId': protocol.volumeHalf2.getUniqueId() }) else: context.update({'inputId': protocol.inputVolume.getUniqueId()}) if protocol.applyMask: if protocol.maskVolume.pointsNone(): return HttpResponse("Error: select the input mask first.") context.update({ 'useMask': 1, 'maskId': protocol.maskVolume.getUniqueId() }) context = base_wiz(request, context) return render_to_response('wizards/wiz_resmap.html', context)
def service_movies(request): if 'projectName' in request.session: request.session['projectName'] = "" if 'projectPath' in request.session: request.session['projectPath'] = "" movies_utils = join(django_settings.STATIC_URL, "js/", "movies_utils.js") context = {'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'movies_utils': movies_utils, } context = base_grid(request, context) return render_to_response('movies_projects.html', context)
def service_movies(request): if 'projectName' in request.session: request.session['projectName'] = "" if 'projectPath' in request.session: request.session['projectPath'] = "" movies_utils = join(django_settings.STATIC_URL, "js/", "movies_utils.js") context = { 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'movies_utils': movies_utils, } context = base_grid(request, context) return render_to_response('movies_projects.html', context)
def resmap_projects(request): if 'projectName' in request.session: request.session['projectName'] = "" if 'projectPath' in request.session: request.session['projectPath'] = "" myresmap_utils = join(django_settings.STATIC_URL, "js/", "myresmap_utils.js") context = {'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'myresmap_utils': myresmap_utils, 'hiddenTreeProt': True, } context = base_grid(request, context) return render_to_response('resmap_projects.html', context)
def create_context_chimera(volPath, threshold=None): # Control the threshold value if threshold == None: threshold = 0.1 else: threshold = round(threshold, 3) chimeraHtml = chimera_headless(volPath, threshold) context = {"chimeraHtml": chimeraHtml, "volPath": volPath, "threshold": threshold, "jquery_ui_css": getResourceCss("jquery_ui"), "philogl": getResourceJs("philogl"), } return context
def service_movies(request): if CTX_PROJECT_NAME in request.session: request.session[CTX_PROJECT_NAME] = "" if CTX_PROJECT_PATH in request.session: request.session[CTX_PROJECT_PATH] = "" movies_utils = getResource("js/movies_utils.js") context = { 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'movies_utils': movies_utils, } context = base_grid(request, context) return render_to_response('movies_projects.html', context)
def service_projects(request): if CTX_PROJECT_NAME in request.session: request.session[CTX_PROJECT_NAME] = "" if CTX_PROJECT_PATH in request.session: request.session[CTX_PROJECT_PATH] = "" myfirstmap_utils = getResource("js/myfirstmap_utils.js") context = {'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'myfirstmap_utils': myfirstmap_utils, 'hiddenTreeProt': True, SERVICE_NAME: MYFIRSTMAP_SERVICE } context = base_grid(request, context) return render_to_response('service_projects.html', context)
def particleValidation_projects(request): if CTX_PROJECT_NAME in request.session: request.session[CTX_PROJECT_NAME] = "" if CTX_PROJECT_PATH in request.session: request.session[CTX_PROJECT_PATH] = "" mypval_utils = getResource("js/mypval_utils.js") context = { 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'scipion_mail': getResourceIcon('scipion_mail'), 'mypval_utils': mypval_utils, 'hiddenTreeProt': True, } context = base_grid(request, context) return render_to_response('pval_projects.html', context)
def _run(self, protocol, request): if not protocol.inputVolume.get().hasValue(): return HttpResponse("errorInput") elif protocol.useSplitVolume == True: if not protocol.splitVolume.get().hasValue(): return HttpResponse("errorInput") else: plotUrl, min_ang = getPlotResMap(request, protocol) ang = protocol.prewhitenAng.get() if ang < min_ang: ang = min_ang context = { # Params 'inputId': protocol.inputVolume.get().getObjId(), 'ang': round(ang, 2), 'ramp': protocol.prewhitenRamp.get(), # Extra Params 'pValue': protocol.pVal.get(), 'minRes': protocol.minRes.get(), 'maxRes': protocol.maxRes.get(), 'stepRes': protocol.stepRes.get(), # Others 'plot': plotUrl, 'min_ang': round(min_ang, 2), 'messi_js': getResourceJs('messi'), 'messi_css': getResourceCss('messi'), } if protocol.useSplitVolume == True and protocol.splitVolume.get().hasValue(): context.update({'useSplit' : 1, 'splitId' : protocol.splitVolume.getObjId(), }) if protocol.applyMask == True and protocol.maskVolume.get().hasValue(): context.update({'useMask' : 1, 'maskId' : protocol.maskVolume.getObjId(), }) context = base_wiz(request, context) return render_to_response('wizards/wiz_resmap.html', context)
def create_context_volume(request, inputParams, volPath, param_stats): import os context = None if inputParams[sj.MODE] == sj.MODE_VOL_NGL: # We need to convert the map to a valid NGL density format (mrc) volPath = volumeToNGL(volPath) context = {"ngl": getResourceJs('ngl'), "volPath": volPath, "threshold": 1.5, 'minSigma': 0, 'maxSigma': 4, "jquery_ui_css": getResourceCss("jquery_ui") } return context
def create_context_jsmol(request, volPath): return {"volLink":volPath, 'jsmol':getResourceJs('jsmol'), "jsmolFolder": getResourceJs('jsmolFolder'), }