about summary refs log tree commit diff
path: root/uploader/templates/genotypes
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/genotypes')
-rw-r--r--uploader/templates/genotypes/base.html22
-rw-r--r--uploader/templates/genotypes/create-dataset.html86
-rw-r--r--uploader/templates/genotypes/index.html28
-rw-r--r--uploader/templates/genotypes/list-genotypes.html236
-rw-r--r--uploader/templates/genotypes/list-markers.html23
-rw-r--r--uploader/templates/genotypes/select-population.html31
-rw-r--r--uploader/templates/genotypes/view-dataset.html54
7 files changed, 327 insertions, 153 deletions
diff --git a/uploader/templates/genotypes/base.html b/uploader/templates/genotypes/base.html
index 1b274bf..8d1b951 100644
--- a/uploader/templates/genotypes/base.html
+++ b/uploader/templates/genotypes/base.html
@@ -1,12 +1,18 @@
 {%extends "populations/base.html"%}
+{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
 
-{%block lvl3_breadcrumbs%}
-<li {%if activelink=="genotypes"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
-  <a href="{{url_for('species.populations.genotypes.index')}}">Genotypes</a>
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.populations.genotypes.list_genotypes',
+           species_id=species['SpeciesId'],
+           population_id=population['Id'])}}">
+    genotype
+  </a>
 </li>
-{%block lvl4_breadcrumbs%}{%endblock%}
+{%endblock%}
+
+
+{%block sidebarcontents%}
+{{display_sui_population_card(species, population)}}
 {%endblock%}
diff --git a/uploader/templates/genotypes/create-dataset.html b/uploader/templates/genotypes/create-dataset.html
new file mode 100644
index 0000000..ff174fb
--- /dev/null
+++ b/uploader/templates/genotypes/create-dataset.html
@@ -0,0 +1,86 @@
+{%extends "genotypes/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+{%from "populations/macro-display-population-card.html" import display_population_card%}
+
+{%block title%}Genotypes — Create Dataset{%endblock%}
+
+{%block pagetitle%}Genotypes — Create Dataset{%endblock%}
+
+{%block lvl4_breadcrumbs%}
+<li {%if activelink=="create-dataset"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  <a href="{{url_for('species.populations.genotypes.create_dataset',
+           species_id=species.SpeciesId,
+           population_id=population.Id)}}">Create Dataset</a>
+</li>
+{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+
+<div class="row">
+  <form id="frm-geno-create-dataset"
+        method="POST"
+        action="{{url_for('species.populations.genotypes.create_dataset',
+                species_id=species.SpeciesId,
+                population_id=population.Id)}}">
+    <legend>Create a new Genotype Dataset</legend>
+
+    <div class="form-group">
+      <label for="txt-geno-dataset-name" class="form-label">Name</label>
+      <input type="text"
+             id="txt-geno-dataset-name"
+             name="geno-dataset-name"
+             required="required"
+             class="form-control"
+             value="{{population.Name}}Geno"
+             readonly="readonly" />
+      <small class="form-text text-muted">
+        <p>This is a short representative, but constrained name for the genotype
+          dataset.<br />
+          It is used internally by the Genenetwork system. Do not change this
+          value.</p>
+      </small>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-geno-dataset-fullname" class="form-label">Full Name</label>
+      <input type="text"
+             id="txt-geno-dataset-fullname"
+             name="geno-dataset-fullname"
+             required="required"
+             class="form-control"
+             value="{{population.Name}} Genotypes" />
+      <small class="form-text text-muted">
+        <p>This is a longer, more descriptive name for your dataset.</p></small>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-geno-dataset-shortname"
+             class="form-label">Short Name</label>
+      <input type="text"
+             id="txt-geno-dataset-shortname"
+             name="geno-dataset-shortname"
+             class="form-control"
+             value="{{population.Name}}Geno" />
+      <small class="form-text text-muted">
+        <p>A short name for your dataset. If you leave this field blank, the
+          short name will be set to the same value as the
+          "<strong>Name</strong>" field above.</p></small>
+    </div>
+
+    <div class="form-group">
+      <input type="submit"
+             class="btn btn-primary"
+             value="create dataset"  />
+    </div>
+  </form>
+</div>
+{%endblock%}
+
+{%block sidebarcontents%}
+{{display_population_card(species, population)}}
+{%endblock%}
diff --git a/uploader/templates/genotypes/index.html b/uploader/templates/genotypes/index.html
deleted file mode 100644
index e749f5a..0000000
--- a/uploader/templates/genotypes/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{%extends "genotypes/base.html"%}
-{%from "flash_messages.html" import flash_all_messages%}
-{%from "species/macro-select-species.html" import select_species_form%}
-
-{%block title%}Genotypes{%endblock%}
-
-{%block pagetitle%}Genotypes{%endblock%}
-
-
-{%block contents%}
-{{flash_all_messages()}}
-
-<div class="row">
-  <p>
-    This section allows you to upload genotype information for your experiments,
-    in the case that you have not previously done so.
-  </p>
-  <p>
-    We'll need to link the genotypes to the species and population, so do please
-    go ahead and select those in the next two steps.
-  </p>
-</div>
-
-<div class="row">
-  {{select_species_form(url_for("species.populations.genotypes.index"),
-  species)}}
-</div>
-{%endblock%}
diff --git a/uploader/templates/genotypes/list-genotypes.html b/uploader/templates/genotypes/list-genotypes.html
index 3780f85..131576f 100644
--- a/uploader/templates/genotypes/list-genotypes.html
+++ b/uploader/templates/genotypes/list-genotypes.html
@@ -1,39 +1,14 @@
 {%extends "genotypes/base.html"%}
 {%from "flash_messages.html" import flash_all_messages%}
