<commit_before>{% extends "layout.html" %}
{% from "utils.html" import comments_table, pedigree_panel %}
{% from "variants/components.html" import external_scripts, external_stylesheets, gene_cell, frequency_cell_general %}
{% from "variant/buttons.html" import reviewer_button%}

{% from "variants/utils.html" import cell_rank, dismiss_variants_block, filter_form_footer, update_stash_filter_button_status, pagination_footer, pagination_hidden_div, str_filters, filter_script_main %}

{% block title %}
  {{ super() }} - {{ institute.display_name }} - {{ case.display_name }} - STR variants
{% endblock %}

{% block css %}
{{ super() }}
  {{ external_stylesheets() }}
{% endblock %}

{% block top_nav %}
  {{ super() }}
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('cases.index') }}">Institutes</a>
  </li>
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('overview.cases', institute_id=institute._id) }}">
      {{ institute.display_name }}
    </a>
  </li>
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('cases.case', institute_id=institute._id, case_name=case.display_name) }}">
      {{ case.display_name }}
    </a>
  </li>
  <li class="nav-item active d-flex align-items-center">
    <span class="navbar-text">{{ form.variant_type.data|capitalize }} STRs</span>
  </li>
{% endblock %}

{% block top_nav_right %}
  {{ super() }}
{% endblock %}

{% block content_main %}
<div class="container-float">
  <form method="POST" id="filters_form" action="{{url_for('variants.str_variants', institute_id=institute._id, case_name=case.display_name)}}"
     enctype="multipart/form-data" onsubmit="return validateForm()">
     {{ pagination_hidden_div(page) }}
    <div class="card panel-default" id="accordion">
      <div class="card-header">
        <strong><a data-bs-toggle="collapse" data-parent="#accordion" href="#collapseFilters">Filters</a></strong>
      </div>
      <!--Expand filters form if filters were used in a previous POST request-->
      <div class="card-body panel-collapse collapse {{ 'show' if expand_search is sameas true }}" id="collapseFilters">
          {{ str_filters(form, institute, case) }}
      </div>
      {{ filter_form_footer(form, result_size, total_variants, more_variants, page, variants|length, institute) }}
    </div>
  </form>
  <div class="card mt-3">
    <table class="table table-bordered table-hover" style="table-layout: fixed">
      <thead class="thead table-light">
        <tr>
          <th style="width:8%" title="Index">Index</th>
          <th title="Repeat ID">Repeat locus</th>
          <th title="Repeat unit">Reference repeat unit</th>
          <th title="ALT">Estimated size</th>
          <th title="ReferenceSize">Reference size</th>
          <th title="Status">Status</th>
          <th title="GT">Genotype</th>
          <th title="Chromosome">Chr.</th>
          <th title="Position" style="width:20%">Position</th>
        </tr>
      </thead>
      <tbody>
        {% set ns = namespace(allele0='') %}
        {% for variant in variants %}
          {% if variant.chromosome + variant.position|string != ns.allele0 %}
            <tr style="height:10px;"></tr>
          {% endif %}
          {% set ns.allele0 = variant.chromosome + variant.position|string %}
          {% if variant.dismiss_variant %}
              <tr class="dismiss">
          {% elif 'causatives' in case and variant._id in case.causatives %}
             <tr class="causative">
          {% elif variant.str_status == 'normal' %}
              <tr class="{% if loop.index0 % 2 %}even{% else %}odd{% endif %}">
          {% elif variant.str_status == 'full_mutation' %}
              <tr class="bg-danger">
          {% elif variant.str_status == 'pre_mutation' %}
              <tr class="bg-warning">
	        {% else %}
	            <tr>
	        {% endif %}
            <td class="str-link">{{ cell_rank(variant, institute, case, form, manual_rank_options) }}</td>
            <td class="str-link">{{ str_locus_info(variant) }}</td>
	          <td class="text-end">{{ variant.str_display_ru or variant.str_ru  }}</td>
            <td class="text-end"><b>{{ variant.alternative|replace("STR", "")|replace("<", "")|replace(">", "") }}</b></td>
            <td class="text-end">{{ variant.str_ref }}</td>
            <td>{{ str_status(variant) }}</td>
            <td>{% for sample in variant.samples %}
                  {% if sample.genotype_call != "./." %}
                    <div class="float-start">{{ sample.display_name }}</div>
                    <div class="float-end">{{ sample.genotype_call }}</div><br>
                  {% endif %}
                {% endfor %}
            </td>
            <td>{{ variant.chromosome }}</td>
            <td>
              {{ variant.position }}
              {{ reviewer_button(case,variant,case_groups,institute._id) }}
              {% if case.bam_files %}
                <a class="btn btn-secondary btn-sm text-white" href="{{url_for('alignviewers.igv', institute_id=institute['_id'], case_name=case['display_name'], variant_id=variant['_id'])}}" target="_blank">IGV viewer</a>
              {% else %}
                <button title="BAM file(s) missing" class="btn btn-secondary btn-sm" disabled>IGV viewer</button>
              {% endif %}
            </td>
        </tr>
        {% else %}
          <tr>
            <td colspan="9">
              No matching variants
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div> <!-- end of class="container-float"> -->
<div class="container-fluid">
  {{ pagination_footer(more_variants, page) }}
