{% macro compounds_table(institute, case, compounds) %}
  <table class='table table-bordered table-hover table-condensed'>
    <thead>
      <tr>
        <th>Variant</th>
        <th>Combined score</th>
        <th>Rank score</th>
        <th>Gene annotation</th>
        <th>Func. annotation</th>
      </tr>
    </thead>
    <tbody>
      {% for compound in compounds %}
        <tr>
          <td>
            {% if compound.not_loaded %}
              {{ compound.display_name }} <small>(not loaded)</small>
            {% else %}
              <a href='{{ url_for("variants.variant",
                                 institute_id=institute._id,
                                 case_name=case.display_name,
                                 variant_id=compound.variant) }}'>
                {{ compound.display_name|truncate(20, True) }}
              </a>
            {% endif %}
          </td>
          <td class='text-right'>{{ compound.combined_score }}</td>
          <td class='text-right'>{{ compound.rank_score }}</td>
          <td>
            {% for annotation in compound.region_annotations %}
              {{ annotation }}<br>
            {% endfor %}
          </td>
          <td>
            {% for annotation in compound.functional_annotations %}
              {{ annotation }}<br>
            {% endfor %}
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endmacro %}

{% macro svs_table(institute, case, overlapping) %}
  <table class='table table-bordered table-hover table-condensed'>
    <thead>
      <tr>
        <th>Region</th>
        <th>Type</th>
        <th>Length</th>
        <th>Rank score</th>
      </tr>
    </thead>
    <tbody>
      {% for sv in overlapping %}
        <tr>
          <td>
              <a href='{{ url_for("variants.sv_variant",
                                 institute_id=institute._id,
                                 case_name=case.display_name,
                                 variant_id=sv._id) }}'>
                {{ sv.chromosome }}{{ sv.cytoband_start }}
              </a>
          </td>
          <td class='text-right'>{{ sv.sub_category }}</td>
          <td class='text-right'>{{ sv.length if sv.length < 100000000000 else "-" }}</td>
          <td class='text-right'>{{ sv.rank_score }}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endmacro %}