-{%from "populations/macro-display-population-card.html" import display_population_card%}
 
 {%block title%}Genotypes{%endblock%}
 
 {%block pagetitle%}Genotypes{%endblock%}
 
-{%block lvl4_breadcrumbs%}
-<li {%if activelink=="list-genotypes"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
-  <a href="{{url_for('species.populations.genotypes.list_genotypes',
-           species_id=species.SpeciesId,
-           population_id=population.Id)}}">List genotypes</a>
-</li>
-{%endblock%}
-
 {%block contents%}
 {{flash_all_messages()}}
 
 <div class="row">
-  <h2>Genetic Markers</h2>
-  <p>There are a total of {{total_markers}} currently registered genetic markers
-    for the "{{species.FullName}}" species. You can click
-    <a href="{{url_for('species.populations.genotypes.list_markers',
-             species_id=species.SpeciesId)}}"
-       title="View genetic markers for species '{{species.FullName}}">
-      this link to view the genetic markers
-    </a>.
-  </p>
-</div>
-
-<div class="row">
   <h2>Genotype Encoding</h2>
   <p>
     The genotype encoding used for the "{{population.FullName}}" population from
@@ -68,69 +43,184 @@
   </table>
 
   {%if genocode | length < 1%}
-  <a href="#add-genotype-encoding"
-     title="Add a genotype encoding system for this population"
-     class="btn btn-primary">
-    add genotype encoding
+  <div class="col">
+    <a href="#add-genotype-encoding"
+       title="Add a genotype encoding system for this population"
+       class="btn btn-primary not-implemented">
+      define genotype encoding
     </a>
+  </div>
   {%endif%}
 </div>
 
-<div class="row text-danger">
-  <h3>Some Important Concepts to Consider/Remember</h3>
-  <ul>
-    <li>Reference vs. Non-reference alleles</li>
-    <li>In <em>GenoCode</em> table, items are ordered by <strong>InbredSet</strong></li>
-  </ul>
-  <h3>Possible references</h3>
-  <ul>
-    <li>https://mr-dictionary.mrcieu.ac.uk/term/genotype/</li>
-    <li>https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7363099/</li>
-  </ul>
+<div class="row">
+  <h2>Genotype Dataset</h2>
+</div>
+
+{%if dataset is not none%}
+
+<div class="row">
+  <h3>Dataset Details</h3>
+  <table class="table">
+    <thead>
+      <tr>
+        <th>Name</th>
+        <th>Full Name</th>
+      </tr>
+    </thead>
+
+    <tbody>
+      <tr>
+        <td>{{dataset.Name}}</td>
+        <td><a href="{{url_for('species.populations.genotypes.view_dataset',
+                     species_id=species.SpeciesId,
+                     population_id=population.Id,
+                     dataset_id=dataset.Id)}}"
+               title="View details regarding and manage dataset '{{dataset.FullName}}'"
+               target="_blank">
+            {{dataset.FullName}}</a></td>
+      </tr>
+    </tbody>
+  </table>
+
+  <p>
+    To see more information regarding this dataset (e.g. which markers have
+    sample allele data, the allele data itself, etc) click on the "Full Name"
+    link above.</p>
+</div>
+
+<div class="row">
+  <h3>Genotype Markers</h3>
+
+  <div class="row">
+    <p>
+      The table below lists all of the markers that exist for species
+      {{species.SpeciesName}} ({{species.FullName}}), regardless of whether
+      (or not) we have corresponding sample allele data for a particular marker.
+    </p>
+  <table id="tbl-genetic-markers" class="table compact stripe cell-border">
+    <thead>
+      <tr>
+        <th title="">#</th>
+        <th title="">Index</th>
+        <th title="">Marker Name</th>
+        <th title="Chromosome">Chr</th>
+        <th title="Physical location of the marker in megabasepairs">
+          Location (Mb)</th>
+        <th title="">Source</th>
+        <th title="">Source2</th>
+    </thead>
+
+    <tbody>
+      {%for marker in markers%}
+      <tr>
+        <td></td>
+        <td></td>
+        <td></td>
+        <td></td>
+        <td></td>
+        <td></td>
+        <td></td>
+      </tr>
+      {%endfor%}
+    </tbody>
+  </table>
 </div>
 
