about summary refs log tree commit diff
path: root/uploader/templates/populations
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/populations')
-rw-r--r--uploader/templates/populations/create-population.html53
-rw-r--r--uploader/templates/populations/index.html4
-rw-r--r--uploader/templates/populations/list-populations.html9
-rw-r--r--uploader/templates/populations/macro-display-population-card.html44
-rw-r--r--uploader/templates/populations/macro-select-population.html72
-rw-r--r--uploader/templates/populations/sui-base.html12
-rw-r--r--uploader/templates/populations/sui-view-population.html138
-rw-r--r--uploader/templates/populations/view-population.html6
8 files changed, 284 insertions, 54 deletions
diff --git a/uploader/templates/populations/create-population.html b/uploader/templates/populations/create-population.html
index b05ce37..007b6bf 100644
--- a/uploader/templates/populations/create-population.html
+++ b/uploader/templates/populations/create-population.html
@@ -37,12 +37,15 @@
 <div class="row">
   <form method="POST"
         action="{{url_for('species.populations.create_population',
-                species_id=species.SpeciesId)}}">
+                species_id=species.SpeciesId,
+                return_to=return_to)}}">
 
     <legend>Create Population</legend>
 
     {{flash_all_messages()}}
 
+    <input type="hidden" name="return_to" value="{{return_to}}">
+
     <div {%if errors.population_fullname%}
          class="form-group has-error"
          {%else%}
@@ -107,9 +110,12 @@
              value="{{error_values.population_code or ''}}"
              class="form-control" />
       <small class="form-text text-muted">
-        <p class="text-danger">
-          <span class="glyphicon glyphicon-exclamation-sign"></span>
-          What is this field is for? Confirm with Arthur and the rest.
+        <p class="form-text text-muted">
+          This is a 3-character code for your population, that is prepended to
+          the phenotype identifiers. e.g. For the "BXD Family" population, the
+          code is "BXD" and therefore, the phenotype identifiers for the
+          population look like the following examples: <em>BXD_10148</em>,
+          <em>BXD_10180</em>, <em>BXD_10197</em>, etc.
         </p>
       </small>
     </div>
@@ -148,24 +154,35 @@
          {%else%}
          class="form-group"
          {%endif%}>
-      <label for="select-population-family" class="form-label">Family</label>
-      <select id="select-population-family"
-              name="population_family"
-              class="form-control"
-              required="required">
-        <option value="">Please select a family</option>
+      <label for="txt-population-family" class="form-label">Family</label>
+      <input type="text"
+             id="txt-population-family"
+             name="population_family"
+             class="form-control"
+             list="families-list" />
+      <datalist id="families-list">
         {%for family in families%}
-        <option value="{{family}}"
-                {%if error_values.population_family == family%}
-                selected="selected"
-                {%endif%}>{{family}}</option>
+        <option value="{{family}}">{{family}}</option>
         {%endfor%}
-      </select>
+      </datalist>
       <small class="form-text text-muted">
         <p>
-          This is a rough grouping of the populations in GeneNetwork into lists
-          of common types of populations.
-        </p>
+          This is <strong>optional</strong> metadata. It is used to group
+          populations into "families" for presentation in the menus.
+          {%if families | length > 0%}
+          Examples of currently existing families are:
+          <ul>
+            {%for family in families[0:7]%}
+            <li>{{family}}</li>
+            {%endfor%}
+            <li>etc.</li>
+          </ul>
+          {%endif%}
+
+          You can
+          {%if families|length>0%} select from existing families, or {%endif%}
+          create a new family by typing in the input box above. You can also
+          leave the family blank.</p>
       </small>
     </div>
 
diff --git a/uploader/templates/populations/index.html b/uploader/templates/populations/index.html
index 4354e02..d2bee77 100644
--- a/uploader/templates/populations/index.html
+++ b/uploader/templates/populations/index.html
@@ -22,3 +22,7 @@
   {{select_species_form(url_for("species.populations.index"), species)}}
 </div>
 {%endblock%}
