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

added max tissue expression route

Former-commit-id: aa61a9c7
parent 50749984
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ services: ...@@ -33,7 +33,7 @@ services:
labels: labels:
- "com.centurylinklabs.watchtower.enable=true" - "com.centurylinklabs.watchtower.enable=true"
db: db:
image: postgres image: postgres:14
container_name: drugstone_postgres container_name: drugstone_postgres
restart: always restart: always
hostname: drugstone_postgres hostname: drugstone_postgres
......
...@@ -18,7 +18,8 @@ from django.urls import path ...@@ -18,7 +18,8 @@ from django.urls import path
from drugstone.views import map_nodes, tasks_view, result_view, \ from drugstone.views import map_nodes, tasks_view, result_view, \
graph_export, TissueView, TissueExpressionView, query_tissue_proteins, TaskView, \ 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 # cache time is 6 hours
urlpatterns = [ urlpatterns = [
...@@ -33,6 +34,7 @@ urlpatterns = [ ...@@ -33,6 +34,7 @@ urlpatterns = [
path('adjacent_drugs/', adjacent_drugs), path('adjacent_drugs/', adjacent_drugs),
path('adjacent_disorders/', adjacent_disorders), path('adjacent_disorders/', adjacent_disorders),
path('tissue_expression/', TissueExpressionView.as_view()), path('tissue_expression/', TissueExpressionView.as_view()),
path('tissue_max_expression/', get_max_tissue_expression()),
path('tissues/', TissueView.as_view()), path('tissues/', TissueView.as_view()),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('create_network', create_network), path('create_network', create_network),
......
...@@ -10,7 +10,7 @@ import pandas as pd ...@@ -10,7 +10,7 @@ import pandas as pd
import networkx as nx import networkx as nx
from django.http import HttpResponse from django.http import HttpResponse
from django.db.models import Q from django.db.models import Q, Max
from django.db import IntegrityError from django.db import IntegrityError
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from rest_framework.response import Response from rest_framework.response import Response
...@@ -626,6 +626,12 @@ def query_proteins(request) -> 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']) @api_view(['POST'])
def query_tissue_proteins(request) -> Response: def query_tissue_proteins(request) -> Response:
threshold = request.data['threshold'] threshold = request.data['threshold']
...@@ -646,6 +652,7 @@ class TissueView(APIView): ...@@ -646,6 +652,7 @@ class TissueView(APIView):
return Response(TissueSerializer(many=True).to_representation(tissues)) return Response(TissueSerializer(many=True).to_representation(tissues))
class TissueExpressionView(APIView): class TissueExpressionView(APIView):
""" """
Expression of host proteins in tissues. 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