def download_appgravity(): li = config.get_query_list() resdic = {} for query in li: url = make_appgravity_url_from_query(query) page = urlutil.getpage_bycurl(url) resdic[query] = list(map(string.lower, myparser.parse_appgravity(page))) return resdic
def download_appbrain(): li = config.get_query_list() resdic = {} for query in li: urlli = make_appbrain_urllist(query) pagelist = urlutil.getpages_bycurl(urlli) resdic[query] = myparser.parse_appbrain(pagelist) return resdic
def download_googleplay(): # this is the entry for idcollector global idset if not idset: idset = config.get_existing_idset() li = config.get_query_list() resdic = {} for query in li: resdic[query] = download_googleplay_single_query(query) return resdic
def table(request): if len(request.POST) == 0: return redirect(prog_type + '/HitWalker2/') elif request.POST.has_key("redirect"): seed_list = request.session['seed_list'] query_list = request.session['query_list'] rels = request.session['rels'] rels_header = request.session['rels_header'] where_vars = request.session['where_vars'] inp_params = request.session['inp_params'] cur_param = {} for key,val in inp_params.items(): if val['type'] == 'standard': cur_param[key] = copy.deepcopy(val['fields']) cur_filts = {} for i in where_vars: cur_filts[i['name']] = i['pretty_where'] return render(request, 'network/res_table.html', {'res_table':rels, 'res_header':rels_header, 'sample_display_name':request.session['query_samples']['SampleID'], 'cur_filts':json.dumps(cur_filts), 'cur_param':json.dumps(cur_param), 'seeds':json.dumps(seed_list[:50]), 'queries':json.dumps(query_list[:50]), 'prog_type':prog_type, 'username':request.user}) else: request_post = dict(request.POST.iterlists()) #get ride of the token... request_post.pop("csrfmiddlewaretoken") inp_params = json.loads(request_post['parameters'][0]) trans_funcs={} #The user should only have modified the values and/or the groups of the fields, the 'trans' fields etc should not have been altered from config for param,param_val in config.adjust_fields.items(): for field, field_val in param_val['fields'].items(): if field_val.has_key('trans'): trans_funcs[field] = copy.deepcopy(field_val['trans']) #the non-grouped vars are added to the session here and the grouped vars are returned as the where_vars list where_vars = core.parse_parameters(inp_params, trans_funcs, request) #save the where_vars list to the session request.session['where_vars'] = where_vars #though the appropriate variables are added to the session, this is also added for simplicity when a table is re-requested. request.session['inp_params'] = inp_params #also add in the sample info request.session["query_samples"] = core.proper_type(request.POST["query_samples"]) valid_hit_genes = core.get_valid_hits(request, config.hit_session_dict) if len(valid_hit_genes) > 0: valid_query_res = core.get_valid_querys(request, config.query_prior_dict) comb_gene_hits = config.score_hits(request, valid_hit_genes) conv_prot_hits = config.convert_ids_to(request, comb_gene_hits) prior_prot_hits = config.prioritization_func['function'](request, conv_prot_hits, **config.prioritization_func['args']) #subset to only those genes which are seeds or queries limit_list = comb_gene_hits.nodeList().ids() query_only_ids = map(lambda x: x.getAttr(['attributes', 'gene']),valid_query_res) limit_list.extend(query_only_ids) query_results = config.convert_ids_from(request, prior_prot_hits, limit_list) seed_list = config.get_seed_list(comb_gene_hits) temp_query = copy.deepcopy(query_results) temp_query.subset(query_only_ids) query_list = config.get_query_list(temp_query) #make the results table rels, rels_header = core.make_results_table(valid_query_res, valid_hit_genes, query_results) else: rels = [] rels_header = [] seed_list = [] query_list = [] query_results = core.SeedList(core.NodeList()) request.session['hitwalker_score'] = query_results request.session['seed_list'] = seed_list request.session['query_list'] = query_list request.session['rels'] = rels request.session['rels_header'] = rels_header #prepare cur_filts and cur_param to be ouput as part of the table cur_param = {} for key,val in inp_params.items(): if val['type'] == 'standard': cur_param[key] = copy.deepcopy(val['fields']) cur_filts = {} for i in where_vars: cur_filts[i['name']] = i['pretty_where'] return render(request, 'network/res_table.html', {'res_table':rels, 'res_header':rels_header, 'sample_display_name':request.session['query_samples']['SampleID'], 'cur_filts':json.dumps(cur_filts), 'cur_param':json.dumps(cur_param), 'seeds':json.dumps(seed_list[:50]), 'queries':json.dumps(query_list[:50]), 'prog_type':prog_type, 'username':request.user})