<!DOCTYPE html>


<html>
    <head>
        {% load static %}
        {% load custom_tags %}
        {% load crispy_forms_tags %}
        {% include "chlamdb/header.html" %}
    </head>


<body>
    <div class="container-fluid" id="main_container">
      <div class="row">
        <div id="wrapper">
            <div id="page-content-wrapper">
              <div class="row">
                <div class="col-lg-12">
                   {% include "chlamdb/menu.html" %}
                   {% include "chlamdb/extract_nav_tabs_template.html" with type="ko" active_tab="det" %}

                    <br>
                    <p class="page-title">
                      <b>Kegg Orthologs shared by the selected genomes </b>
                      <a href="/docs/index.html" id="show-option" title="Get the list of Kegg Orthologs shared between genomes (selected in panel A) and absent in others (selected in panel B)">
                       <i class="fab fa-info-circle " style="size: 5em;" ></i></a></p></center>
                       <div id="extract_form">


                            {% block content %}
                      
                            {% csrf_token %}
                            {% crispy form %}
         

                        {% endblock %}
                    </div>

            {% if wrong_n_missing%}

            <div class="panel panel-success" style="width:500px ; top: 200px; margin: 10px 10px 10px 10px">
                <div class="panel-heading" style="width:100%">
                    <h3 class="panel-title">Help to interpret the results</h3>
                </div>
                <p style="margin: 10px 10px 10px 10px">You cannot set a number of missing data bigger than the number of included genomes</p>
            </div>

            {% elif no_match%}

            <div class="panel panel-warning" style="width:500px ; top: 200px; margin: 10px 10px 10px 10px">
                <div class="panel-heading" style="width:100%">
                    <h3 class="panel-title"></h3>
                </div>
                <p style="margin: 10px 10px 10px 10px">No match</p>
            </div>

            {% endif %}

            {% if envoi_extract %}

            <div class="row" style="background-color: rgba(245, 245, 245, 0.986)">
              <div class="col-lg-12">
                <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
                  <br>
                  <div class="panel panel-success" style="width:60%; top: 200px; margin: 10px 10px 10px 10px; float: left;">
                    <div class="panel-heading" style="width:100%">
                      <h3 class="panel-title">Help to interpret the results</h3>
                    </div>
                      <p style="margin: 10px 10px 10px 10px; line-height: 180%"> The output consists of a table containing the KO accession number of the Kegg Orthologs shared among the selected genomes. For each entry its description, the corresponding EC numbers used in Enzyme nomenclature, the Kegg Pathways and Kegg modules to whihch it belongs are reported. Additionally the frequency of the Ko entry in the selected genomes and in the whole database is computed.                           
                      </p>
                    </div>
                    <ul style="list-style-type:square">
                      <div style="padding-top:10px">
         <table class="table" style="width:600px">
                             <tr>
                                 <th>Number of included genomes</th>
                                 <td> {{ include |length }} </td>
                             </tr>
  
                             <tr>
                                 <th>Number of excluded genomes</th>
                                 <td> {{ sum_exclude_length }} </td>
                             </tr>
  
                              <tr>
                                 <th>Number of accepted missing data</th>
                                 <td> {{ n_missing }} </td>
                             </tr>
                               <tr>
                                 <th>Number of Keggs identified</th>
                                 <td> {{ ko_total_count|length  }}  </td>
                             </tr>
  
                         </table>
                        </div>

                         <div class="col-lg-12">
                          <div id="my-tab-content" class="tab-content">
                            <div class="tab-pane active" id="red">
                              
                            <div style="padding-top:18px;">
                  
                            <table class="hover" id="extract_ko">
                  
                            <thead>
                                <tr>
                                    <th id="entete_locus">KO</th>
                                    <th>Description</th>
                                    <th>Kegg Pathways</th>
                                    <th>Kegg Modules</th>
                                    <th>present in (/{{include|length}})</th>
                                    <th>freq complete database {{max_n}}</th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for value in match_groups_data %}
                                <tr>
                                    <td><a href="{% url 'fam_ko' value.0 %}">{{value.0}}</a></td>
                                    <td>{{value.1}}</td>
                                    <td>{{value.2|safe}}</td>
                                    <td>{{value.3|safe}}</td>
                                    <td>{{value.4}}</td>
                                    <td>{{value.5}}</td>
                                </tr>
                            {% endfor %}
                              </tbody>
                        </table>
                    </div>
                  </div>
				  </div>
			  {% endif %}
		  </div>
          </div>
        </div>
      </div>
    </div>
  </div>

<script>

$(document).ready(function() {
	$('#extract_ko').DataTable( {
		dom: 'Bfrtip',
		"paging":   true,
		"ordering": true,
		"info":     false,
		buttons: [{extend: 'excel', title: 'ko_table'},
		{ extend: 'csv', title: 'ko_table'}],
	});
});
</script>




<script>


</script>
</body>
{% include "chlamdb/style_menu.html" %}
{% include "chlamdb/show_hide_plasmid_accessions.html" %}

</html>
