Skip to content
Snippets Groups Projects
Commit aa61a9c7 authored by AndiMajore's avatar AndiMajore
Browse files

added max tissue expression route

parent 0d289152
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ services:
labels:
- "com.centurylinklabs.watchtower.enable=true"
db:
image: postgres
image: postgres:14
container_name: drugstone_postgres
restart: always
hostname: drugstone_postgres
......
......@@ -18,7 +18,8 @@ from django.urls import path
from drugstone.views import map_nodes, tasks_view, result_view, \
graph_export, TissueView, TissueExpressionView, query_tissue_proteins, TaskView, \
adjacent_drugs, adjacent_disorders, fetch_edges, create_network, load_network, get_license, get_datasets
adjacent_drugs, adjacent_disorders, fetch_edges, create_network, load_network, get_license, get_datasets, \
get_max_tissue_expression
# cache time is 6 hours
urlpatterns = [
......@@ -33,6 +34,7 @@ urlpatterns = [
path('adjacent_drugs/', adjacent_drugs),
path('adjacent_disorders/', adjacent_disorders),
path('tissue_expression/', TissueExpressionView.as_view()),
path('tissue_max_expression/', get_max_tissue_expression()),
path('tissues/', TissueView.as_view()),
path('admin/', admin.site.urls),
path('create_network', create_network),
......
......@@ -10,7 +10,7 @@ import pandas as pd
import networkx as nx
from django.http import HttpResponse
from django.db.models import Q
from django.db.models import Q, Max
from django.db import IntegrityError
from rest_framework.decorators import api_view
from rest_framework.response import Response
......@@ -626,6 +626,12 @@ def query_proteins(request) -> Response:
})
@api_view(['GET'])
def get_max_tissue_expression(request) -> Response:
tissue = Tissue.objects.get(id=request.query_params.get('tissue'))
return Response({max: ExpressionLevel.objects.filter(tissue=tissue).aggregate(Max('expression_level'))})
@api_view(['POST'])
def query_tissue_proteins(request) -> Response:
threshold = request.data['threshold']
......@@ -646,6 +652,7 @@ class TissueView(APIView):
return Response(TissueSerializer(many=True).to_representation(tissues))
class TissueExpressionView(APIView):
"""
Expression of host proteins in tissues.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment