{% extends "base.html" %} {% block content %}
{% if data['variants'] %}
<div class="row justify-content-center align-items-center">
    <table id="vcfreport" class="table table-bordered table-striped table-hover table-sm" cellspacing="0">
        <thead class="thead-light">
            <tr>
                <th scope="col">CHR</th>
                <th scope="col">GENE</th>
                <th scope="col">LOCUS</th>
                <th scope="col">PRODUCT</th>
                <th scope="col">TYPE</th>
                <th scope="col">EFFECT</th>
                <th scope="col">POS</th>
                <th scope="col">REF</th>
                <th scope="col">ALT</th>
                <th scope="col">BIOTYPE</th>
                <th scope="col">NUCLEOTIDE</th>
                <th scope="col">CONSEQUENCE</th>
                <th scope="col">IMPACT</th>
                <th scope="col">PATHWAY</th>
            </tr>
        </thead>
        <tbody>

            {% for item in data['variants'] %}
            <tr>
                <td>{{ item[16] or "NA" }}</td>
                <td>{{ item[3] or "NA" }}</td>
                <td>
                    {% if 'intergenic' in item[1] %}
                    <p>{{ item[4] }}</p>
                    {%else%}
                    <a href="https://explorer.sanbi.ac.za/gene?q={{ item[4] }}" target="_blank"
                        rel="noreferrer noopener">{{ item[4] }}</a>
                    {% endif %}
                </td>
                <td>
                    {% if item[21]['protein'] %}
                    <a href="https://explorer.sanbi.ac.za/search?q={{ item[21]['protein']['uniquename'] }}"
                        target="_blank" rel="noreferrer noopener">{{ item[21]['protein']['uniquename'] }}</a>
                    {% else %}
                    <p>{{ "NA" }}</p>
                    {% endif %}
                </td>
                <td>{{ item[19] or "NA" }}</td>
                <td>{{ item[1] or "NA" }}</td>
                <td>
                    <a href="https://explorer.sanbi.ac.za/jbrowse/?loc=NC_000962.3%3A{{ item[20] }}&tracks=DNA%2CGenes&highlight=NC_000962.3%3A{{ item[20] }}"
                        target="_blank" rel="noreferrer noopener">{{ item[17] }}</a>
                </td>
                <td>{{ item[18] or "NA" }}</td>
                <td>{{ item[0] or "NA" }}</td>
                <td>{{ item[7] or "NA" }}</td>
                <td>{{ item[9] or "NA" }}</td>
                <td>{{ item[10] or "NA" }}</td>
                <td>{{ item[2] or "NA" }}</td>
                <td>
                    {% if item[21]['pathway'] and item[21]['pathway']|length >= 1 %}
                    {% for pathway in item[21]['pathway'] %}
                    {% if pathway['accession'].startswith("mtu")%}
                    {% set url = "http://www.genome.jp/dbget-bin/www_bget?" %} {% else %}
                    {% set url = "https://reactome.org/content/detail/" %} {% endif %}
                    <p>
                        <small>
                            <a href="{{ url }}{{ pathway['accession'] }}" target="_blank"
                                rel="noreferrer noopener">{{ pathway['name'] }}</a>
                        </small>
                    </p>
                    {% endfor %} {% else %}
                    <p>{{ "NA" }}</p>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
        <tfoot class="thead-light">
            <tr>
                <th scope="col">CHR</th>
                <th scope="col">GENE</th>
                <th scope="col">LOCUS</th>
                <th scope="col">PRODUCT</th>
                <th scope="col">TYPE</th>
                <th scope="col">EFFECT</th>
                <th scope="col">POS</th>
                <th scope="col">REF</th>
                <th scope="col">ALT</th>
                <th scope="col">BIOTYPE</th>
                <th scope="col">NUCLEOTIDE</th>
                <th scope="col">CONSEQUENCE</th>
                <th scope="col">IMPACT</th>
                <th scope="col">PATHWAY</th>
            </tr>
        </tfoot>
    </table>
</div>
</main>
<div class="mt-5">
</div>
{% else %}
<div>
    <p>No variant data was found for this VCF file. Is it a <a href="http://snpeff.sourceforge.net/SnpEff_manual.html"
            target="_blank" rel="noreferrer noopener">SnpEff</a> annotated VCF file?</p>
    <p>Kindly check if the '<strong>ANN</strong>' field is present.</p>
</div>
{% endif %}
{% endblock %}