+{%else%}
+
 <div class="row">
-  <h2>Genotype Datasets</h2>
-
-  <p>The genotype data is organised under various genotype datasets. You can
-    click on the link for the relevant dataset to view a little more information
-    about it.</p>
-
-  {%if dataset is defined %}
-    <table class="table">
-      <thead>
-        <tr>
-          <th>Name</th>
-          <th>Full Name</th>
-        </tr>
-      </thead>
-
-      <tbody>
-        <tr>
-          <td>{{dataset.Name}}</td>
-          <td><a href="{{url_for('species.populations.genotypes.view_dataset',
-                       species_id=species.SpeciesId,
-                       population_id=population.Id,
-                       dataset_id=dataset.Id)}}"
-                 title="View details regarding and manage dataset '{{dataset.FullName}}'">
-              {{dataset.FullName}}</a></td>
-        </tr>
-      </tbody>
-    </table>
-  {%else%}
+  <p>
+    Your genotype data will need to be under a dataset. Unfortunately there is
+    currently no dataset defined for this population.
+  </p>
+
   <p class="text-warning">
     <span class="glyphicon glyphicon-exclamation-sign"></span>
-    There is no genotype dataset defined for this population.
+    Click the button below to define the genotype dataset for this population.
   </p>
   <p>
-    <a href="#create-new-genotype-dataset"
+    <a href="{{url_for('species.populations.genotypes.create_dataset',
+             species_id=species.SpeciesId,
+             population_id=population.Id)}}"
        title="Create a new genotype dataset for the '{{population.FullName}}' population for the '{{species.FullName}}' species."
        class="btn btn-primary">
       create new genotype dataset</a></p>
-  {%endif%}
 </div>
+
+{%endif%}
+
+<div class="row">
+  <h2>Notes</h2>
+  <div class="row text-danger">
+    <h3>Genetic Markers: Some Important Concepts to Consider/Remember</h3>
+    <ul>
+      <li>Reference vs. Non-reference alleles</li>
+      <li>In <em>GenoCode</em> table, items are ordered by <strong>InbredSet</strong></li>
+    </ul>
+    <h3>Possible references</h3>
+    <ul>
+      <li>https://mr-dictionary.mrcieu.ac.uk/term/genotype/</li>
+      <li>https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7363099/</li>
+    </ul>
+  </div>
+
+  <div class="row text-warning">
+    <h3>Genotype Dataset</h3>
+    <p>
+      <span class="glyphicon glyphicon-exclamation-sign"></span>
+      <strong>NOTE</strong>: Currently the GN2 (and related) system(s) expect a
+      single genotype dataset per population. If there is more than one, the
+      system apparently fails in unpredictable ways.
+    </p>
+  </div>
+</div>
+
 {%endblock%}
 
-{%block sidebarcontents%}
-{{display_population_card(species, population)}}
+
+{%block javascript%}
+<script type="text/javascript">
+
+  $(function() {
+      var dtGeneticMarkers = buildDataTable(
+          "#tbl-genetic-markers",
+          [],
+          [
+              {
+                  data: function(marker) {
+                      return `<input type="checkbox" name="selected-markers" ` +
+                          `id="chk-selected-markers-${marker.Id}-${marker.GenoFreezeId}" ` +
+                          `value="${marker.Id}_${marker.GenoFreezeId}" ` +
+                          `class="chk-row-select" />`;
+                  }
+              },
+              {data: 'index'},
+              {data: "Name", searchable: true},
+              {data: "Chr", searchable: true},
+              {data: "Mb", searchable: true},
+              {data: "Source", searchable: true},
+              {data: "Source2", searchable: true}
+          ],
+          {
+              ajax: {
+                  url: "{{url_for('species.populations.genotypes.list_markers', species_id=species.SpeciesId, population_id=population.Id, dataset_id=dataset.Id)}}",
+                  dataSrc: "markers"
+              },
+              paging: true,
+              scroller: true,
+              scrollY: "50vh",
+              scrollCollapse: true,
+              layout: {
+                  top: "info",
+                  topStart: null,
+                  topEnd: null,
+                  bottom: null,
+                  bottomStart: null,
+                  bottomEnd: null
+              }
+          });
+  });
+
+</script>
 {%endblock%}
