<commit_before><!--
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
     http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

{% load humanize %}

<table class="table table-hover table-condensed table-bordered" id="xrefs-table">

<thead>
  <tr>
    <th>Database</th>
    <th>Description</th>
    <th>Species</th>
    <th>First&nbsp;seen</th>
    <th>Last&nbsp;seen</th>
  </tr>
</thead>

<tbody>

{% for xref in context.rna.get_xrefs %}
  <tr {% if xref.deleted == 'Y' %}class="warning"{% endif %}>
    <td>
      {% if xref.db.display_name != 'ENA' %}
        <span class="badge badge-success help" data-toggle="tooltip" title="RNAcentral Expert Database">
          <i class="fa fa-star"></i>
        </span>
      {% endif %}
      <a href="{% url 'portal.views.expert_database_view' expert_db_name=xref.db.descr %}">{{ xref.db.display_name.split|join:"&nbsp;" }}</a>
    </td>
    <!-- accession -->
    <td>
    <strong>{{ xref.accession.description }}</strong>
    <br>
    <i class="fa fa-angle-right"></i>
    {% if xref.db.display_name == 'ENA' %}
      ENA: <a href="{{ xref.accession.get_ena_url }}" target="_blank" title="{{ xref.accession.accession }} at ENA">{{ xref.accession.accession }}</a>
    {% elif xref.db.display_name == 'RFAM' %}
      RFAM family: <a href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.external_id }}</a> ({{ xref.accession.optional_id }}),
      {% if xref.is_rfam_seed %}
        <span class="text-success">seed alignment</span> <i class="fa fa-info-circle help" title="part of a manually curated RFAM seed alignment"></i>
      {% else %}
        <span class="text-danger">full alignment</span> <i class="fa fa-info-circle help" title="part of an automatically built RFAM full alignment"></i>
      {% endif %}
      <br>
      <i class="fa fa-angle-right"></i>
      Source ENA entry: <a href="http://www.ebi.ac.uk/ena/data/view/{{ xref.accession.parent_ac }}" target="_blank">{{ xref.accession.parent_ac }}</a>
      (nucleotides {{ xref.accession.feature_start|intcomma }}:{{ xref.accession.feature_end|intcomma }})
    {% elif xref.db.display_name == 'SRPDB' %}
      SRPDB:
      <a class="srpdb-external-url" href="{{ xref.accession.get_expert_db_external_url }}.fasta" target="_blank">{{ xref.accession.get_srpdb_id }}</a>
    {% elif xref.db.display_name == 'lncRNAdb' %}
      lncRNAdb:
      <a class="lncrnadb-external-url" href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.optional_id }}</a>
    {% elif xref.db.display_name == 'gtRNAdb' %}
      gtRNAdb:
      <a class="gtrnadb-external-url" href="{{ xref.accession.get_expert_db_external_url }}.html" target="_blank">{{ xref.accession.external_id }}</a>
    {% elif xref.db.display_name == 'miRBase' %}
      miRBase:
      <a class="mirbase-external-url" href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.external_id }}</a>
    {# VEGA #}
    {% elif xref.db.display_name == 'VEGA' %}
      VEGA transcript <a href="http://vega.sanger.ac.uk/Homo_sapiens/Transcript/Summary?db=core;t={{ xref.accession.optional_id }}" target="_blank" title="View the transcript at VEGA">{{ xref.accession.optional_id }}</a>
      from gene <a href="{{ xref.accession.get_expert_db_external_url }}" target="_blank" title="View the gene at VEGA">{{ xref.accession.external_id }}</a>
      {% with splice_variants=xref.get_vega_splice_variants %}
        {% if splice_variants %}
          <br>
          <i class="fa fa-angle-right"></i>
          {{splice_variants|length}} alternative transcript{{splice_variants|length|pluralize}}:
          <small>
            {% for splice_variant in splice_variants %}
              <a href="{% url  'portal.views.rna_view' upi=splice_variant.upi %}">{{ splice_variant.upi }}</a>
              ({{ splice_variant.length|intcomma }} nts){% if not forloop.last %},{% else %}.{% endif %}
            {% endfor %}
          </small>
        {% endif %}
      {% endwith %}
      {% if xref.has_genomic_coordinates  %}
        <br>
        <i class="fa fa-angle-right"></i>
        {% with genomic_coordinates=xref.get_genomic_coordinates %}
          <button type="button" class="btn btn-primary btn-xs genoverse-xref help margin-right-5px" data-genomic-start="{{ genomic_coordinates.start }}" data-genomic-end="{{ genomic_coordinates.end }}" data-chromosome="{{ genomic_coordinates.chromosome }}" title="View on this page using Genoverse browser"><i class="fa fa-map-marker"></i> View genomic location</button>
          <small>
            <span class="margin-right-5px">chr{{ genomic_coordinates.chromosome }}:{{ genomic_coordinates.start|intcomma }}-{{ genomic_coordinates.end|intcomma }}</span>
            <span class="margin-right-5px ensembl-link"><a href="http://www.ensembl.org/Homo_sapiens/Location/View?r={{ genomic_coordinates.chromosome }}%3A{{ genomic_coordinates.start }}-{{ genomic_coordinates.end }};contigviewbottom=das:{{ BASE_URL }}/api/v1/das/RNAcentral_GRCh37=labels" target="_blank">Ensembl <i class="fa fa-external-link"></i></a></span>
            <span class="margin-right-5px ucsc-link"><a href="http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&position=chr{{ genomic_coordinates.chromosome }}%3A{{ genomic_coordinates.start }}-{{ genomic_coordinates.end }}&hgct_customText=track%20type=bigBed%20name=RNAcentral%20description=%22%20RNAcentral%20Unique%20Sequences%22%20visibility=full%20bigDataUrl={{ BASE_URL }}/data/trackhubs/1.0beta/hg19/rnacentral.bigBed%20itemRgb=on%20url={{ BASE_URL }}/rna/$$%20htmlUrl={{ BASE_URL }}/data/trackhubs/1.0beta/hg19/rnacentral.html" target="_blank">UCSC <i class="fa fa-external-link"></i></a></span>
          </small>
        {% endwith %}
      {% endif %}
    {# tmRNA Website #}
    {% elif xref.db.display_name == 'tmRNA Website' %}
      tmRNA Website: <a href="{{ xref.accession.get_expert_db_external_url }}.html" target="_blank">{{ xref.accession.external_id }}</a>
    {% endif %}

    {% if xref.accession.organelle %}
      <br>
      <i class="fa fa-angle-right"></i>
      found in {{ xref.accession.organelle|lower }}
    {% endif %}

    {% if xref.accession.is_composite == 'Y' %}
      <br>
      <i class="fa fa-angle-right"></i>
      Source ENA entry: <a href="{{ xref.accession.get_ena_url }}" target="_blank" title="{{ xref.accession.non_coding_id }} at ENA">{{ xref.accession.non_coding_id }}</a>
    {% endif %}

    {# literature references #}
    <span class="literature-refs">
      <button class="literature-refs-retrieve btn btn-default btn-xs pull-right help" data-accession="{{ xref.accession.accession }}" title="Literature citations"><i class="fa fa-book"></i></button>
      <div class="literature-refs-content"></div>
    </span>

    {% if xref.deleted == 'Y' %}
      <br><commit_msg>Remove hard-coded UCSC and Ensembl external link icons<commit_after><!--
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
     http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

{% load humanize %}

<table class="table table-hover table-condensed table-bordered" id="xrefs-table">

<thead>
  <tr>
    <th>Database</th>
    <th>Description</th>
    <th>Species</th>
    <th>First&nbsp;seen</th>
    <th>Last&nbsp;seen</th>
  </tr>
</thead>

<tbody>

{% for xref in context.rna.get_xrefs %}
  <tr {% if xref.deleted == 'Y' %}class="warning"{% endif %}>
    <td>
      {% if xref.db.display_name != 'ENA' %}
        <span class="badge badge-success help" data-toggle="tooltip" title="RNAcentral Expert Database">
          <i class="fa fa-star"></i>
        </span>
      {% endif %}
      {{ xref.db.display_name.split|join:"&nbsp;" }}
    </td>
    <!-- accession -->
    <td>
    <strong>{{ xref.accession.description }}</strong>
    <br>
    <i class="fa fa-angle-right"></i>
    {% if xref.db.display_name == 'ENA' %}
      ENA: <a href="{{ xref.accession.get_ena_url }}" target="_blank" title="{{ xref.accession.accession }} at ENA">{{ xref.accession.accession }}</a>
    {% elif xref.db.display_name == 'RFAM' %}
      RFAM family: <a href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.external_id }}</a> ({{ xref.accession.optional_id }}),
      {% if xref.is_rfam_seed %}
        <span class="text-success">seed alignment</span> <i class="fa fa-info-circle help" title="part of a manually curated RFAM seed alignment"></i>
      {% else %}
        <span class="text-danger">full alignment</span> <i class="fa fa-info-circle help" title="part of an automatically built RFAM full alignment"></i>
      {% endif %}
      <br>
      <i class="fa fa-angle-right"></i>
      Source ENA entry: <a href="http://www.ebi.ac.uk/ena/data/view/{{ xref.accession.parent_ac }}" target="_blank">{{ xref.accession.parent_ac }}</a>
      (nucleotides {{ xref.accession.feature_start|intcomma }}:{{ xref.accession.feature_end|intcomma }})
    {% elif xref.db.display_name == 'SRPDB' %}
      SRPDB:
      <a class="srpdb-external-url" href="{{ xref.accession.get_expert_db_external_url }}.fasta" target="_blank">{{ xref.accession.get_srpdb_id }}</a>
    {% elif xref.db.display_name == 'lncRNAdb' %}
      lncRNAdb:
      <a class="lncrnadb-external-url" href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.optional_id }}</a>
    {% elif xref.db.display_name == 'gtRNAdb' %}
      gtRNAdb:
      <a class="gtrnadb-external-url" href="{{ xref.accession.get_expert_db_external_url }}.html" target="_blank">{{ xref.accession.external_id }}</a>
    {% elif xref.db.display_name == 'miRBase' %}
      miRBase:
      <a class="mirbase-external-url" href="{{ xref.accession.get_expert_db_external_url }}" target="_blank">{{ xref.accession.external_id }}</a>
    {# VEGA #}
    {% elif xref.db.display_name == 'VEGA' %}
      VEGA transcript <a href="http://vega.sanger.ac.uk/Homo_sapiens/Transcript/Summary?db=core;t={{ xref.accession.optional_id }}" target="_blank" title="View the transcript at VEGA">{{ xref.accession.optional_id }}</a>
      from gene <a href="{{ xref.accession.get_expert_db_external_url }}" target="_blank" title="View the gene at VEGA">{{ xref.accession.external_id }}</a>
      {% with splice_variants=xref.get_vega_splice_variants %}
        {% if splice_variants %}
          <br>
          <i class="fa fa-angle-right"></i>
          {{splice_variants|length}} alternative transcript{{splice_variants|length|pluralize}}:
          <small>
            {% for splice_variant in splice_variants %}
              <a href="{% url  'portal.views.rna_view' upi=splice_variant.upi %}">{{ splice_variant.upi }}</a>
              ({{ splice_variant.length|intcomma }} nts){% if not forloop.last %},{% else %}.{% endif %}
            {% endfor %}
          </small>
        {% endif %}
      {% endwith %}
      {% if xref.has_genomic_coordinates  %}
        <br>
        <i class="fa fa-angle-right"></i>
        {% with genomic_coordinates=xref.get_genomic_coordinates %}
          <button type="button" class="btn btn-primary btn-xs genoverse-xref help margin-right-5px" data-genomic-start="{{ genomic_coordinates.start }}" data-genomic-end="{{ genomic_coordinates.end }}" data-chromosome="{{ genomic_coordinates.chromosome }}" title="View on this page using Genoverse browser"><i class="fa fa-map-marker"></i> View genomic location</button>
          <small>
            <span class="margin-right-5px">chr{{ genomic_coordinates.chromosome }}:{{ genomic_coordinates.start|intcomma }}-{{ genomic_coordinates.end|intcomma }}</span>
            <span class="margin-right-5px ensembl-link"><a href="http://www.ensembl.org/Homo_sapiens/Location/View?r={{ genomic_coordinates.chromosome }}%3A{{ genomic_coordinates.start }}-{{ genomic_coordinates.end }};contigviewbottom=das:{{ BASE_URL }}/api/v1/das/RNAcentral_GRCh37=labels" target="_blank">Ensembl</a></span>
            <span class="margin-right-5px ucsc-link"><a href="http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&position=chr{{ genomic_coordinates.chromosome }}%3A{{ genomic_coordinates.start }}-{{ genomic_coordinates.end }}&hgct_customText=track%20type=bigBed%20name=RNAcentral%20description=%22%20RNAcentral%20Unique%20Sequences%22%20visibility=full%20bigDataUrl={{ BASE_URL }}/data/trackhubs/1.0beta/hg19/rnacentral.bigBed%20itemRgb=on%20url={{ BASE_URL }}/rna/$$%20htmlUrl={{ BASE_URL }}/data/trackhubs/1.0beta/hg19/rnacentral.html" target="_blank">UCSC</a></span>
          </small>
        {% endwith %}
      {% endif %}
    {# tmRNA Website #}
    {% elif xref.db.display_name == 'tmRNA Website' %}
      tmRNA Website: <a href="{{ xref.accession.get_expert_db_external_url }}.html" target="_blank">{{ xref.accession.external_id }}</a>
    {% endif %}

    {% if xref.accession.organelle %}
      <br>
      <i class="fa fa-angle-right"></i>
      found in {{ xref.accession.organelle|lower }}
    {% endif %}

    {% if xref.accession.is_composite == 'Y' %}
      <br>
      <i class="fa fa-angle-right"></i>
      Source ENA entry: <a href="{{ xref.accession.get_ena_url }}" target="_blank" title="{{ xref.accession.non_coding_id }} at ENA">{{ xref.accession.non_coding_id }}</a>
    {% endif %}

    {# literature references #}
    <span class="literature-refs">
      <button class="literature-refs-retrieve btn btn-default btn-xs pull-right help" data-accession="{{ xref.accession.accession }}" title="Literature citations"><i class="fa fa-book"></i></button>
      <div class="literature-refs-content"></div>
    </span>

    {% if xref.deleted == 'Y' %}
      <br>
{'fraction_non_alphanumeric': 0.17374517374517376, 'fraction_numerical': 0.007859900717043573, 'mean_word_length': 3.766677620768978, 'pattern_counts': {'":': 0, '<': 219, '<?xml version=': 0, '>': 219, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '1784459', 'n_tokens_mistral': 5262, 'n_tokens_neox': 4867, 'n_words': 956}