<commit_before>[% MACRO genome_coverage_on_window_load BLOCK %]

    ctx2 = document.getElementById("chart-area-genome-coverage-regulatory-build").getContext("2d");
    window.myPie = new Chart(ctx2, genome_coverage_regulatory_build_config);

[% END %]

[% MACRO genome_coverage BLOCK %]

<h3>Genome coverage</h3>

[% 
    total_covered_by_regulatory_features
    = 
        regulatory_build_statistics_adaptor.fetch_sum_length_ctcf_binding_site.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_enhancer.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_promoter_flanking_region.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_promoter.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_transcription_factor_binding_site.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_open_chromatin.value
%]

<p>
   The regulatory features cover 
    [% 
        round_num(
            (100 * total_covered_by_regulatory_features) / ref_length 
        )
    %]% of the genome.
</p>

<div id="canvas-holder" style="width:50%">
    <canvas id="chart-area-genome-coverage-regulatory-build" />
</div>

<script>

var genome_coverage_regulatory_build_config = {
    type: 'pie',
    data: {
        datasets: [{
            data: [

                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_ctcf_binding_site.value                 / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_enhancer.value                          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_promoter_flanking_region.value          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_promoter.value                          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_transcription_factor_binding_site.value / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_open_chromatin.value                    / ref_length ) %],
                [% 
                    round_num(
                        100 * (
                            ref_length
                            - total_covered_by_regulatory_features
                        ) / ref_length 
                    )
                %]

            ],
            backgroundColor: [
                window.chartColors.red,
                window.chartColors.orange,
                window.chartColors.yellow,
                window.chartColors.green,
                window.chartColors.blue,
                window.chartColors.purple,
                window.chartColors.gray,
            ],

        }],
        labels: [
            "CTCF Binding Site",
            "Enhancer",
            "Promoter Flanking Region",
            "Promoter",
            "TF binding site",
            "Open chromatin",
            "Not covered by regulatory build",
        ]
    },
    options: {
        responsive: true,
        legend: {
            position: 'left'
        },
        title: {
            display: 'true',
            text: 'Genome coverage of the Regulatory Build in [% species %]'
        },
        tooltips: {
            callbacks: {
                title: function(item, data) {
                    // Pick first xLabel for now
                    var title = '';

                    if (item.length > 0) {
                        if (item[0].yLabel) {
                            title = item[0].yLabel;
                        } else if (data.labels.length > 0 && item[0].index < data.labels.length) {
                            title = data.labels[item[0].index];
                        }
                    }

                    return title;
                },<commit_msg>Turned off title, because this is hard to edit, if the images should be reused elsewhere<commit_after>[% MACRO genome_coverage_on_window_load BLOCK %]

    ctx2 = document.getElementById("chart-area-genome-coverage-regulatory-build").getContext("2d");
    window.myPie = new Chart(ctx2, genome_coverage_regulatory_build_config);

[% END %]

[% MACRO genome_coverage BLOCK %]

<h3>Genome coverage</h3>

[% 
    total_covered_by_regulatory_features
    = 
        regulatory_build_statistics_adaptor.fetch_sum_length_ctcf_binding_site.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_enhancer.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_promoter_flanking_region.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_promoter.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_transcription_factor_binding_site.value
        + regulatory_build_statistics_adaptor.fetch_sum_length_open_chromatin.value
%]

<p>
   The regulatory features cover 
    [% 
        round_num(
            (100 * total_covered_by_regulatory_features) / ref_length 
        )
    %]% of the genome.
</p>

<div id="canvas-holder" style="width:50%">
    <canvas id="chart-area-genome-coverage-regulatory-build" />
</div>

<script>

var genome_coverage_regulatory_build_config = {
    type: 'pie',
    data: {
        datasets: [{
            data: [

                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_ctcf_binding_site.value                 / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_enhancer.value                          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_promoter_flanking_region.value          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_promoter.value                          / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_transcription_factor_binding_site.value / ref_length ) %],
                [% round_num( 100 * regulatory_build_statistics_adaptor.fetch_sum_length_open_chromatin.value                    / ref_length ) %],
                [% 
                    round_num(
                        100 * (
                            ref_length
                            - total_covered_by_regulatory_features
                        ) / ref_length 
                    )
                %]

            ],
            backgroundColor: [
                window.chartColors.red,
                window.chartColors.orange,
                window.chartColors.yellow,
                window.chartColors.green,
                window.chartColors.blue,
                window.chartColors.purple,
                window.chartColors.gray,
            ],

        }],
        labels: [
            "CTCF Binding Site",
            "Enhancer",
            "Promoter Flanking Region",
            "Promoter",
            "TF binding site",
            "Open chromatin",
            "Not covered by regulatory build",
        ]
    },
    options: {
        responsive: true,
        legend: {
            position: 'left'
        },
        title: {
            display: 'false',
            text: 'Genome coverage of the Regulatory Build in [% species %]'
        },
        tooltips: {
            callbacks: {
                title: function(item, data) {
                    // Pick first xLabel for now
                    var title = '';

                    if (item.length > 0) {
                        if (item[0].yLabel) {
                            title = item[0].yLabel;
                        } else if (data.labels.length > 0 && item[0].index < data.labels.length) {
                            title = data.labels[item[0].index];
                        }
                    }

                    return title;
                },
{'fraction_non_alphanumeric': 0.0859591630955382, 'fraction_numerical': 0.009326947315351651, 'mean_word_length': 1.6861882193635749, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2643702', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2155, 'n_words': 321}