chanjo-report 4.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chanjo_report/__init__.py +32 -0
- chanjo_report/cli/__init__.py +2 -0
- chanjo_report/cli/core.py +36 -0
- chanjo_report/cli/utils.py +22 -0
- chanjo_report/interfaces/__init__.py +3 -0
- chanjo_report/interfaces/html.py +23 -0
- chanjo_report/interfaces/pdf.py +29 -0
- chanjo_report/server/__init__.py +1 -0
- chanjo_report/server/app.py +80 -0
- chanjo_report/server/blueprints/__init__.py +3 -0
- chanjo_report/server/blueprints/index/__init__.py +2 -0
- chanjo_report/server/blueprints/index/templates/index/index.html +40 -0
- chanjo_report/server/blueprints/index/templates/index/layouts/base.html +56 -0
- chanjo_report/server/blueprints/index/views.py +23 -0
- chanjo_report/server/blueprints/report/__init__.py +2 -0
- chanjo_report/server/blueprints/report/controllers.py +56 -0
- chanjo_report/server/blueprints/report/static/main.css +31 -0
- chanjo_report/server/blueprints/report/templates/report/_report_body.html +178 -0
- chanjo_report/server/blueprints/report/templates/report/gene.html +86 -0
- chanjo_report/server/blueprints/report/templates/report/genes.html +103 -0
- chanjo_report/server/blueprints/report/templates/report/layouts/base.html +56 -0
- chanjo_report/server/blueprints/report/templates/report/report.html +81 -0
- chanjo_report/server/blueprints/report/templates/report/report_body.html +11 -0
- chanjo_report/server/blueprints/report/utils.py +200 -0
- chanjo_report/server/blueprints/report/views.py +172 -0
- chanjo_report/server/config.py +32 -0
- chanjo_report/server/constants.py +12 -0
- chanjo_report/server/extensions.py +4 -0
- chanjo_report/server/translations/sv/LC_MESSAGES/messages.mo +0 -0
- chanjo_report/server/translations/sv/LC_MESSAGES/messages.po +174 -0
- chanjo_report/server/utils.py +74 -0
- chanjo_report-4.13.0.dist-info/METADATA +135 -0
- chanjo_report-4.13.0.dist-info/RECORD +36 -0
- chanjo_report-4.13.0.dist-info/WHEEL +4 -0
- chanjo_report-4.13.0.dist-info/entry_points.txt +2 -0
- chanjo_report-4.13.0.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
chanjo_report
|
|
4
|
+
~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
Chanjo Report automatically renders a coverage report from Chanjo ouput.
|
|
7
|
+
|
|
8
|
+
:copyright: (c) 2014 by Robin Andeer
|
|
9
|
+
:licence: MIT, see LICENCE for more details
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from importlib.metadata import version
|
|
13
|
+
|
|
14
|
+
# generate your own AsciiArt at:
|
|
15
|
+
# patorjk.com/software/taag/#f=Calvin%20S&t=Chanjo Report
|
|
16
|
+
__banner__ = r"""
|
|
17
|
+
╔═╗┬ ┬┌─┐┌┐┌ ┬┌─┐ ╦═╗┌─┐┌─┐┌─┐┬─┐┌┬┐
|
|
18
|
+
║ ├─┤├─┤│││ ││ │ ╠╦╝├┤ ├─┘│ │├┬┘ │ by Robin Andeer
|
|
19
|
+
╚═╝┴ ┴┴ ┴┘└┘└┘└─┘ ╩╚═└─┘┴ └─┘┴└─ ┴
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
__title__ = "chanjo-report"
|
|
23
|
+
__summary__ = "Automatically renders coverage reports from Chanjo ouput."
|
|
24
|
+
__uri__ = "https://github.com/robinandeer/chanjo-report"
|
|
25
|
+
|
|
26
|
+
__version__ = version(__title__)
|
|
27
|
+
|
|
28
|
+
__author__ = "Robin Andeer"
|
|
29
|
+
__email__ = "robin.andeer@gmail.com"
|
|
30
|
+
|
|
31
|
+
__license__ = "MIT"
|
|
32
|
+
__copyright__ = "Copyright 2014 Robin Andeer"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import click
|
|
3
|
+
|
|
4
|
+
from chanjo_report.interfaces import html, pdf
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.command()
|
|
8
|
+
@click.option("-r", "--render", type=click.Choice(["html", "pdf"]), default="html")
|
|
9
|
+
@click.option(
|
|
10
|
+
"-s",
|
|
11
|
+
"--sample",
|
|
12
|
+
"samples",
|
|
13
|
+
type=str,
|
|
14
|
+
multiple=True,
|
|
15
|
+
help="One or more sample names or IDs - Only for PDF reports",
|
|
16
|
+
)
|
|
17
|
+
@click.option("-o", "--outfile", "outfile", type=str, help="Outfile path - Only for PDF reports")
|
|
18
|
+
@click.option("-l", "--language", type=click.Choice(["en", "sv"]))
|
|
19
|
+
@click.option("-d", "--debug", is_flag=True)
|
|
20
|
+
@click.pass_context
|
|
21
|
+
def report(context, render, samples, outfile, language, debug):
|
|
22
|
+
"""Generate a coverage report from Chanjo SQL output."""
|
|
23
|
+
# get uri + dialect of Chanjo database
|
|
24
|
+
if context.obj["database"] is None:
|
|
25
|
+
click.echo("database URI not found")
|
|
26
|
+
context.abort()
|
|
27
|
+
|
|
28
|
+
# set the custom option
|
|
29
|
+
context.obj["report"] = dict(language=language, debug=debug, samples=samples, outfile=outfile)
|
|
30
|
+
|
|
31
|
+
if render == "html":
|
|
32
|
+
html.render_html(context.obj)
|
|
33
|
+
else:
|
|
34
|
+
if not samples:
|
|
35
|
+
raise ValueError("At least one sample is required to create a PDF report.")
|
|
36
|
+
pdf.render_pdf(context.obj)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Utilities related to entry point interfaces loaded by the CLI."""
|
|
3
|
+
|
|
4
|
+
from importlib.metadata import entry_points
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def iter_interfaces(ep_key="chanjo_report.interfaces"):
|
|
8
|
+
"""Yield all the installed Chanjo Report interfaces.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
ep_key (string): Entry point key to iterate over
|
|
12
|
+
|
|
13
|
+
Yields:
|
|
14
|
+
object: Entry point object
|
|
15
|
+
"""
|
|
16
|
+
for entry_point in entry_points().select(group=ep_key):
|
|
17
|
+
yield entry_point
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def list_interfaces():
|
|
21
|
+
"""List all installed interfaces by name."""
|
|
22
|
+
return [interface.name for interface in iter_interfaces()]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import click
|
|
3
|
+
|
|
4
|
+
from chanjo_report.server.app import create_app
|
|
5
|
+
from chanjo_report.server.config import ProdConfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def render_html(options):
|
|
9
|
+
"""Start a Flask server to generate HTML report on request."""
|
|
10
|
+
# spin up the Flask server
|
|
11
|
+
config = ProdConfig
|
|
12
|
+
config.SQLALCHEMY_DATABASE_URI = options["database"]
|
|
13
|
+
report_options = options["report"]
|
|
14
|
+
config.CHANJO_PANEL_NAME = report_options.get("panel_name")
|
|
15
|
+
config.CHANJO_LANGUAGE = report_options.get("language")
|
|
16
|
+
config.CHANJO_PANEL = report_options.get("panel")
|
|
17
|
+
config.DEBUG = report_options.get("debug")
|
|
18
|
+
|
|
19
|
+
app = create_app(config=config)
|
|
20
|
+
host = report_options.get("host", "0.0.0.0")
|
|
21
|
+
port = report_options.get("port", 5000)
|
|
22
|
+
click.echo(click.style("open browser to: http://{}:{}".format(host, port), fg="blue"))
|
|
23
|
+
app.run(host=host, port=port)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from werkzeug.datastructures import MultiDict
|
|
3
|
+
|
|
4
|
+
from chanjo_report.server.app import create_app
|
|
5
|
+
from chanjo_report.server.config import DefaultConfig
|
|
6
|
+
from chanjo_report.server.blueprints.report.views import pdf as pdf_view
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def render_pdf(options):
|
|
10
|
+
"""Generate a PDF report for a given group of samples."""
|
|
11
|
+
|
|
12
|
+
config = DefaultConfig
|
|
13
|
+
config.SQLALCHEMY_DATABASE_URI = options["database"]
|
|
14
|
+
report_options = options["report"]
|
|
15
|
+
config.CHANJO_PANEL_NAME = report_options.get("panel_name")
|
|
16
|
+
config.CHANJO_LANGUAGE = report_options.get("language")
|
|
17
|
+
config.CHANJO_PANEL = report_options.get("panel")
|
|
18
|
+
config.DEBUG = report_options.get("debug")
|
|
19
|
+
|
|
20
|
+
data = MultiDict([("sample_id", s) for s in report_options["samples"]])
|
|
21
|
+
|
|
22
|
+
app = create_app(config=config)
|
|
23
|
+
with app.test_request_context("/report/pdf", method="POST", data=data):
|
|
24
|
+
response = pdf_view()
|
|
25
|
+
output_file = report_options.get("outfile") or "report.pdf"
|
|
26
|
+
with open(output_file, "wb") as f:
|
|
27
|
+
f.write(response.data)
|
|
28
|
+
|
|
29
|
+
print(f"PDF report saved to {output_file}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from flask import Flask, current_app, request
|
|
3
|
+
from flask_babel import Babel
|
|
4
|
+
|
|
5
|
+
from .config import DefaultConfig
|
|
6
|
+
from .constants import LEVELS
|
|
7
|
+
from .extensions import api
|
|
8
|
+
from .utils import pretty_date
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def create_app(config=None):
|
|
12
|
+
"""Create a Flask app (Flask Application Factory)."""
|
|
13
|
+
app = Flask(__name__, instance_relative_config=True)
|
|
14
|
+
configure_app(app, config=config)
|
|
15
|
+
configure_extensions(app)
|
|
16
|
+
configure_blueprints(app)
|
|
17
|
+
configure_template_filters(app)
|
|
18
|
+
|
|
19
|
+
return app
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def configure_app(app, config=None, config_file=None):
|
|
23
|
+
"""Configure app in different ways."""
|
|
24
|
+
# http://flask.pocoo.org/docs/api/#configuration
|
|
25
|
+
app.config.from_object(DefaultConfig)
|
|
26
|
+
if config:
|
|
27
|
+
app.config.from_object(config)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def configure_extensions(app):
|
|
31
|
+
"""Initialize Flask extensions."""
|
|
32
|
+
api.init_app(app)
|
|
33
|
+
|
|
34
|
+
# Flask-babel
|
|
35
|
+
babel = Babel(app)
|
|
36
|
+
|
|
37
|
+
def get_locale():
|
|
38
|
+
"""Determine locale to use for translations."""
|
|
39
|
+
accept_languages = current_app.config.get("ACCEPT_LANGUAGES")
|
|
40
|
+
|
|
41
|
+
# first check request args
|
|
42
|
+
session_language = request.args.get("lang")
|
|
43
|
+
if session_language in accept_languages:
|
|
44
|
+
return session_language
|
|
45
|
+
|
|
46
|
+
# language can be forced in config
|
|
47
|
+
user_language = current_app.config.get("CHANJO_LANGUAGE")
|
|
48
|
+
if user_language:
|
|
49
|
+
return user_language
|
|
50
|
+
|
|
51
|
+
# try to guess the language from the user accept header that
|
|
52
|
+
# the browser transmits. We support de/fr/en in this example.
|
|
53
|
+
# The best match wins.
|
|
54
|
+
return request.accept_languages.best_match(accept_languages)
|
|
55
|
+
|
|
56
|
+
babel.init_app(app, locale_selector=get_locale)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def configure_blueprints(app):
|
|
60
|
+
"""Configure blueprints in views."""
|
|
61
|
+
for blueprint in app.config.get("BLUEPRINTS", []):
|
|
62
|
+
app.register_blueprint(blueprint)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def configure_template_filters(app):
|
|
66
|
+
"""Configure custom Jinja2 template filters."""
|
|
67
|
+
|
|
68
|
+
@app.context_processor
|
|
69
|
+
def inject_levels():
|
|
70
|
+
return dict(levels=LEVELS)
|
|
71
|
+
|
|
72
|
+
@app.template_filter()
|
|
73
|
+
def human_date(value):
|
|
74
|
+
"""Prettify dates for humans."""
|
|
75
|
+
return pretty_date(value)
|
|
76
|
+
|
|
77
|
+
@app.template_filter()
|
|
78
|
+
def format_date(value, format="%Y-%m-%d"):
|
|
79
|
+
"""Format date on a specified format."""
|
|
80
|
+
return value.strftime(format)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{% extends 'index/layouts/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block main %}
|
|
4
|
+
<div class="container">
|
|
5
|
+
<h3>Samples</h3>
|
|
6
|
+
|
|
7
|
+
<ul class="list-group">
|
|
8
|
+
{% for sample in samples %}
|
|
9
|
+
<li class="list-group-item">
|
|
10
|
+
<a href="{{ url_for('report.report', sample_id=sample.id) }}">
|
|
11
|
+
{{ sample.name }}
|
|
12
|
+
</a>
|
|
13
|
+
({{ sample.id }})
|
|
14
|
+
</li>
|
|
15
|
+
{% endfor %}
|
|
16
|
+
</ul>
|
|
17
|
+
|
|
18
|
+
<h3>Genes</h3>
|
|
19
|
+
<table class="table table-bordered table-hover">
|
|
20
|
+
<thead>
|
|
21
|
+
<tr>
|
|
22
|
+
<th>Chromosome</th>
|
|
23
|
+
<th>Gene</th>
|
|
24
|
+
</tr>
|
|
25
|
+
</thead>
|
|
26
|
+
<tbody>
|
|
27
|
+
{% for transcript in transcripts %}
|
|
28
|
+
<tr>
|
|
29
|
+
<td>{{ transcript.chromosome }}</td>
|
|
30
|
+
<td>
|
|
31
|
+
<a href="{{ url_for('report.gene', gene_id=transcript.gene_id) }}">
|
|
32
|
+
{{ transcript.gene_name or transcript.gene_id }}
|
|
33
|
+
</a>
|
|
34
|
+
</td>
|
|
35
|
+
</tr>
|
|
36
|
+
{% endfor %}
|
|
37
|
+
</tbody>
|
|
38
|
+
</table>
|
|
39
|
+
</div>
|
|
40
|
+
{% endblock %}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
5
|
+
|
|
6
|
+
<title>{% block title %}{% endblock %}</title>
|
|
7
|
+
|
|
8
|
+
<meta name="description" content="Chanjo Report: coverage report generator">
|
|
9
|
+
<meta name="author" content="Robin Andeer">
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
|
+
|
|
12
|
+
<!-- place 'favicon.ico' + 'apple-touch-icon.png' in the root directory -->
|
|
13
|
+
<link rel="Shortcut Icon"
|
|
14
|
+
href="{{ url_for('static', filename='favicon.png') }}"
|
|
15
|
+
type="image/x-icon">
|
|
16
|
+
|
|
17
|
+
{% block css %}
|
|
18
|
+
<!-- Latest compiled and minified CSS -->
|
|
19
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
|
20
|
+
|
|
21
|
+
<!-- Customizations -->
|
|
22
|
+
<link rel="stylesheet" type="text/css" href="{{ url_for('report.static', filename='main.css') }}">
|
|
23
|
+
{% endblock %}
|
|
24
|
+
|
|
25
|
+
{% block css_style %}{% endblock %}
|
|
26
|
+
|
|
27
|
+
{% block js_top %}{% endblock %}
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
{% block body %}
|
|
31
|
+
<nav class="navbar navbar-default">
|
|
32
|
+
<div class="container">
|
|
33
|
+
<div class="navbar-header">
|
|
34
|
+
<a class="navbar-brand" href="{{ url_for('index.index') }}">
|
|
35
|
+
{% block header_title %}Chanjo Report{% endblock %}
|
|
36
|
+
</a>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<ul class="nav navbar-nav">
|
|
40
|
+
{% block nav %}{% endblock %}
|
|
41
|
+
</ul>
|
|
42
|
+
</div>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
{% block main %}{% endblock %}
|
|
46
|
+
{% endblock %}
|
|
47
|
+
|
|
48
|
+
{% block js_btm %}
|
|
49
|
+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
|
50
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
|
51
|
+
|
|
52
|
+
<!-- Latest compiled and minified JavaScript -->
|
|
53
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
|
54
|
+
{% endblock %}
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import logging
|
|
3
|
+
|
|
4
|
+
from chanjo.store.models import Sample, Transcript
|
|
5
|
+
from flask import Blueprint, render_template
|
|
6
|
+
|
|
7
|
+
from chanjo_report.server.extensions import api
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
index_bp = Blueprint(
|
|
11
|
+
"index",
|
|
12
|
+
__name__,
|
|
13
|
+
template_folder="templates",
|
|
14
|
+
static_folder="static",
|
|
15
|
+
static_url_path="/static/index",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@index_bp.route("/")
|
|
20
|
+
def index():
|
|
21
|
+
sample_objs = api.session.query(Sample).limit(20)
|
|
22
|
+
tx_models = api.session.query(Transcript).distinct(Transcript.gene_id).limit(20)
|
|
23
|
+
return render_template("index/index.html", samples=sample_objs, transcripts=tx_models)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from chanjo.store.models import Sample
|
|
2
|
+
from chanjo_report.server.constants import LEVELS
|
|
3
|
+
|
|
4
|
+
from .utils import keymetrics_rows, samplesex_rows, transcripts_rows
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def report_contents(request):
|
|
8
|
+
"""Check args or form provided by user request and prepare contents for report or pdf endpoints
|
|
9
|
+
Args:
|
|
10
|
+
request(flask.Request)
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
data(dict)
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
sample_ids = request.form.getlist("sample_id") or request.args.getlist("sample_id")
|
|
17
|
+
raw_gene_ids = request.form.get("gene_ids") or request.args.get("gene_ids")
|
|
18
|
+
gene_ids = []
|
|
19
|
+
if raw_gene_ids:
|
|
20
|
+
gene_ids = [gene_id.strip() for gene_id in raw_gene_ids.split(",")]
|
|
21
|
+
|
|
22
|
+
int_gene_ids = set()
|
|
23
|
+
gene_id_errors = set()
|
|
24
|
+
for gene_id in gene_ids:
|
|
25
|
+
try:
|
|
26
|
+
int_gene_ids.add(int(gene_id))
|
|
27
|
+
except ValueError:
|
|
28
|
+
gene_id_errors.add(gene_id)
|
|
29
|
+
|
|
30
|
+
int_gene_ids = list(int_gene_ids)
|
|
31
|
+
|
|
32
|
+
level = int(request.args.get("level") or request.form.get("level") or 10)
|
|
33
|
+
extras = {
|
|
34
|
+
"panel_name": (request.args.get("panel_name") or request.form.get("panel_name")),
|
|
35
|
+
"level": level,
|
|
36
|
+
"gene_ids": int_gene_ids,
|
|
37
|
+
"show_genes": any([request.args.get("show_genes"), request.form.get("show_genes")]),
|
|
38
|
+
}
|
|
39
|
+
samples = Sample.query.filter(Sample.id.in_(sample_ids))
|
|
40
|
+
case_name = request.form.get("case_name") or request.args.get("case_name")
|
|
41
|
+
sex_rows = samplesex_rows(sample_ids)
|
|
42
|
+
metrics_rows = keymetrics_rows(sample_ids, genes=int_gene_ids)
|
|
43
|
+
tx_rows = transcripts_rows(sample_ids, genes=int_gene_ids, level=level)
|
|
44
|
+
|
|
45
|
+
data = dict(
|
|
46
|
+
sample_ids=sample_ids,
|
|
47
|
+
samples=samples,
|
|
48
|
+
case_name=case_name,
|
|
49
|
+
sex_rows=sex_rows,
|
|
50
|
+
levels=LEVELS,
|
|
51
|
+
extras=extras,
|
|
52
|
+
metrics_rows=metrics_rows,
|
|
53
|
+
tx_rows=tx_rows,
|
|
54
|
+
gene_id_errors=gene_id_errors,
|
|
55
|
+
)
|
|
56
|
+
return data
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Main report styles */
|
|
2
|
+
@charset "utf-8";
|
|
3
|
+
|
|
4
|
+
/* PDF restrictions */
|
|
5
|
+
@page {
|
|
6
|
+
size: A4;
|
|
7
|
+
margin: 1cm;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@media print {
|
|
11
|
+
body {
|
|
12
|
+
font-size: 90%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.table>tbody>tr>td,
|
|
16
|
+
.table>thead>tr>th {
|
|
17
|
+
padding: 5px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.page-break {
|
|
21
|
+
page-break-after: always;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.menu-bar {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.content {
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{# The report itself, without page chrome. Included by report.html and report_body.html #}
|
|
2
|
+
{% macro overview_table(sex_rows) %}
|
|
3
|
+
<div class="table-responsive">
|
|
4
|
+
<table class="table table-bordered table-hover">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
<th rowspan="2">{{ _('Sample') }}</th>
|
|
8
|
+
<th rowspan="2">{{ _('Group') }}</th>
|
|
9
|
+
<th rowspan="2">{{ _('Analyzed at') }}</th>
|
|
10
|
+
<th rowspan="2">
|
|
11
|
+
{{ _('Sex') }}
|
|
12
|
+
{{ _('according to sequence data') }}
|
|
13
|
+
</th>
|
|
14
|
+
<th colspan="2" class="center-align">
|
|
15
|
+
{{ _('Average coverage') }} [x]
|
|
16
|
+
</th>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<th class="th-secondary">{{ _('Chromosome') }} X</th>
|
|
20
|
+
<th class="th-secondary">{{ _('Chromosome') }} Y</th>
|
|
21
|
+
</tr>
|
|
22
|
+
</thead>
|
|
23
|
+
<tbody>
|
|
24
|
+
{% for sample in sex_rows %}
|
|
25
|
+
<tr>
|
|
26
|
+
<td>{{ sample.sample }}</td>
|
|
27
|
+
<td>{{ sample.group }}</td>
|
|
28
|
+
<td>{{ sample.analysis_date.date() }}</td>
|
|
29
|
+
<td>{{ _(sample.sex) }}</td>
|
|
30
|
+
<td class="text-right">{{ sample.x_coverage|round(3) }}</td>
|
|
31
|
+
<td class="text-right">{{ sample.y_coverage|round(3) }}</td>
|
|
32
|
+
</tr>
|
|
33
|
+
{% endfor %}
|
|
34
|
+
</tbody>
|
|
35
|
+
</table>
|
|
36
|
+
</div>
|
|
37
|
+
{% endmacro %}
|
|
38
|
+
|
|
39
|
+
{% macro metrics_table(metrics_rows) %}
|
|
40
|
+
<div class="table-responsive">
|
|
41
|
+
<table class="table table-bordered table-hover">
|
|
42
|
+
<thead>
|
|
43
|
+
<tr>
|
|
44
|
+
<th>{{ _('Sample') }}</th>
|
|
45
|
+
<th>{{ _('Average coverage') }} [x]</th>
|
|
46
|
+
{% for level_int, level_key in levels.items() %}
|
|
47
|
+
<th>{{ _('Completeness') }} {{ level_int }}x [%]</th>
|
|
48
|
+
{% endfor %}
|
|
49
|
+
</tr>
|
|
50
|
+
</thead>
|
|
51
|
+
<tbody>
|
|
52
|
+
{% for data in metrics_rows %}
|
|
53
|
+
<tr>
|
|
54
|
+
<td>{{ data.TranscriptStat.sample.name or data.TranscriptStat.sample.id }}</td>
|
|
55
|
+
<td class="text-right">{{ data.mean_coverage|round(2) }}</td>
|
|
56
|
+
{% for level_int, level_key in levels.items() %}
|
|
57
|
+
<td class="text-right">{{ data|attr(level_key)|round(2) if data|attr(level_key) }}</td>
|
|
58
|
+
{% endfor %}
|
|
59
|
+
</tr>
|
|
60
|
+
{% endfor %}
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
{% endmacro %}
|
|
65
|
+
|
|
66
|
+
{% macro transcripts_table(transcript_rows) %}
|
|
67
|
+
<table class="table table-bordered table-hover">
|
|
68
|
+
<thead>
|
|
69
|
+
<tr>
|
|
70
|
+
<th>{{ _('Sample') }}</th>
|
|
71
|
+
<th>{{ _('Fully covered transcripts') }} [%]</th>
|
|
72
|
+
<th>{{ _('Incompletely covered') }} {{ _('transcripts') }}</th>
|
|
73
|
+
{% if extras.show_genes %}
|
|
74
|
+
<th>{{ _('Incompletely covered') }} {{ _('genes') }} (max 50)</th>
|
|
75
|
+
{% endif %}
|
|
76
|
+
</tr>
|
|
77
|
+
</thead>
|
|
78
|
+
<tbody>
|
|
79
|
+
{% for data in transcript_rows %}
|
|
80
|
+
<tr>
|
|
81
|
+
<td>{{ data.sample.name or data.sample.id }}</td>
|
|
82
|
+
<td class="text-right">{{ data.yield|round(3) }}</td>
|
|
83
|
+
<td class="text-center">
|
|
84
|
+
{{ data.missed_count }} / <small>{{ data.total }}</small>
|
|
85
|
+
</td>
|
|
86
|
+
{% if extras.show_genes %}
|
|
87
|
+
<td><small>
|
|
88
|
+
{% for tx_stat in data.missed.limit(50) %}
|
|
89
|
+
{{ tx_stat.transcript.gene_name or tx_stat.transcript.gene_id }}
|
|
90
|
+
{% else %}
|
|
91
|
+
-
|
|
92
|
+
{% endfor %}
|
|
93
|
+
</small></td>
|
|
94
|
+
{% endif %}
|
|
95
|
+
</tr>
|
|
96
|
+
{% else %}
|
|
97
|
+
<tr>
|
|
98
|
+
<td colspan="{{ 4 if extras.show_genes else 3 }}">
|
|
99
|
+
Inga ofullständigt täckta transkript.
|
|
100
|
+
</td>
|
|
101
|
+
</tr>
|
|
102
|
+
{% endfor %}
|
|
103
|
+
</tbody>
|
|
104
|
+
</table>
|
|
105
|
+
{% endmacro %}
|
|
106
|
+
|
|
107
|
+
{% macro explanations(cutoff) %}
|
|
108
|
+
<h4>{{ _('General') }}</h4>
|
|
109
|
+
<p>
|
|
110
|
+
<a href="http://lomereiter.github.io/sambamba/" title="Sambamba">Sambamba</a>
|
|
111
|
+
{{ _('is used for coverage analysis based on read alignment.') }}
|
|
112
|
+
{{ _('Duplicates, reads with mapping quality less than 10 as well as bases with a base quality less than 10 are not included in the analysis.') }}
|
|
113
|
+
{{ _('Bases that overlap between read pairs are only counted once.') }}
|
|
114
|
+
|
|
115
|
+
{{ _('The parts of the genome that has been analyzed') }}
|
|
116
|
+
{{ _('is composed of all protein coding, exonic intervals defined in') }}
|
|
117
|
+
<a href="http://www.genenames.org/">HGNC</a>.
|
|
118
|
+
|
|
119
|
+
{% if includes_splice_sites %}
|
|
120
|
+
{{ _('Additionally, the data also includes spicing sites') }}
|
|
121
|
+
({{ _('donator and acceptor positions') }},
|
|
122
|
+
{{ splice_site_interval }}
|
|
123
|
+
{{ _('bases on either of each exon') }}).
|
|
124
|
+
{% endif %}
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
{% if config.CHANJO_PANEL %}
|
|
128
|
+
<p>
|
|
129
|
+
{{ _('Final coverage metrics were calculated for genes from the clinical panels') }}:
|
|
130
|
+
<code>{{ config.CHANJO_PANEL_NAME }}</code>.
|
|
131
|
+
{{ _('Note that estimations were made regarding coverage and completeness') }}
|
|
132
|
+
{{ _('on the level of transcripts') }}.
|
|
133
|
+
</p>
|
|
134
|
+
{% endif %}
|
|
135
|
+
|
|
136
|
+
<p>
|
|
137
|
+
<strong>{{ _('Completeness') }}</strong>:
|
|
138
|
+
{{ _('defined as the ratio of bases') }}
|
|
139
|
+
{{ _('sequenced deeper than a specified cutoff') }},
|
|
140
|
+
{{ _('e.g. 10x') }}.
|
|
141
|
+
</p>
|
|
142
|
+
|
|
143
|
+
<p>
|
|
144
|
+
<strong>{{ _('Transcript coverage') }}</strong>:
|
|
145
|
+
{{ _('defined as the ratio of transcripts that are fully covered') }},
|
|
146
|
+
{{ _('i.e. with a completeness of') }} 100% {{ _('at') }} {{ cutoff }}x.
|
|
147
|
+
</p>
|
|
148
|
+
|
|
149
|
+
<p>
|
|
150
|
+
<strong>{{ _('Gender prediction from data') }}</strong>:
|
|
151
|
+
{{ _('calculated by comparing relative chromosome coverage') }}
|
|
152
|
+
(X/Y).
|
|
153
|
+
{{ _('Some reads randomly map to the Y chromosome') }}.
|
|
154
|
+
{{ _('Therefore, a less than 10 fold difference is used to infer a "male" sample') }}.
|
|
155
|
+
</p>
|
|
156
|
+
{% endmacro %}
|
|
157
|
+
|
|
158
|
+
{% if gene_id_errors %}
|
|
159
|
+
<span style="background-color:#d9534f;color:white;">Gene list should contain comma-separated HGNC numerical identifiers, not strings. Unsupported gene identifiers: {{gene_id_errors}} were not taken into account.</span>
|
|
160
|
+
{% endif %}
|
|
161
|
+
|
|
162
|
+
<h2>{{ _('Quality report') }}: {{ _('clinical sequencing') }}</h2>
|
|
163
|
+
{% if extras.panel_name %}
|
|
164
|
+
<p>{{ _('Based on gene panel') }}: <strong>{{ extras.panel_name }}</strong></p>
|
|
165
|
+
{% endif %}
|
|
166
|
+
{{ overview_table(sex_rows) }}
|
|
167
|
+
|
|
168
|
+
<h3>{{ _('Generally important metrics') }}</h3>
|
|
169
|
+
{{ metrics_table(metrics_rows) }}
|
|
170
|
+
|
|
171
|
+
<h3>{{ _('Transcript coverage') }} {{ _('at') }}: {{ extras.level }}x</h3>
|
|
172
|
+
{{ transcripts_table(tx_rows) }}
|
|
173
|
+
|
|
174
|
+
<h3>{{ _('Explanations') }}</h3>
|
|
175
|
+
{{ explanations(extras.level) }}
|
|
176
|
+
|
|
177
|
+
<hr>
|
|
178
|
+
<div class="text-center">{{ _('End of report') }}</div>
|