diff --git a/CRISPRessoReport.py b/CRISPRessoReport.py deleted file mode 100644 index 58cf42ac..00000000 --- a/CRISPRessoReport.py +++ /dev/null @@ -1,690 +0,0 @@ -''' -CRISPResso2 - Kendell Clement and Luca Pinello 2018 -Software pipeline for the analysis of genome editing outcomes from deep sequencing data -(c) 2020 The General Hospital Corporation. All Rights Reserved. -''' - -import os -from jinja2 import Environment, FileSystemLoader -from jinja_partials import generate_render_partial, render_partial -from CRISPResso2 import CRISPRessoShared - - -def render_template(template_name, jinja2_env, **data): - """Render a template with partials. - - Parameters - ---------- - template_name: str - The name of the template to render. For example, if you have a template - file called `templates/my_template.html` you would pass in - `my_template.html`. - jinja2_env: jinja2.Environment - The Jinja2 environment being used. - **data: keyword arguments of any type - Additional keyword arguments that are passed to the template. - - Returns - ------- - The rendered template. - """ - def custom_partial_render(partial_template_name, **partial_data): - template = jinja2_env.get_template(partial_template_name) - partial_data.update( - render_partial=generate_render_partial( - custom_partial_render, - ), - ) - return template.render(**partial_data) - return render_partial( - template_name, custom_partial_render, **data, - ) - - -def make_report_from_folder(crispresso_report_file, crispresso_folder, _ROOT): - """ - Makes an html report for a crispresso run - - Parameters: - crispresso_report_file (string): name of the html file to create - crispresso_folder (string): path to the crispresso output - _ROOT (string): path to crispresso executables (for templates) - - Returns: - Nothin - """ - run_data = CRISPRessoShared.load_crispresso_info(crispresso_folder) - make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT) - - -def add_fig_if_exists(fig_name, fig_root, fig_title, fig_caption, fig_data, - amplicon_fig_names, amplicon_figures, crispresso_folder): - """ - Helper function to add figure if the file exists - if fig at filename exists, - amplicon_figs[figname] is set to that file - """ - # fullpath=os.path.join(crispresso_folder,fig_root+'.png') - pngfullpath = os.path.join(crispresso_folder, fig_root + '.png') - htmlfullpath = os.path.join(crispresso_folder, fig_root + '.html') - # print('adding file ' + fig_root + ' at ' + fullpath) - if os.path.exists(pngfullpath) or os.path.exists(htmlfullpath): - amplicon_fig_names.append(fig_name) - # amplicon_fig_locs[fig_name]=os.path.basename(fig_root+'.png') - amplicon_figures['locs'][fig_name] = os.path.basename(fig_root) - amplicon_figures['titles'][fig_name] = fig_title - amplicon_figures['captions'][fig_name] = fig_caption - amplicon_figures['datas'][fig_name] = [] - for (data_caption, data_file) in fig_data: - if os.path.exists(os.path.join(crispresso_folder, data_file)): - amplicon_figures['datas'][fig_name].append((data_caption, data_file)) - if os.path.exists(htmlfullpath): - with open(htmlfullpath) as html: - html_string = "
Data: {{data_label}}
- #} -Data: {{data_label}}
- {% endfor %} -Data: {{data_label}}
- {% endfor %} -Data: {{data_label}}
- #} -Reads are aligned to each amplicon sequence separately. Quantification and visualization of these reads are shown for each amplicon below:
-Data: {{data_label}}
- {% endfor %} - {% else %} - {% if 'htmls' in report_data['figures'] and fig_name in report_data['figures']['htmls'] %} - {{report_data['figures']['htmls'][fig_name]|safe}} - {% else %} - {% if fig_name in ['plot_1a', 'plot_1b', 'plot_1c', 'plot_3a', 'plot_4a', 'plot_4b', 'plot_4c'] %} - - {% else %} - - {% endif %} - {% endif %} - - {% for (data_label,data_path) in report_data['figures']['datas'][fig_name] %} -Data: {{data_label}}
- {% endfor %} - {% endif %} -Data: {{data_label}}
- {% endfor %} -CRISPResso version: {{report_data['run_data']['running_info']['version']}}
-Run completed: {{report_data['run_data']['running_info']['end_time_string']}}
-Amplicon sequence:
{{report_data['run_data']['running_info']['args']['amplicon_seq']}}- {% if report_data['run_data']['running_info']['args']['guide_seq'] != '' %} -
Guide sequence:
{{report_data['run_data']['running_info']['args']['guide_seq']}}- {% endif %} -
Command used:
{{report_data['run_data']['running_info']['command_used']}}-
Parameters:
{{report_data['run_data']['running_info']['args_string']}}- -
Data: {{data_label}}
- #} -