</div>
<!--  Pedigree_panel -->
{% set has_pedigree = case.madeline_info and case.individuals|length > 1 %}
{% if has_pedigree %}
  <div class="row">
    <div class="col-md-4">{{ pedigree_panel(case) }}</div>
  </div>
{% endif %}
{% endblock %}
<commit_msg>Please sonarcloud - and ok, fine, perhaps IGV would link on<commit_after>{% extends "layout.html" %}
{% from "utils.html" import comments_table, pedigree_panel %}
{% from "variants/components.html" import external_scripts, external_stylesheets, gene_cell, frequency_cell_general %}
{% from "variant/buttons.html" import reviewer_button%}

{% from "variants/utils.html" import cell_rank, dismiss_variants_block, filter_form_footer, update_stash_filter_button_status, pagination_footer, pagination_hidden_div, str_filters, filter_script_main %}

{% block title %}
  {{ super() }} - {{ institute.display_name }} - {{ case.display_name }} - STR variants
{% endblock %}

{% block css %}
{{ super() }}
  {{ external_stylesheets() }}
{% endblock %}

{% block top_nav %}
  {{ super() }}
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('cases.index') }}">Institutes</a>
  </li>
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('overview.cases', institute_id=institute._id) }}">
      {{ institute.display_name }}
    </a>
  </li>
  <li class="nav-item">
    <a class="nav-link text-nowrap" href="{{ url_for('cases.case', institute_id=institute._id, case_name=case.display_name) }}">
      {{ case.display_name }}
    </a>
  </li>
  <li class="nav-item active d-flex align-items-center">
    <span class="navbar-text">{{ form.variant_type.data|capitalize }} STRs</span>
  </li>
{% endblock %}

{% block top_nav_right %}
  {{ super() }}
{% endblock %}

