{% macro render(result) -%}
  <article>
    <details open>
      <summary class="none">
        <div class="row">
          <div class="max">
            <h5>{{ result.therapy.name }}</h5>
          </div>
          <i>arrow_drop_down</i>
        </div>
      </summary>
      <h6>Variant description</h6>
      <p>DNA: <a class="link" target="_blank" href="https://mutalyzer.nl/normalizer/{{ result.therapy.hgvsc}}">{{ result.therapy.hgvsc }}</a></p>
      {% if result.therapy.hgvsr is not none %}
      <p>RNA: <a class="link" target="_blank" href="https://mutalyzer.nl/normalizer/{{ result.therapy.hgvsr}}">{{ result.therapy.hgvsr }}</a></p>
      {% endif %}
      {% if result.therapy.hgvsp is not none %}
      <p>Protein: <a class="link" target="_blank" href="https://mutalyzer.nl/normalizer/{{ result.therapy.hgvsp}}">{{ result.therapy.hgvsp }}</a></p>
      {% endif %}
      <h6>Therapy description</h6>
      <p>{{ result.therapy.description}}
      {% if result.therapy.figure is not none %}
        <h6>Transcript visualization</h6>
        Visualization of the input variants and exons (with reading frames), generated with <a href="https://exonviz.rnatherapy.nl" class="link" target="_blank">ExonViz</a>.
        {{ result.therapy.figure }}
      {% endif %}
      <h6>Annotation overview</h6>
      <table>
        <thead>
          <tr>
            <th>Annotation</th>
            <th>Remaining</th>
            <th>Basepairs</th>
            <th>Percentage</th>
          </tr>
        </thead>
        <tbody>
          {% for comp in result.comparison %}
          {% set value = (comp.percentage * 100) | round(precision=1) %}
          <tr>
            <td>{{ comp.name }}</td>
            <td>{{ value }}% </td>
            <td>{{ comp.basepairs }}
            <td><progress value="{{value}}" max="100"></progress></td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </details>
  </article>
{%- endmacro %}
{% if results is defined %}
  <div id="results" class="page padding active">
    <h2> Analysis results for {{ variant }}</h2>
    <p> GTGT analysis results for both the input variants and the wildtype version of the transcript. By definition, the <em>Remaining</em> percentage of the wildtype transcript is always 100%.</p>
      {% for result in results.input%}
        {{ render(result) }}
      {% endfor %}
    <h2>Variant-modifying therapies</h2>
    <p>This section contains analysis results for therapies which directly modify or remove the specified input variants.</p>
    {% for result in results.modified %}
      {{ render(result) }}
    {% endfor %}
    <h2>Other therapies</h2>
    <p>This section contains therapies which do not directly change any of the specified input variants.</p>
    {% for result in results.all %}
      {{ render(result) }}
    {% endfor %}
  </div>
{% else %}
  <div id="results" class="page padding">
    <h5> Analysis results for {{ variant }}</h5>
    Please specify a variant to analyze.
  </div>
{% endif %}