diff --git a/uploader/templates/genotypes/list-markers.html b/uploader/templates/genotypes/list-markers.html
index 9198b44..22189c7 100644
--- a/uploader/templates/genotypes/list-markers.html
+++ b/uploader/templates/genotypes/list-markers.html
@@ -1,19 +1,18 @@
 {%extends "genotypes/base.html"%}
 {%from "flash_messages.html" import flash_all_messages%}
-{%from "species/macro-display-species-card.html" import display_species_card%}
 
 {%block title%}Genotypes: List Markers{%endblock%}
 
 {%block pagetitle%}Genotypes: List Markers{%endblock%}
 
-{%block lvl4_breadcrumbs%}
-<li {%if activelink=="list-markers"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
   <a href="{{url_for('species.populations.genotypes.list_markers',
-           species_id=species.SpeciesId)}}">List markers</a>
+           species_id=species['SpeciesId'],
+           population_id=population['Id'])}}">
+    markers
+  </a>
 </li>
 {%endblock%}
 
@@ -30,6 +29,7 @@
       {%if start_from > 0%}
       <a href="{{url_for('species.populations.genotypes.list_markers',
                species_id=species.SpeciesId,
+               population_id=population.Id,
                start_from=start_from-count,
                count=count)}}">
         <span class="glyphicon glyphicon-backward"></span>
@@ -45,6 +45,7 @@
       {%if start_from + count < total_markers%}
       <a href="{{url_for('species.populations.genotypes.list_markers',
                species_id=species.SpeciesId,
+               population_id=population.Id,
                start_from=start_from+count,
                count=count)}}">
         Next
@@ -56,7 +57,7 @@
   <table class="table">
     <thead>
       <tr>
-        <th title="">#</th>
+        <th title="">Index</th>
         <th title="">Marker Name</th>
         <th title="Chromosome">Chr</th>
         <th title="Physical location of the marker in megabasepairs">
@@ -96,7 +97,3 @@
 </div>
 {%endif%}
 {%endblock%}
-
-{%block sidebarcontents%}
-{{display_species_card(species)}}
-{%endblock%}
diff --git a/uploader/templates/genotypes/select-population.html b/uploader/templates/genotypes/select-population.html
deleted file mode 100644
index 7c81943..0000000
--- a/uploader/templates/genotypes/select-population.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{%extends "genotypes/base.html"%}
-{%from "flash_messages.html" import flash_all_messages%}
-{%from "species/macro-display-species-card.html" import display_species_card%}
-{%from "populations/macro-select-population.html" import select_population_form%}
-
-{%block title%}Genotypes{%endblock%}
-
-{%block pagetitle%}Genotypes{%endblock%}
-
-
-{%block contents%}
-{{flash_all_messages()}}
-
-<div class="row">
-  <p>
-    You have indicated that you intend to upload the genotypes for species
-    '{{species.FullName}}'. We now just require the population for your
-    experiment/study, and you should be good to go.
-  </p>
-</div>
-
-<div class="row">
-  {{select_population_form(url_for("species.populations.genotypes.select_population",
-  species_id=species.SpeciesId),
-  populations)}}
-</div>
-{%endblock%}
-
-{%block sidebarcontents%}
-{{display_species_card(species)}}
-{%endblock%}
diff --git a/uploader/templates/genotypes/view-dataset.html b/uploader/templates/genotypes/view-dataset.html
new file mode 100644
index 0000000..d95a8e3
--- /dev/null
+++ b/uploader/templates/genotypes/view-dataset.html
@@ -0,0 +1,54 @@
+{%extends "genotypes/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}Genotypes: View Dataset{%endblock%}
+
+{%block pagetitle%}Genotypes: View Dataset{%endblock%}
+
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.populations.genotypes.view_dataset',
+           species_id=species.SpeciesId,
+           population_id=population.Id,
+           dataset_id=dataset.Id)}}">dataset</a>
+</li>
+{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+
+<div class="row">
+  <h2>Genotype Dataset Details</h2>
+  <table class="table">
+    <thead>
+      <tr>
+        <th>Name</th>
+        <th>Full Name</th>
+      </tr>
+    </thead>
+
+    <tbody>
+      <tr>
+        <td>{{dataset.Name}}</td>
+        <td>{{dataset.FullName}}</td>
+      </tr>
+    </tbody>
+  </table>
+</div>
+
+<div class="row text-warning">
+  <h2>Assembly Details</h2>
+
+  <p>Maybe include the assembly details here if found to be necessary.</p>
+</div>
+
+<div class="row">
+  <h2>Genotype Data</h2>
+
+  <div class="col" style="margin-bottom: 3px;">
+    <a href="#" class="btn btn-primary not-implemented">upload genotypes</a>
+  </div>
+</div>
+
+{%endblock%}