{% block content_main %}
<div class="container-float">
  <form method="POST" id="filters_form" action="{{url_for('variants.str_variants', institute_id=institute._id, case_name=case.display_name)}}"
     enctype="multipart/form-data" onsubmit="return validateForm()">
     {{ pagination_hidden_div(page) }}
    <div class="card panel-default" id="accordion">
      <div class="card-header">
        <strong><a data-bs-toggle="collapse" data-parent="#accordion" href="#collapseFilters">Filters</a></strong>
      </div>
      <!--Expand filters form if filters were used in a previous POST request-->
      <div class="card-body panel-collapse collapse {{ 'show' if expand_search is sameas true }}" id="collapseFilters">
          {{ str_filters(form, institute, case) }}
      </div>
      {{ filter_form_footer(form, result_size, total_variants, more_variants, page, variants|length, institute) }}
    </div>
  </form>
  <div class="card mt-3">
    <table class="table table-bordered table-hover" style="table-layout: fixed">
      <thead class="thead table-light">
        <tr>
          <th style="width:8%" title="Index">Index</th>
          <th title="Repeat ID">Repeat locus</th>
          <th title="Repeat unit">Reference repeat unit</th>
          <th title="ALT">Estimated size</th>
          <th title="ReferenceSize">Reference size</th>
          <th title="Status">Status</th>
          <th title="GT">Genotype</th>
          <th title="Chromosome">Chr.</th>
          <th title="Position" style="width:20%">Position</th>
        </tr>
      </thead>
      <tbody>
        {% set ns = namespace(allele0='') %}
        {% for variant in variants %}
          {% if variant.chromosome + variant.position|string != ns.allele0 %}
            <tr style="height:10px;"></tr>
          {% endif %}
          {% set ns.allele0 = variant.chromosome + variant.position|string %}
          {% if variant.dismiss_variant %}
              <tr class="dismiss">
          {% elif 'causatives' in case and variant._id in case.causatives %}
             <tr class="causative">
          {% elif variant.str_status == 'normal' %}
              <tr class="{% if loop.index0 % 2 %}even{% else %}odd{% endif %}">
          {% elif variant.str_status == 'full_mutation' %}
              <tr class="bg-danger">
          {% elif variant.str_status == 'pre_mutation' %}
              <tr class="bg-warning">
	        {% else %}
	            <tr>
	        {% endif %}
            <td class="str-link">{{ cell_rank(variant, institute, case, form, manual_rank_options) }}</td>
            <td class="str-link">{{ str_locus_info(variant) }}</td>
	          <td class="text-end">{{ variant.str_display_ru or variant.str_ru  }}</td>
            <td class="text-end"><b>{{ variant.alternative|replace("STR", "")|replace("<", "")|replace(">", "") }}</b></td>
            <td class="text-end">{{ variant.str_ref }}</td>
            <td>{{ str_status(variant) }}</td>
            <td>{% for sample in variant.samples %}
                  {% if sample.genotype_call != "./." %}
                    <div class="float-start">{{ sample.display_name }}</div>
                    <div class="float-end">{{ sample.genotype_call }}</div><br>
                  {% endif %}
                {% endfor %}
            </td>
            <td>{{ variant.chromosome }}</td>
            <td>
              {{ variant.position }}
              {{ reviewer_button(case,variant,case_groups,institute._id) }}
              {% if case.bam_files %}
                <a class="btn btn-secondary btn-sm text-white" href="{{url_for('alignviewers.igv', institute_id=institute['_id'], case_name=case['display_name'], variant_id=variant['_id'])}}" rel="noopener" target="_blank">IGV viewer</a>
              {% else %}
                <button title="BAM file(s) missing" class="btn btn-secondary btn-sm" disabled>IGV viewer</button>
              {% endif %}
            </td>
        </tr>
        {% else %}
          <tr>
            <td colspan="9">
              No matching variants
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div> <!-- end of class="container-float"> -->
<div class="container-fluid">
  {{ pagination_footer(more_variants, page) }}
</div>
<!--  Pedigree_panel -->
{% set has_pedigree = case.madeline_info and case.individuals|length > 1 %}
{% if has_pedigree %}
  <div class="row">
    <div class="col-md-4">{{ pedigree_panel(case) }}</div>
  </div>
{% endif %}
{% endblock %}

{'fraction_non_alphanumeric': 0.1795022207324227, 'fraction_numerical': 0.002346434257940166, 'mean_word_length': 2.7492931196983976, 'pattern_counts': {'":': 0, '<': 223, '<?xml version=': 0, '>': 227, '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': '679766', 'n_tokens_mistral': 3941, 'n_tokens_neox': 3636, 'n_words': 760}