about summary refs log tree commit diff
path: root/uploader/templates/species
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/species')
-rw-r--r--uploader/templates/species/base.html17
-rw-r--r--uploader/templates/species/create-species.html148
-rw-r--r--uploader/templates/species/edit-species.html177
-rw-r--r--uploader/templates/species/list-species.html75
-rw-r--r--uploader/templates/species/macro-display-species-card.html22
-rw-r--r--uploader/templates/species/macro-select-species.html59
-rw-r--r--uploader/templates/species/view-species.html90
7 files changed, 588 insertions, 0 deletions
diff --git a/uploader/templates/species/base.html b/uploader/templates/species/base.html
new file mode 100644
index 0000000..f64f72b
--- /dev/null
+++ b/uploader/templates/species/base.html
@@ -0,0 +1,17 @@
+{%extends "base.html"%}
+
+{%block lvl1_breadcrumbs%}
+<li {%if activelink=="species"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  {%if species is mapping%}
+  <a href="{{url_for('species.view_species', species_id=species.SpeciesId)}}">
+    {{species.Name}}</a>
+  {%else%}
+  <a href="{{url_for('species.list_species')}}">Species</a>
+  {%endif%}
+</li>
+{%block lvl2_breadcrumbs%}{%endblock%}
+{%endblock%}
diff --git a/uploader/templates/species/create-species.html b/uploader/templates/species/create-species.html
new file mode 100644
index 0000000..138dbaa
--- /dev/null
+++ b/uploader/templates/species/create-species.html
@@ -0,0 +1,148 @@
+{%extends "species/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}Create Species{%endblock%}
+
+{%block pagetitle%}Create Species{%endblock%}
+
+{%block lvl2_breadcrumbs%}
+<li {%if activelink=="create-species"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  <a href="{{url_for('species.create_species')}}">Create</a>
+</li>
+{%endblock%}
+
+{%block contents%}
+<div class="row">
+  <form id="frm-create-species"
+        method="POST"
+        action="{{url_for('species.create_species', return_to=return_to)}}"
+        class="form-horizontal">
+    <legend>Create Species</legend>
+
+    {{flash_all_messages()}}
+
+    <input type="hidden" name="return_to" value="{{return_to}}">
+
+    <div class="form-group">
+      <label for="txt-taxonomy-id" class="control-label col-sm-2">
+        Taxonomy ID</label>
+      <div class="col-sm-10">
+        <div class="input-group">
+          <input id="txt-taxonomy-id"
+                 name="species_taxonomy_id"
+                 type="text"
+                 class="form-control" />
+          <span class="input-group-btn">
+            <button id="btn-search-taxonid" class="btn btn-info">Search</button>
+          </span>
+        </div>
+        <small class="form-text text-small text-muted">
+          Use
+          <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/"
+             title="NCBI's Taxonomy Browser homepage"
+             target="_blank">
+            NCBI's Taxonomy Browser homepage</a> to search for the species you
+          want. If the species exists on NCBI, they will have a Taxonomy ID. Copy
+          that Taxonomy ID to this field, and click "Search" to auto-fill the
+          details.<br />
+          This field is optional.</small>
+      </div>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-name" class="control-label col-sm-2">Common Name</label>
+      <div class="col-sm-10">
+        <input id="txt-species-name"
+               name="common_name"
+               type="text"
+               class="form-control"
+               required="required" />
+        <small class="form-text text-muted">This is the day-to-day term used by
+          laymen, e.g. Mouse (instead of Mus musculus), round worm (instead of
+          Ascaris lumbricoides), etc.<br />
+          For species without this, just enter the scientific name.
+        </small>
+      </div>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-scientific" class="control-label col-sm-2">
+        Scientific Name</label>
+      <div class="col-sm-10">
+        <input id="txt-species-scientific"
+               name="scientific_name"
+               type="text"
+               class="form-control"
+               required="required" />
+        <small class="form-text text-muted">This is the scientific name for the
+          species e.g. Homo sapiens, Mus musculus, etc.</small>
+      </div>
+    </div>
+
+    <div class="form-group">
+      <label for="select-species-family" class="control-label col-sm-2">Family</label>
+      <div class="col-sm-10">
+        <select id="select-species-family"
+                name="species_family"
+                required="required"
+                class="form-control">
+          <option value="ungrouped">I do not know what to pick</option>
+          {%for family in families%}
+          <option value="{{family}}">{{family}}</option>
+          {%endfor%}
+        </select>
+        <small class="form-text text-muted">
+          This is a rough grouping of the species.</small>
+      </div>
+    </div>
+
+    <div class="col-sm-offset-2 col-sm-10">
+      <input type="submit"
+             value="create new species"
+             class="btn btn-primary" />
+    </div>
+
+  </form>
+</div>
+{%endblock%}
+
+{%block javascript%}
+<script>
+  var lastTaxonId = null;
+
+  var fetch_taxonomy = (taxonId) => {
+      var uri = (
+          "https://rest.uniprot.org/taxonomy/" + encodeURIComponent(taxonId));
+      $.get(
+          uri,
+          {},
+          (data, textStatus, jqXHR) => {
+              if(textStatus == "success") {
+                  lastTaxonId = taxonId;
+                  $("#txt-species-scientific").val(data.scientificName);
+                  $("#txt-species-name").val(data.commonName);
+                  return false;
+              }
+              msg = (
+                  "Request to '${uri}' failed with message '${textStatus}'. "
+                      + "Please try again later, or fill the details manually.");
+              alert(msg);
+              console.error(msg, data, textStatus);
+              return false;
+          },
+          "json");
+  };
+
+  $("#btn-search-taxonid").on("click", (event) => {
+      event.preventDefault();
+      taxonId = $("#txt-taxonomy-id").val();
+      if((taxonId !== "") && (taxonId !== lastTaxonId)) {
+          fetch_taxonomy(taxonId);
+      }
+  });
+</script>
+{%endblock%}
diff --git a/uploader/templates/species/edit-species.html b/uploader/templates/species/edit-species.html
new file mode 100644
index 0000000..5a26455
--- /dev/null
+++ b/uploader/templates/species/edit-species.html
@@ -0,0 +1,177 @@
+{%extends "species/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}Edit Species{%endblock%}
+
+{%block pagetitle%}Edit Species{%endblock%}
+
+{%block css%}
+<style type="text/css">
+  .card {
+      margin-top: 0.3em;
+      border-width: 1px;
+      border-style: solid;
+      border-radius: 0.3em;
+      border-color: #AAAAAA;
+      padding: 0.5em;
+  }
+</style>
+{%endblock%}
+
+{%block lvl2_breadcrumbs%}
+<li {%if activelink=="edit-species"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  <a href="{{url_for('species.edit_species_extra',
+           species_id=species.SpeciesId)}}">Edit</a>
+</li>
+{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+<div class="row">
+  <form id="frm-edit-species"
+        method="POST"
+        action="{{url_for('species.edit_species_extra',
+                species_id=species.SpeciesId)}}">
+
+    <legend>Edit Extra Detail for Species '{{species.FullName}}'</legend>
+
+    <input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
+
+    <div class="form-group">
+      <label for="lbl-species-taxonid" class="form-label">
+        Taxonomy Id
+      </label>
+      <label id="lbl-species-taxonid"
+             disabled="disabled"
+             class="form-control">{{species.TaxonomyId}}</label>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-name" class="form-label">
+        Common Name
+      </label>
+      <input type="text"
+             id="txt-species-name"
+             name="species_name"
+             required="required"
+             value="{{species.SpeciesName}}"
+             class="form-control" />
+      <small class="form-text text-muted">
+        This is the layman's name for the species, e.g. mouse</mall>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-fullname" class="form-label">
+        Scientific Name
+      </label>
+      <input type="text"
+             id="txt-species-fullname"
+             name="species_fullname"
+             required="required"
+             value="{{species.FullName}}"
+             class="form-control" />
+      <small class="form-text text-muted">
+        A scientific name for the species that mostly adheres to the biological
+        binomial nomenclature system.</small>
+    </div>
+
+    <div class="form-group">
+      <label for="select-species-family" class="form-label">
+        Family
+      </label>
+      <select id="select-species-family"
+              name="species_family"
+              class="form-control">
+        <option value="">Select the family</option>
+        {%for family in families%}
+        <option value="{{family}}"
+                {%if species.Family == family%}
+                selected="selected"
+                {%endif%}>{{family}}</option>
+        {%endfor%}
+      </select>
+      <small class="form-text text-muted">
+        A general classification for the species. This is mostly for use in
+        GeneNetwork's menus.</small>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-familyorderid" class="form-label">
+        Family Order Id
+      </label>
+      <input type="number"
+             id="txt-species-familyorderid"
+             name="species_familyorderid"
+             value="{{species.FamilyOrderId}}"
+             required="required"
+             class="form-control" />
+      <small class="form-text text-muted">
+        This is a number that determines the order of the "Family" groupings
+        above in the GeneNetwork menus. This is an integer value that's manually
+        assigned.</small>
+    </div>
+
+    <div class="form-group">
+      <label for="txt-species-orderid" class="form-label">
+        Order Id
+      </label>
+      <input type="number"
+             id="txt-species-orderid"
+             name="species_orderid"
+             value="{{species.OrderId or (max_order_id + 5)}}"
+             class="form-control" />
+      <small class="form-text text-muted">
+        This integer value determines the order of the species in relation to
+        each other, but also within the respective "Family" groups.</small>
+    </div>
+
+    <div class="form-group">
+      <input type="submit" value="Submit Changes" class="btn btn-primary" />
+    </div>
+
+  </form>
+</div>
+{%endblock%}
+
+{%block sidebarcontents%}
+
+<div class="card">
+  <div class="card-body">
+    <h5 class="card-title">Family Order</h5>
+    <div class="card-text">
+      <p>The current family order is as follows</p>
+      <table class="table">
+        <thead>
+          <tr>
+            <th>Family Order Id</th>
+            <th>Family</th>
+          </tr>
+        </thead>
+        <tbody>
+          {%for item in family_order%}
+          <tr>
+            <td>{{item[0]}}</td>
+            <td>{{item[1]}}</td>
+          </tr>
+          {%endfor%}
+        </tbody>
+      </table>
+    </div>
+  </div>
+</div>
+
+<div class="card">
+  <div class="card-body">
+    <h5 class="card-title">Order ID</h5>
+    <div class="card-text">
+      <p>The current largest OrderID is: {{max_order_id}}</p>
+      <p>We recommend giving a new species an order ID that is five more than
+        the current highest i.e. {{max_order_id + 5}}.</p>
+    </div>
+  </div>
+</div>
+{%endblock%}
diff --git a/uploader/templates/species/list-species.html b/uploader/templates/species/list-species.html
new file mode 100644
index 0000000..64084b0
--- /dev/null
+++ b/uploader/templates/species/list-species.html
@@ -0,0 +1,75 @@
+{%extends "species/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}List Species{%endblock%}
+
+{%block pagetitle%}List Species{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+<div class="row">
+  <p>
+    All data in GeneNetwork revolves around species. This is the core of the
+    system.</p>
+  <p>Here you can see a list of all the species available in GeneNetwork.
+    Click on the link besides each species to view greater detail on the species,
+    and access further operations that are possible for said species.</p>
+</div>
+
+<div class="row">
+  <p>If you cannot find the species you are looking for below, click the button
+    below to create it</p>
+  <p><a href="{{url_for('species.create_species')}}"
+        title="Add a new species to GeneNetwork"
+        class="btn btn-danger">Create Species</a></p>
+</div>
+
+<div class="row">
+  <table class="table">
+    <caption>Available Species</caption>
+    <thead>
+      <tr>
+        <th></td>
+        <th title="A common, layman's name for the species.">Common Name</th>
+        <th title="The scientific name for the species">Organism Name</th>
+        <th title="An identifier for the species in the NCBI taxonomy database">
+          Taxonomy ID
+        </th>
+        <th title="A generic grouping used internally by GeneNetwork for organising species.">
+          Family
+        </th>
+      </tr>
+    </thead>
+    <tbody>
+      {%for species in allspecies%}
+      <tr>
+        <td>{{species["sequence_number"]}}</td>
+        <td>{{species["SpeciesName"]}}</td>
+        <td>
+          <a href="{{url_for('species.view_species',
+                   species_id=species['SpeciesId'])}}"
+             title="View details in GeneNetwork on {{species['FullName']}}">
+            {{species["FullName"]}}
+          </a>
+        </td>
+        <td>
+          <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id={{species['TaxonomyId']}}"
+             title="View species details on NCBI"
+             target="_blank">{{species["TaxonomyId"]}}</a>
+        </td>
+        <td>{{species.Family}}</td>
+      </tr>
+      {%else%}
+      <tr>
+        <td colspan="3">
+          <p class="text-danger">
+            <span class="glyphicon glyphicon-exclamation-mark"></span>
+            There were no species found!
+          </p>
+        </td>
+      </tr>
+      {%endfor%}
+    </tbody>
+  </table>
+</div>
+{%endblock%}
diff --git a/uploader/templates/species/macro-display-species-card.html b/uploader/templates/species/macro-display-species-card.html
new file mode 100644
index 0000000..166c7b9
--- /dev/null
+++ b/uploader/templates/species/macro-display-species-card.html
@@ -0,0 +1,22 @@
+{%macro display_species_card(species)%}
+<div class="card">
+  <div class="card-body">
+    <h5 class="card-title">Species</h5>
+    <div class="card-text">
+      <table class="table">
+        <tbody>
+          <tr>
+            <td>Common Name</td>
+            <td>{{species.SpeciesName}}</td>
+          </tr>
+
+          <tr>
+            <td>Scientific Name</td>
+            <td>{{species.FullName}}</td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </div>
+</div>
+{%endmacro%}
diff --git a/uploader/templates/species/macro-select-species.html b/uploader/templates/species/macro-select-species.html
new file mode 100644
index 0000000..3714ae4
--- /dev/null
+++ b/uploader/templates/species/macro-select-species.html
@@ -0,0 +1,59 @@
+{%from "macro-step-indicator.html" import step_indicator%}
+
+{%macro select_species_form(form_action, species)%}
+<form method="GET" action="{{form_action}}" class="form-horizontal">
+
+  <h2>{{step_indicator("1")}} What species do you want to work with?</h2>
+
+  {%if species | length != 0%}
+
+  <p class="form-text">Search for, and select the species from the table below
+    and click "Continue"</p>
+
+  <div class="radio">
+    <label for="rdo-cant-find-species"
+           style="font-weight: 1;">
+      <input id="rdo-cant-find-species" type="radio" name="species_id"
+             value="CREATE-SPECIES" />
+      I could not find the species I want (create it).
+    </label>
+  </div>
+
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit"
+           class="btn btn-primary"
+           value="continue" />
+  </div>
+
+  <div style="margin-top:3em;">
+    <table id="tbl-select-species" class="table compact stripe"
+           data-species-list='{{species | tojson}}'>
+      <div class="">
+        <thead>
+          <tr>
+            <th></th>
+            <th>Species Name</th>
+          </tr>
+        </thead>
+
+        <tbody></tbody>
+    </table>
+    </div>
+
+    {%else%}
+
+    <label class="control-label" for="rdo-cant-find-species">
+      <input id="rdo-cant-find-species" type="radio" name="species_id"
+             value="CREATE-SPECIES" />
+      There are no species to select from. Create the first one.</label>
+
+    <div class="col-sm-offset-10 col-sm-2">
+      <input type="submit"
+             class="btn btn-primary col-sm-offset-1"
+             value="continue" />
+    </div>
+
+    {%endif%}
+
+</form>
+{%endmacro%}
diff --git a/uploader/templates/species/view-species.html b/uploader/templates/species/view-species.html
new file mode 100644
index 0000000..2d02f7e
--- /dev/null
+++ b/uploader/templates/species/view-species.html
@@ -0,0 +1,90 @@
+{%extends "species/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}View Species{%endblock%}
+
+{%block pagetitle%}View Species{%endblock%}
+
+{%block lvl2_breadcrumbs%}
+<li {%if activelink=="view-species"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  <a href="{{url_for('species.view_species', species_id=species.SpeciesId)}}">View</a>
+</li>
+{%endblock%}
+
+{%block contents%}
+{{flash_all_messages()}}
+<div class="row">
+  <h2>Details on species {{species.FullName}}</h2>
+
+  <dl>
+    <dt>Common Name</dt>
+    <dd>{{species.SpeciesName}}</dd>
+
+    <dt>Scientific Name</dt>
+    <dd>{{species.FullName}}</dd>
+
+    <dt>Taxonomy ID</dt>
+    <dd>{{species.TaxonomyId}}</dd>
+  </dl>
+
+  <h3>Actions</h3>
+
+  <p>
+    You can proceed to perform any of the following actions for species
+    {{species.FullName}}
+  </p>
+
+  <ol>
+    <li>
+      <a href="{{url_for('species.populations.list_species_populations',
+               species_id=species.SpeciesId)}}"
+         title="Create/Edit populations for {{species.FullName}}">
+        Manage populations</a>
+    </li>
+    <li>
+      <a href="{{url_for('species.platforms.list_platforms',
+               species_id=species.SpeciesId)}}"
+         title="Create/Edit sequencing platforms for {{species.FullName}}">
+        Manage sequencing platforms</a>
+    </li>
+  </ol>
+
+  
+</div>
+{%endblock%}
+
+{%block sidebarcontents%}
+<div class="card">
+  <div class="card-body">
+    <h5 class="card-title">Species Extras</h5>
+    <div class="card-text">
+      <p>Some extra internal-use details (mostly for UI concerns on GeneNetwork)</p>
+      <p>
+        <small>
+          If you do not understand what the following are about, simply ignore them
+          &mdash;
+          They have no bearing whatsoever on your data, or its analysis.
+        </small>
+      </p>
+      <dl>
+        <dt>Family</dt>
+        <dd>{{species.Family}}</dd>
+
+        <dt>FamilyOrderId</dt>
+        <dd>{{species.FamilyOrderId}}</dd>
+
+        <dt>OrderId</dt>
+        <dd>{{species.OrderId}}</dd>
+      </dl>
+    </div>
+    <a href="{{url_for('species.edit_species_extra',
+             species_id=species.SpeciesId)}}"
+       class="card-link"
+       title="Edit the species' internal-use details.">Edit</a>
+  </div>
+</div>
+{%endblock%}