def scoring_results_overlap_view(request): settings = request.registry.settings GUILDifier.set_parameters(settings) session_id = request.matchdict["session_id1"] session_id2 = request.matchdict["session_id2"] result = GUILDifier(session_id, species=None, settings=settings) result2 = GUILDifier(session_id2, species=None, settings=settings) ready_flag = result.create_output_file() ready_flag2 = result2.create_output_file() if ready_flag is None or ready_flag2 is None: # Error request.session["id"] = session_id request.session["species"] = result.species request.session["message"] = "error/contact webmaster" return HTTPFound(location=request.route_url('status')) elif ready_flag and ready_flag2: # Finished if "id" in request.session: del request.session["id"] del request.session["species"] del request.session["message"] n_start = int(request.matchdict["n_start"]) n_end = int(request.matchdict["n_end"]) p_top = request.matchdict["p_top"] parser = GUILDScoreParser(result.output_file) parser2 = GUILDScoreParser(result2.output_file) values, values_stat = parser.overlap_with(parser2, result.n_node, result.species, int(p_top)) return dict(session_id1=session_id, session_id2=session_id2, species=BIANAQuery.TAX_ID_TO_SPECIES_NAME[result.species], n_start=n_start, n_end=min(n_end, len(values)), n_node=len(values), values=values[(n_start - 1):n_end], values_stat=values_stat, output_file_url=result.output_file_url, seed_file_url=result.seed_file_url, network_file_url=result.network_file_url, network_json=result.get_network_json(p_top), subnetwork_file_url=result.subnetwork_file_url + "." + p_top, drug_file_url=result.drug_file_url + "." + p_top, not_last_page=n_end < result.n_node, p_top=p_top, top1=p_top == "1", top5=p_top == "5", top10=p_top == "10", human=result.species == "9606") request.session["id"] = session_id request.session["species"] = result.species request.session["message"] = "queued/running" return HTTPFound(location=request.route_url('status'))
def scoring_results_view(request): settings = request.registry.settings GUILDifier.set_parameters(settings) session_id = request.matchdict["session_id"] result = GUILDifier(session_id, species=None, settings=settings) ready_flag = result.create_output_file() if ready_flag is None: # Error request.session["id"] = session_id request.session["species"] = result.species request.session["message"] = "error/contact webmaster" return HTTPFound(location=request.route_url('status')) elif ready_flag: # Finished if "id" in request.session: del request.session["id"] del request.session["species"] del request.session["message"] n_start = int(request.matchdict["n_start"]) n_end = int(request.matchdict["n_end"]) p_top = request.matchdict["p_top"] parser = GUILDScoreParser(result.output_file) values = parser.get_user_entity_info_and_scores( n_start, n_end, result.species) return dict(session_id=session_id, species=BIANAQuery.TAX_ID_TO_SPECIES_NAME[result.species], n_start=n_start, n_end=n_end, n_node=result.n_node, values=values, output_file_url=result.output_file_url, seed_file_url=result.seed_file_url, network_file_url=result.network_file_url, network_json=result.get_network_json(p_top), subnetwork_file_url=result.subnetwork_file_url + "." + p_top, drug_file_url=result.drug_file_url + "." + p_top, not_last_page=n_end < result.n_node, top1=p_top == "1", top5=p_top == "5", top10=p_top == "10", human=result.species == "9606") request.session["id"] = session_id request.session["species"] = result.species request.session["message"] = "queued/running" return HTTPFound(location=request.route_url('status'))