Skip to content

Commit

Permalink
Add a homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed Aug 23, 2023
1 parent e63b359 commit 65dcb42
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rnaseq_pipeline/webviewer/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/<experiment_id>')
def experiment_summary(experiment_id):
try:
Expand Down
54 changes: 54 additions & 0 deletions rnaseq_pipeline/webviewer/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="charset" content="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{{ experiment_id }}">
<title>Pavlidis Lab RNA-Seq Pipeline</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
</head>
<body>
<div class="container my-5">
<h2>Pavlidis Lab RNA-Seq Pipeline</h2>
<p>There isn't much at this time here, but you can take a look at the following links:</p>
<ul>
<li><a href="https://pavlab.msl.ubc.ca/">Pavlidis Lab Home</a></li>
<li><a href="https://github.com/PavlidisLab/rnaseq-pipeline">Source code on GitHub</a></li>
</ul>
<h3>Latest Reports</h3>
<ul>
{% for id, reference_id, t in latest_experiments %}
<li><a href="{{ url_for('experiment_report', experiment_id=id, reference_id=reference_id) }}">{{ id }}</a> {{ t }} ago</li>
{% endfor %}
</ul>
<h3>Endpoints</h3>
<dl>
<dt>/experiment/{experimentId}</dt>
<dd>
Summary
(<a href="{{ url_for('experiment_summary', experiment_id='GSE141028') }}">example</a>)
</dd>
<dt>/experiment/{experimentId}/batch-info</dt>
<dd>
Batch Information
(<a href="{{ url_for('experiment_batch_info', experiment_id='GSE141028') }}">example</a>)
</dd>
<dt>/experiment/{experimentId}/quantifications/counts</dt>
<dd>
Quantifications (counts)
(<a href="{{ url_for('experiment_quantifications', experiment_id='GSE141028', reference_id='hg38_ncbi', mode='counts') }}">example</a>)
</dd>
<dt>/experiment/{experimentId}/quantifications/fpkm</dt>
<dd>
Quantifications (FPKM)
(<a href="{{ url_for('experiment_quantifications', experiment_id='GSE141028', reference_id='hg38_ncbi', mode='fpkm') }}">example</a>)
</dd>
<dt>/experiment/{experimentId}/report</dt>
<dd>
MultiQC Report
(<a href="{{ url_for('experiment_report', experiment_id='GSE141028', reference_id='hg38_ncbi') }}">example</a>)
</dd>
</dl>
</div>
</body>
</html>

0 comments on commit 65dcb42

Please sign in to comment.