+
+{%block javascript%}
+<script type="text/javascript" src="/static/js/species.js"></script>
+{%endblock%}
diff --git a/uploader/templates/populations/list-populations.html b/uploader/templates/populations/list-populations.html
index 7c7145f..a092e34 100644
--- a/uploader/templates/populations/list-populations.html
+++ b/uploader/templates/populations/list-populations.html
@@ -51,10 +51,10 @@
     <caption>Populations for {{species.FullName}}</caption>
     <thead>
       <tr>
-        <th>#</th>
+        <th></th>
         <th>Name</th>
         <th>Full Name</th>
-        <th>Description</th>
+        <th>Information</th>
       </tr>
     </thead>
 
@@ -71,7 +71,10 @@
           </a>
         </td>
         <td>{{population.FullName}}</td>
-        <td>{{population.Description}}</td>
+        <td><a href="https://info.genenetwork.org/species/source.php?SpeciesName={{species.Name}}&InbredSetName={{population.Name}}"
+               title="Link to detailed information on this population."
+               class="btn btn-info"
+               target="_blank">info</a></td>
       </tr>
       {%else%}
       <tr>
diff --git a/uploader/templates/populations/macro-display-population-card.html b/uploader/templates/populations/macro-display-population-card.html
index 79f7925..6b5f1e0 100644
--- a/uploader/templates/populations/macro-display-population-card.html
+++ b/uploader/templates/populations/macro-display-population-card.html
@@ -1,4 +1,4 @@
-{%from "species/macro-display-species-card.html" import display_species_card%}
+{%from "species/macro-display-species-card.html" import display_species_card,display_sui_species_card%}
 
 {%macro display_population_card(species, population)%}
 {{display_species_card(species)}}
@@ -33,14 +33,46 @@
             <td>Family</td>
             <td>{{population.Family}}</td>
           </tr>
-
-          <tr>
-            <td>Description</td>
-            <td>{{(population.Description or "")[0:500]}}&hellip;</td>
-          </tr>
         </tbody>
       </table>
     </div>
   </div>
 </div>
 {%endmacro%}
+
+
+{%macro display_sui_population_card(species, population)%}
+{{display_sui_species_card(species)}}
+
+<div class="row">
+  <table class="table">
+    <caption>Current population</caption>
+    <tbody>
+      <tr>
+        <th>Name</th>
+        <td>{{population.Name}}</td>
+      </tr>
+
+      <tr>
+        <th>Full Name</th>
+        <td>{{population.FullName}}</td>
+      </tr>
+
+      <tr>
+        <th>Code</th>
+        <td>{{population.InbredSetCode}}</td>
+      </tr>
+
+      <tr>
+        <th>Genetic Type</th>
+        <td>{{population.GeneticType}}</td>
+      </tr>
+
+      <tr>
+        <th>Family</th>
+        <td>{{population.Family}}</td>
+      </tr>
+    </tbody>
+  </table>
+</div>
+{%endmacro%}
diff --git a/uploader/templates/populations/macro-select-population.html b/uploader/templates/populations/macro-select-population.html
index af4fd3a..14b0510 100644
--- a/uploader/templates/populations/macro-select-population.html
+++ b/uploader/templates/populations/macro-select-population.html
@@ -1,30 +1,52 @@
-{%macro select_population_form(form_action, populations)%}
-<form method="GET" action="{{form_action}}">
-  <legend>Select Population</legend>
-
-  <div class="form-group">
-    <label for="select-population" class="form-label">Select Population</label>
-    <select id="select-population"
-            name="population_id"
-            class="form-control"
-            required="required">
-      <option value="">Select Population</option>
-      {%for family in populations%}
-      <optgroup {%if family[0][1] is not none%}
-                label="{{family[0][1]}}"
-                {%else%}
-                label="Undefined"
-                {%endif%}>
-        {%for population in family[1]%}
-        <option value="{{population.Id}}">{{population.FullName}}</option>
-        {%endfor%}
-      </optgroup>
-      {%endfor%}
-    </select>
+{%from "macro-step-indicator.html" import step_indicator%}
+
+{%macro select_population_form(form_action, species, populations)%}
+<form method="GET" action="{{form_action}}" class="form-horizontal">
+
+  <h2>{{step_indicator("2")}} What population do you want to work with?</h2>
+
+  {%if populations | length != 0%}
+
+  <p class="form-text">Search for, and select the population from the table
+    below and click "Continue"</p>
+
+  <div class="radio">
+    <label class="control-label" for="rdo-cant-find-population">
+      <input type="radio" id="rdo-cant-find-population"
+             name="population_id" value="CREATE-POPULATION" />
+      I cannot find the population I want &mdash; create it!
+    </label>
+  </div>
+
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit" value="continue" class="btn btn-primary" />
+  </div>
+
+  <div style="margin-top:3em;">
+    <table id="tbl-select-population" class="table compact stripe"
+           data-populations-list='{{populations | tojson}}'>
+      <thead>
+        <tr>
+          <th></th>
+          <th>Population</th>
+        </tr>
+      </thead>
+
+      <tbody></tbody>
+    </table>
   </div>
 
