Ejemplo n.º 1
0
 def top_associations(self, request, pk):
     """ Retrieve top associations for the selected study. Can add other filters. Check the FAQ for details on the filters. """
     filters = _get_filter_from_params(request.query_params)
     filters['study_id'] = [pk]
     paginator = EsPagination()
     limit = paginator.get_limit(request)
     offset = paginator.get_offset(request)
     associations, count = elastic.load_filtered_top_associations(filters,offset,limit)
     queryset = EsQuerySet(associations, count)
     paginated_asso = self.paginate_queryset(queryset)
     return self.get_paginated_response(paginated_asso)
Ejemplo n.º 2
0
Archivo: rest.py Proyecto: mtog/AraGWAS
 def top_list(self, request):
     """ Retrieve the top genes based on the number of significant associations and provide full gene information. """
     filters = _get_filter_from_params(request.query_params)
     if filters['significant'] == []:
         filters['significant'] = ['p']
     paginator = EsPagination()
     limit = paginator.get_limit(request)
     offset = paginator.get_offset(request)
     genes, count = elastic.load_filtered_top_genes(filters, offset, limit)
     queryset = EsQuerySet(genes, count)
     paginated_genes = self.paginate_queryset(queryset)
     return self.get_paginated_response(paginated_genes)
Ejemplo n.º 3
0
 def list(self, request):
     """ List all associations sorted by score. """
     filters = _get_filter_from_params(request.query_params)
     if len(filters['significant']) == 0:
         filters['significant'] = 'p'
     last_el = request.query_params.get('lastel', '')
     limit = EsPagination().get_limit(request)
     associations, count, lastel = elastic.load_filtered_top_associations_search_after(filters,last_el,limit)
     queryset = EsQuerySetLastEl(associations, count, lastel)
     # associations, count = elastic.load_filtered_top_associations(filters,offset,limit)
     # queryset = EsQuerySet(associations, count)
     paginated_asso = self.paginate_queryset(queryset)
     return self.get_paginated_response({'results': paginated_asso, 'count': count, 'lastel': [lastel[0], lastel[1]]})