Skip to content

Commit

Permalink
Squashed 'CRISPRessoWEB/CRISPRessoReports/' content from commit 7d9b4e5
Browse files Browse the repository at this point in the history
git-subtree-dir: CRISPRessoWEB/CRISPRessoReports
git-subtree-split: 7d9b4e5
  • Loading branch information
Snicker7 committed Sep 13, 2022
1 parent aa5071c commit 84174e6
Show file tree
Hide file tree
Showing 12 changed files with 1,617 additions and 12 deletions.
18 changes: 6 additions & 12 deletions CRISPRessoReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'''

import os
from jinja2 import Environment, FileSystemLoader, ChoiceLoader
from jinja2 import Environment, FileSystemLoader
from jinja_partials import generate_render_partial, render_partial
from CRISPResso2 import CRISPRessoShared

Expand Down Expand Up @@ -163,11 +163,7 @@ def make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT, web_
'crispresso_data_path': crispresso_data_path,
}

loader1 = FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates'))
loader2 = FileSystemLoader(os.path.join(_ROOT, 'templates'))
loader = ChoiceLoader([loader1, loader2])

j2_env = Environment(loader=loader)
j2_env = Environment(loader=FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates')))

# dest_dir = os.path.dirname(crispresso_report_file)
# shutil.copy2(os.path.join(_ROOT,'templates','CRISPResso_justcup.png'),dest_dir)
Expand Down Expand Up @@ -477,12 +473,9 @@ def fill_default(dictionary, key, default_type=list):
if key not in dictionary:
dictionary[key] = default_type()

loader1 = FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates'))
loader2 = FileSystemLoader(os.path.join(_ROOT, 'templates'))
loader = ChoiceLoader([loader1, loader2])

j2_env = Environment(loader=loader)

j2_env = Environment(
loader=FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates')),
)
j2_env.filters['dirname'] = dirname
if crispresso_tool == 'batch':
template = 'batchReport.html'
Expand Down Expand Up @@ -536,6 +529,7 @@ def fill_default(dictionary, key, default_type=list):
'titles': summary_plots['titles'],
'labels': summary_plots['labels'],
'datas': summary_plots['datas'],
'htmls': [],
'crispresso_data_path': crispresso_data_path,
},
run_names=run_names,
Expand Down
Binary file added templates/CRISPResso_justcup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
163 changes: 163 additions & 0 deletions templates/batchReport.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{% extends "layout.html" %}
{% block head %}
<style>
.nav-tabs.amp-header {
border-bottom:none !important;
}

.card-header.amp-header {
border-bottom:none !important;
}
.nav-tabs.amp-header .nav-link.active {
background-color:lightsteelblue;
border-bottom:lightsteelblue;
}

.tab-content.amp-body {
background-color:lightsteelblue;
}

@media print {
.tab-content > .tab-pane {
display: block !important;
opacity: 1 !important;
visibility: visible !important;
margin-bottom: 2em !important;
page-break-inside: avoid;
}
.nav-tabs {
display:none !important;
visibility:hidden !important;
}
.tab-content.amp-body {
background-color:transparent !important;
border:None !important;
}
}
@media only screen and (max-width: 600px) {
.jumbotron img {
width:100%
}
}
</style>

{% endblock %}

{% block content %}
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-10">

<div class="jumbotron" style="background:rgba(0,0,0,0.0); padding:0px" >
<div id='jumbotron_content' >

{% if run_names|length > 0 %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5 id="CRISPResso2_Batch_Output">{{report_name}}</h5>
</div>
<div class='card-body p-0'>
<div class="list-group list-group-flush">
{% for run_name in run_names %}
<a href="{{sub_html_files[run_name]}}" class="list-group-item list-group-item-action" id="{{run_name}}">{{run_name}}</a>
{% endfor %}
</div>
</div>
</div>
{% endif %}

{% if window_nuc_pct_quilts|length > 0 %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5>Nucleotide percentages around guides</h5>
</div>
<div class='card-body'>
{% for plot_name in window_nuc_pct_quilts %}
<h5>{{report_data['titles'][plot_name]}}</h5>
{{ render_partial('shared/partials/fig_summaries.html', report_data=report_data, plot_name=plot_name) }}
{% endfor %}
</div>
</div>
{% endif %}

{% if nuc_pct_quilts|length > 0 %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5>Nucleotide percentages in the entire amplicon</h5>
</div>
<div class='card-body'>
{% for plot_name in nuc_pct_quilts %}
<h5>{{report_data['titles'][plot_name]}}</h5>
{{ render_partial('shared/partials/fig_summaries.html', report_data=report_data, plot_name=plot_name) }}
{% endfor %}
</div>
</div>
{% endif %}

{% if window_nuc_conv_plots|length > 0 %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5>Conversion of target bases around guides</h5>
</div>
<div class='card-body'>
{% for plot_name in window_nuc_conv_plots %}
<h5>{{report_data['titles'][plot_name]}}</h5>
{{ render_partial('shared/partials/fig_summaries.html', report_data=report_data, plot_name=plot_name) }}
{% endfor %}
</div>
</div>
{% endif %}

{% if nuc_conv_plots|length > 0 %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5>Conversion of target bases in the entire amplicon</h5>
</div>
<div class='card-body'>
{% for plot_name in nuc_conv_plots %}
<h5>{{report_data['titles'][plot_name]}}</h5>
{{ render_partial('shared/partials/fig_summaries.html', report_data=report_data, plot_name=plot_name) }}
{% endfor %}
</div>
</div>
{% endif %}

{% if report_data['names']|length > 0 %}
{% for plot_name in report_data['names'] %}
<div class='card text-center mb-2'>
<div class='card-header'>
<h5>{{report_data['titles'][plot_name]}}</h5>
</div>
<div class='card-body'>
{{ render_partial('shared/partials/fig_summaries.html', report_data=report_data, plot_name=plot_name) }}
</div>
</div>
{% endfor %}
{% endif %}


</div>

</div>

<div align="center" class='p-3'>
<a href="/reports_data/{{report_zip_filename}}" class="btn btn-primary" role="button"><i class="fas fa-download"></i> Download report</a>
<a href="{{report_path}}" class="btn btn-primary" role="button"><i class="fas fa-link"></i> Link to report</a>
<button class='btn btn-primary hidden-print' onclick='window.print();'><i class="fas fa-print"></i> Print</button>
</div>

{# data bit for web version: #}
{#
<p class="m-0"><small>Data: <a href="{{report_data['crispresso_data_path']}}{{data_path}}">{{data_label}}</a> <a href="{{report_data['crispresso_data_path']}}{{data_path}}" title="{{data_label}}" download> <span class="fas fa-download" data-toggle='tooltip' title='Download {{data_label}}'><span></a></small></p>
#}
</div> {# jumbotron_content #} <!-- end jumbotron_content -->
</div> {# jumbrotron #} <!-- end jumbotron -->

</div> {# column #} <!-- end column -->

<div class="col-sm-1"></div>
</div>
{% endblock %}

{% block foot %}
{% endblock %}
Binary file added templates/favicon.ico
Binary file not shown.
Loading

0 comments on commit 84174e6

Please sign in to comment.