-  <div class="form-group">
-    <input type="submit" value="Select" class="btn btn-primary" />
+  {%else%}
+  <p class="form-text">
+    There are no populations currently defined for {{species['FullName']}}
+    ({{species['SpeciesName']}}).<br />
+    Click "Continue" to create the first!</p>
+  <input type="hidden" name="population_id" value="CREATE-POPULATION" />
+
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit" value="continue" class="btn btn-primary" />
   </div>
+  {%endif%}
+
 </form>
 {%endmacro%}
diff --git a/uploader/templates/populations/sui-base.html b/uploader/templates/populations/sui-base.html
new file mode 100644
index 0000000..cc01c9e
--- /dev/null
+++ b/uploader/templates/populations/sui-base.html
@@ -0,0 +1,12 @@
+{%extends "species/sui-base.html"%}
+
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.populations.view_population',
+           species_id=species['SpeciesId'],
+           population_id=population['Id'])}}">
+    {{population["FullName"]}}
+  </a>
+</li>
+{%endblock%}
diff --git a/uploader/templates/populations/sui-view-population.html b/uploader/templates/populations/sui-view-population.html
new file mode 100644
index 0000000..3bf8d0d
--- /dev/null
+++ b/uploader/templates/populations/sui-view-population.html
@@ -0,0 +1,138 @@
+{%extends "populations/sui-base.html"%}
+{%from "macro-step-indicator.html" import step_indicator%}
+{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
+
+{%block contents%}
+<div class="row">
+  <h2 class="heading">{{population.FullName}} ({{population.Name}})</h2>
+</div>
+
+<div class="row">
+  <ul class="nav nav-tabs" id="population-actions">
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="samples-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#samples-content"
+              type="button"
+              role="tab"
+              aria-controls="samples-content"
+              aria-selected="true">Samples</button></li>
+    <li class="nav-item presentation">
+      <button class="nav-link active"
+              id="phenotypes-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#phenotypes-content"
+              type="button"
+              role="tab"
+              aria-controls="phenotypes-content"
+              aria-selected="false">Phenotypes</button></li>
+    {%if view_under_construction%}
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="genotypes-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#genotypes-content"
+              type="button"
+              role="tab"
+              aria-controls="genotypes-content"
+              aria-selected="false">Genotypes</button></li>
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="expression-data-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#expression-data-content"
+              type="button"
+              role="tab"
+              aria-controls="expression-data-content"
+              aria-selected="false">Expression-Data</button></li>
+    {%endif%}
+  </ul>
+</div>
+
+<div class="row">
+  <div class="tab-content" id="populations-tabs-content">
+    <div class="tab-pane fade"
+         id="samples-content"
+         role="tabpanel"
+         aria-labelledby="samples-content-tab">
+      <p>Think of a <strong>"sample"</strong> as say a single case or individual
+        in the experiment. It could even be a single strain (where applicable)
+        under consideration.</p>
+      <p>This is a convenience feature for when you want to upload phenotypes to
+        the system, but do not have the genotypes data ready yet.</p>
+      <p>Please click the button below to provide the samples that will be used
+        in your data.</p>
+      <a href="{{url_for('species.populations.samples.list_samples',
+               species_id=species.SpeciesId,
+               population_id=population.Id)}}"
+         title="Upload samples for population '{{population['Name']}}'"
+         class="btn btn-primary">Upload Samples</a>
+    </div>
+
+    <div class="tab-pane fade show active"
+         id="phenotypes-content"
+         role="tabpanel"
+         aria-labelledby="phenotypes-content-tab">
+      <p>Upload and manage phenotypes and publications for population
+        "<em>{{population.FullName}} ({{population.Name}})</em>" of species
+        "<em>{{species.FullName}} ({{species.Name}})</em>".</p>
+
+      <p class="text-danger">Tabs will not work nicely here. Maybe present
+        options e.g.:
+      </p>
+      <div class="row">
+        <div class="col">
+          <a href="{{url_for('species.populations.phenotypes.view_dataset',
+                   species_id=species.SpeciesId,
+                   population_id=population.Id,
+                   dataset_id=dataset.Id)}}"
+             title="Upload phenotype data for population '{{population['Name']}}'"
+             class="btn btn-primary">Upload new Phenotypes</a>
+          <!-- Go straight to upload form(s). -->
+        </div>
+        <div class="col">
+          <a href="#"
+             title="List all existing phenotypes for this population."
+             class="btn btn-info not-implemented">list existing phenotypes</a>
+          <!-- Means and QTLReaper will be computed in this page. -->
+        </div>
+        <div class="col">
+          <a href="#"
+             title="List all existing publications for this population."
+             class="btn btn-info not-implemented">list existing publications</a>
+          <!-- Maybe, actually filter publications by population? -->
+          <!-- Provide other features for publications on loaded page. -->
+        </div>
+      </div>
+    </div>
+    <div class="tab-pane fade"
+         id="genotypes-content"
+         role="tabpanel"
+         aria-labelledby="genotypes-content-tab">
+      <p>This allows you to upload the data that concerns your genotypes.</p>
+      <p>Any samples/individuals/cases/strains that do not already exist in the
+        system will be added. This does not delete any existing data.</p>
+      <a href="{{url_for('species.populations.genotypes.list_genotypes',
+               species_id=species.SpeciesId,
+               population_id=population.Id)}}"
+         title="Upload genotype information for the '{{population.FullName}}' population of the '{{species.FullName}}' species."
+         class="btn btn-primary">upload genotypes</a>
+    </div>
+    <div class="tab-pane fade" id="expression-data-content" role="tabpanel" aria-labelledby="expression-data-content-tab">
+      <p>Upload expression data (mRNA data) for this population.</p>
+      <a href="#" title="" class="btn btn-primary">upload genotypes</a>
+    </div>
+  </div>
+</div>
+{%endblock%}
+
+{%block sidebarcontents%}
+<div class="row">
+  <p>Each tab presents a feature that's available at the population level.
+    Select the tab that allows you to continue with your task.</p>
+</div>
+{{display_sui_population_card(species, population)}}
+{%endblock%}
+
+
diff --git a/uploader/templates/populations/view-population.html b/uploader/templates/populations/view-population.html
index b23caeb..3b9661b 100644
--- a/uploader/templates/populations/view-population.html
+++ b/uploader/templates/populations/view-population.html
@@ -42,8 +42,10 @@
     <dt>Family</dt>
     <dd>{{population.Family}}</dd>
 
-    <dt>Description</dt>
-    <dd><pre>{{population.Description or "-"}}</pre></dd>
+    <dt>Information</dt>
+    <dd><a href="https://info.genenetwork.org/species/source.php?SpeciesName={{species.Name}}&InbredSetName={{population.Name}}"
+           title="Link to detailed information on this population."
+           target="_blank">Population Information</a></dd>
   </dl>
 </div>