Skip to content
Snippets Groups Projects
Commit 16f8beba authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion ♻️
Browse files

add query args to configure size of the window

parent 5e73562e
No related branches found
No related tags found
No related merge requests found
Pipeline #12759 passed
......@@ -2,6 +2,7 @@ from django.urls import re_path
from . import views
urlpatterns = [
re_path(r'^api/genes/$', views.gene_list, name='genes'),
re_path(r'^api/genes/(?P<gene_id>.*)$', views.gene_detail),
......
......@@ -36,8 +36,10 @@ def _count_windows(df, window_col, window_size=10000):
@api_view(['GET'])
def gene_length(request):
def gene_length(request, window_size=10000):
if 'window_size' in request.query_params:
window_size = int(request.query_params.get('window_size'))
df = pd.DataFrame(list(Gene.objects.all().values(GENE_LENGTH_COL)))
return Response({
'data': _count_windows(df, GENE_LENGTH_COL)
'data': _count_windows(df, GENE_LENGTH_COL, window_size)
})
......@@ -15,7 +15,9 @@ importlib-metadata==0.18
kiwisolver==1.1.0
mccabe==0.6.1
more-itertools==7.0.0
numpy==1.16.4
packaging==19.0
pandas==0.24.2
pluggy==0.12.0
psycopg2==2.8.2
py==1.8.0
......
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