{# ========== MACROS ========== #} {% macro render_metrics(metrics) %}
{% for m in metrics %}
{{ m.value }}
{{ m.label }}
{% endfor %}
{% endmacro %} {% macro render_table(headers, rows, caption='') %} {% for h in headers %} {% endfor %} {% for row in rows %} {% for cell in row %} {% endfor %} {% endfor %}
{{ h }}
{{ cell }}
{% if caption %}
{{ caption }}
{% endif %} {% endmacro %} {% macro render_plot(plot_id, data, xlabel, ylabel, color='#3498db') %} {% if data and data.bins and data.counts %}
{% else %}

No data available

{% endif %} {% endmacro %} {% macro render_file_list(files) %} {% endmacro %} {% macro format_enzyme_site(site, cut_offset) %} {{ site[:cut_offset] }}|{{ site[cut_offset:] }} {% endmacro %} {# ========== REPORT CONTENT ========== #}

CiFi {{ report_type }} Report - {{ enzyme }}

{{ input_file }} | {{ timestamp }}
{% if report_type == 'QC' %} {# ========== QC REPORT ========== #}

Summary

{{ render_metrics(summary_metrics) }}

Enzyme Analysis

{{ render_table(['Metric', 'Value'], enzyme_table) }} {% if read_length_histogram %}

Read Length Distribution

{{ render_plot('read-length-plot', read_length_histogram, 'Length (bp)', 'Count', '#3498db') }} {% endif %} {% if sites_histogram %}

Sites per Read Distribution

{{ render_plot('sites-plot', sites_histogram, 'Number of Sites', 'Count', '#27ae60') }} {% endif %} {% if fragment_size_histogram %}

Fragment Size Distribution

{{ render_plot('frag-size-plot', fragment_size_histogram, 'Fragment Size (bp)', 'Count', '#9b59b6') }} {% endif %}

Recommended Command

cifi digest {{ input_file }} -e {{ enzyme }} -o output
{% else %} {# ========== DIGEST REPORT ========== #}

Parameters

{{ render_table(['Parameter', 'Value'], param_table) }}

Summary

{{ render_metrics(summary_metrics) }} {% if filter_table %}

Filtering Breakdown

{{ render_table(['Filter Reason', 'Reads Filtered', '% of Input'], filter_table, filter_caption) }} {% endif %} {% if frag_stats_table %}

Fragment Statistics

{{ render_table(['Metric', 'Value'], frag_stats_table) }} {% endif %} {% if fragment_length_histogram %}

Fragment Length Distribution

{{ render_plot('frag-length-plot', fragment_length_histogram, 'Length (bp)', 'Count', '#27ae60') }} {% endif %} {% if sites_per_read_histogram %}

Sites per Read Distribution

{{ render_plot('sites-per-read-plot', sites_per_read_histogram, 'Number of Sites', 'Count', '#3498db') }} {% endif %}

Output Files

{{ render_file_list(output_files) }} {% endif %}