<commit_before>{#
  Results should be in a form of a table where mappings are shown
  together with links to appropiate sites. Below the table information
  about positions that where not found in the database should be displayed
#}

<table class="table table-rowspan-hover">
  <thead>
  <tr>
    {% set columns_count = 9 %}
    <th>User input</th>
    <th>Gene name</th>
    <th>Refseq</th>
    <th>Ref aa</th>
    <th>Alt aa</th>
    <th>Position</th>
    <th>is PTM?</th>
    <th>Impact</th>
    <th>Link</th>
  </tr>
  </thead>
  {% for line in results %}
    <tbody>
    {% for result in line.results %}
      <tr>
        {% if loop.first %}
          <td rowspan={{ loop.length }}>{{ line.user_input }}</td>
          {% if result.type == 'proteomic' %}
          {# If the query was about one specific protein, it won't change #}
          <td rowspan={{ loop.length }}>
            <a href="{{ url_for('GeneView:show', gene_name=result.protein.gene.name)}} ">
              {{ result.protein.gene.name }}
            </a>
          </td>
          {% endif %}
        {% endif %}
        {% if result.type != 'proteomic' %}
        <td>
          <a href="{{ url_for('GeneView:show', gene_name=result.protein.gene.name)}} ">
            {{ result.protein.gene.name }}
          </a>
        </td>
        {% endif %}
        <td>
          <a href="{{ url_for('ProteinView:show', refseq=result.protein.refseq) }}">
            {{ result.protein.refseq }}
          </a>
        </td>
        <td>{{ result.ref }}</td>
        <td>{{ result.alt }}</td>
        <td>{{ result.pos }}</td>
        <td>{{ result.mutation.is_ptm }}
        {#
          This might take advantage of precomputed PTMs for genomic mutations
          result.is_ptm if (result.is_ptm != None) else result.mutation.is_ptm
        #}</td>
        <td class="{{ result.mutation.impact_on_ptm or '' }}">
            {{ result.mutation.impact_on_ptm or '' }}
            {% if result.mutation.impact_on_ptm == 'network-rewiring' %}
                - motif {{ result.mutation.meta_MIMP.effect }}
            {% endif %}
        </td>
        <td>
            {% if result.mutation.is_confirmed %}
            {% set some_source = result.mutation.sources[0] %}
            <a href="{{ url_for('ProteinView:show', refseq=result.protein.refseq, filters='Mutation.sources:in:' + some_source) }}#{{ result.pos }}{{ result.alt }}">
              show mutation details →
            </a>
            {% else %}
              <span title="This mutation does not have any details associated with (in this database).">no details</span>
            {% endif %}
        </td>
      </tr><commit_msg>Show links to all available sources and make code cleaner<commit_after>{#
  Results should be in a form of a table where mappings are shown
  together with links to appropiate sites. Below the table information
  about positions that where not found in the database should be displayed
#}

<table class="table table-rowspan-hover">
  <thead>
  <tr>
    {% set columns_count = 9 %}
    <th>User input</th>
    <th>Gene name</th>
    <th>Refseq</th>
    <th>Ref aa</th>
    <th>Alt aa</th>
    <th>Position</th>
    <th>is PTM?</th>
    <th>Impact</th>
    <th>Link</th>
  </tr>
  </thead>
  {% for line in results %}
    <tbody>
    {% for result in line.results %}
      {% set mutation = result.mutation %}
      <tr>
        {% if loop.first %}
          <td rowspan={{ loop.length }}>{{ line.user_input }}</td>
          {% if result.type == 'proteomic' %}
          {# If the query was about one specific protein, it won't change #}
          <td rowspan={{ loop.length }}>
            <a href="{{ url_for('GeneView:show', gene_name=result.protein.gene.name)}}">
              {{ result.protein.gene.name }}
            </a>
          </td>
          {% endif %}
        {% endif %}
        {% if result.type != 'proteomic' %}
        <td>
          <a href="{{ url_for('GeneView:show', gene_name=result.protein.gene.name)}}">
            {{ result.protein.gene.name }}
          </a>
        </td>
        {% endif %}
        <td>
          <a href="{{ url_for('ProteinView:show', refseq=result.protein.refseq) }}">
            {{ result.protein.refseq }}
          </a>
        </td>
        <td>{{ result.ref }}</td>
        <td>{{ result.alt }}</td>
        <td>{{ result.pos }}</td>
        <td>{{ mutation.is_ptm }}
        {#
          This might take advantage of precomputed PTMs for genomic mutations
          result.is_ptm if (result.is_ptm != None) else mutation.is_ptm
        #}</td>
        <td class="{{ mutation.impact_on_ptm or '' }}">
            {{ mutation.impact_on_ptm or '' }}
            {% if mutation.impact_on_ptm == 'network-rewiring' %}
                - motif {{ mutation.meta_MIMP.effect }}
            {% endif %}
        </td>
        <td>
            {% if mutation.is_confirmed %}
              {% for source in mutation.sources %}
                <a href="{{ url_for('ProteinView:show', refseq=result.protein.refseq, filters='Mutation.sources:in:' + source) }}#{{ result.pos }}{{ result.alt }}">
                mutation details ({{ mutation.get_source_name(source) }}) →
              </a><br>
              {% endfor %}
            {% else %}
              <span title="None of datasets in this database include this mutation.">no details</span>
            {% endif %}
        </td>
      </tr>
{'fraction_non_alphanumeric': 0.16250231352952063, 'fraction_numerical': 0.000555247084952804, 'mean_word_length': 1.93058568329718, 'pattern_counts': {'":': 0, '<': 116, '<?xml version=': 0, '>': 116, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3770', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1636, 'n_words': 412}