From dc0d5974adbe20c04aaeb37ed295ab3bda3799c9 Mon Sep 17 00:00:00 2001 From: genstat <cyril.nerin@pasteur.fr> Date: Tue, 13 Jul 2021 09:10:27 +0200 Subject: [PATCH] FIX #90 --- jass/server.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/jass/server.py b/jass/server.py index a667b5ec..0d60e665 100644 --- a/jass/server.py +++ b/jass/server.py @@ -288,6 +288,35 @@ class ProjectLocalManhattanMethodView(MethodView): abort(500) +@blp_projects.route("/<project_id>/heatmap/<chromosome>/<region>") +class ProjectLocalHeatmapMethodView(MethodView): + def get(self, project_id, chromosome, region): + try: + return ( + Project(id=project_id).get_project_local_heatmap_data( + chromosome, region + ), + 200, + {"Content-Type": "text/plain; charset=utf-8"}, + ) + except FileNotFoundError: + status = Project(id=project_id).status + if status == Project.DOES_NOT_EXIST: + return ( + f"project {project_id} does not exist", + 404, + {"Content-Type": "text/plain; charset=utf-8"}, + ) + elif status["worktable"] == Project.CREATING: + return ( + "data not ready yet", + 202, + {"Content-Type": "text/plain; charset=utf-8"}, + ) + else: + abort(500) + + @blp_projects.route("/<project_id>/zoom_manhattan") class ProjectZoomManhattanMethodView(MethodView): def get(self, project_id): -- GitLab