<div class="structure">
  {% if region.has_any_polymer() %}
    <div class="heading">
      <span>Predicted core structure(s)</span>
      {{help_tooltip(tooltip, "nrps-structures")}}
    </div>
    {% for candidate in region.candidate_clusters %}
      {% if candidate.smiles or candidate.polymer %}
        <div>
          <div class="prediction-text">
            For candidate cluster {{candidate.number}}, location {{candidate.location.start}} - {{candidate.location.end}}:
          {{collapser_start("CC%s" % candidate.number, level="candidate")}}
          {% if candidate.smiles %}
            <canvas id="smiles-canvas-{{region.anchor_id}}-{{candidate.number}}" class="smiles-canvas" data-smiles="{{candidate.smiles}}"></canvas>
            <div class="as-structure-warning">
              {{candidate.get_warning()}}
            </div>
          {% endif %}
          {% if candidate.polymer %}
            <div>
              <dl>
                <dt><b>Polymer prediction:</b></dt><dd>{{candidate.polymer}}</dd>
                {% if candidate.domain_docking_used and candidate.ordering %}
                    <dt><b>Non-colinear ordering:</b></dt><dd>
                    {% for name in candidate.ordering %}
                        {% if not loop.first %} + {% endif %}<span class="serif">{{name}}</span>
                    {% endfor %}
                    </dd>
                {% endif %}
              </dl>
              <br>Direct lookup in NORINE database:
              <a class="external-link" href="{{candidate.get_norine_url()}}" target="_new">strict</a>
                or
              <a class="external-link" href="{{candidate.get_norine_url(be_strict = False)}}" target="_new">relaxed</a><br>
            </div>
            {% endif %}
            {{collapser_end()}}
            </div>
        </div>
        {% if candidate.smiles %}
            <div id="smiles-canvas-{{region.anchor_id}}-{{candidate.number}}-modal" class="modal-container">
              <div class="modal-content">
                <canvas class="smiles-canvas-modal" data-smiles="{{candidate.smiles}}"></canvas>
              </div>
            </div>
        {% endif %}
      {% if loop.index < region.candidate_clusters | length %}
        <hr>
      {% endif %}
      {% endif %}
    {% endfor %}
    <div class="prediction-text">
      <br>
      <a class="external-link" href="http://bioinfo.lifl.fr/norine/form2.jsp" target="_new">Link to NORINE database query form</a>
    </div>
  {% endif %}
</div>
