From 65dcb429a5c4bb20f3c96f6a60d0d856b9087576 Mon Sep 17 00:00:00 2001 From: Guillaume Poirier-Morency Date: Tue, 4 Jul 2023 14:57:29 -0700 Subject: [PATCH] Add a homepage --- rnaseq_pipeline/webviewer/__init__.py | 11 +++- .../webviewer/templates/index.html | 54 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 rnaseq_pipeline/webviewer/templates/index.html diff --git a/rnaseq_pipeline/webviewer/__init__.py b/rnaseq_pipeline/webviewer/__init__.py index b8e36d5b..d8cab246 100644 --- a/rnaseq_pipeline/webviewer/__init__.py +++ b/rnaseq_pipeline/webviewer/__init__.py @@ -1,4 +1,7 @@ -from os.path import basename +from os import listdir +from os.path import basename, getctime, join, dirname +from glob import glob +import datetime import luigi from flask import Flask, send_file, render_template, url_for, request, abort @@ -22,6 +25,12 @@ def bad_request(e): def not_found(e): return render_template('404.html', e=e), 404 +@app.route('/') +def home(): + report_dir = join(cfg.OUTPUT_DIR, 'report') + latest_experiments = [(basename(path), basename(dirname(path)), datetime.datetime.now() - datetime.datetime.fromtimestamp(getctime(path))) for path in sorted(glob(join(report_dir, '*', '*')), key=lambda path: -getctime(path))] + return render_template('index.html', latest_experiments=latest_experiments[:10]) + @app.route('/experiment/') def experiment_summary(experiment_id): try: diff --git a/rnaseq_pipeline/webviewer/templates/index.html b/rnaseq_pipeline/webviewer/templates/index.html new file mode 100644 index 00000000..c3462985 --- /dev/null +++ b/rnaseq_pipeline/webviewer/templates/index.html @@ -0,0 +1,54 @@ + + + + + + + Pavlidis Lab RNA-Seq Pipeline + + + +
+

Pavlidis Lab RNA-Seq Pipeline

+

There isn't much at this time here, but you can take a look at the following links:

+ +

Latest Reports

+
    + {% for id, reference_id, t in latest_experiments %} +
  • {{ id }} {{ t }} ago
  • + {% endfor %} +
+

Endpoints

+
+
/experiment/{experimentId}
+
+ Summary + (example) +
+
/experiment/{experimentId}/batch-info
+
+ Batch Information + (example) +
+
/experiment/{experimentId}/quantifications/counts
+
+ Quantifications (counts) + (example) +
+
/experiment/{experimentId}/quantifications/fpkm
+
+ Quantifications (FPKM) + (example) +
+
/experiment/{experimentId}/report
+
+ MultiQC Report + (example) +
+
+
+ +