aboutsummaryrefslogtreecommitdiff
path: root/qc_app/templates
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-12-06 13:00:53 +0300
committerFrederick Muriuki Muriithi2023-12-06 13:00:53 +0300
commit493f8fbe747650a4fbac2e0b153ad0074b4f91e4 (patch)
tree578fce7f9548c4a850a02b5817865e5fcb73d007 /qc_app/templates
parent968fc27c54099ec1ed5d1770925aed98013ecf55 (diff)
downloadgn-uploader-493f8fbe747650a4fbac2e0b153ad0074b4f91e4.tar.gz
Feature: Upload Samples/Cases
Implements the code enabling the upload of the samples/cases to the database.
Diffstat (limited to 'qc_app/templates')
-rw-r--r--qc_app/templates/flash_messages.html25
-rw-r--r--qc_app/templates/index.html35
-rw-r--r--qc_app/templates/samples/select-population.html105
-rw-r--r--qc_app/templates/samples/upload-samples.html107
4 files changed, 269 insertions, 3 deletions
diff --git a/qc_app/templates/flash_messages.html b/qc_app/templates/flash_messages.html
new file mode 100644
index 0000000..b7af178
--- /dev/null
+++ b/qc_app/templates/flash_messages.html
@@ -0,0 +1,25 @@
+{%macro flash_all_messages()%}
+{%with messages = get_flashed_messages(with_categories=true)%}
+{%if messages:%}
+<ul>
+ {%for category, message in messages:%}
+ <li class="{{category}}">{{message}}</li>
+ {%endfor%}
+</ul>
+{%endif%}
+{%endwith%}
+{%endmacro%}
+
+{%macro flash_messages(filter_class)%}
+{%with messages = get_flashed_messages(with_categories=true)%}
+{%if messages:%}
+<ul>
+ {%for category, message in messages:%}
+ {%if filter_class in category%}
+ <li class="{{category}}">{{message}}</li>
+ {%endif%}
+ {%endfor%}
+</ul>
+{%endif%}
+{%endwith%}
+{%endmacro%}
diff --git a/qc_app/templates/index.html b/qc_app/templates/index.html
index 2db6048..e534bcb 100644
--- a/qc_app/templates/index.html
+++ b/qc_app/templates/index.html
@@ -1,9 +1,11 @@
{%extends "base.html"%}
-{%block title%}Upload File{%endblock%}
+{%block title%}Data Upload{%endblock%}
{%block contents%}
-<h1 class="heading">upload file</h1>
+<h1 class="heading">data upload</h1>
+
+<h2>Expression Data</h2>
<div id="explainer">
<p>This application assumes that you are familiar with the basics of data
@@ -26,7 +28,7 @@
<form action="{{url_for('entry.upload_file')}}"
method="POST" enctype="multipart/form-data">
- <legend class="heading">upload file</legend>
+ <legend class="heading">upload expression data</legend>
{%with messages = get_flashed_messages(with_categories=True) %}
{%if messages %}
<div class="alerts">
@@ -81,6 +83,33 @@
</button>
</form>
</div>
+
+<h2>samples/cases</h2>
+
+<div>
+ <p>For the expression data above, you need the samples/cases in your file to
+ already exist in the GeneNetwork database. If there are any samples that do
+ not already exist the upload of the expression data will fail.</p>
+ <p>This section gives you the opportunity to upload any missing samples</p>
+</div>
+
+<form method="POST" action="{{url_for('samples.select_species')}}">
+ <legend class="heading">upload samples</legend>
+ <fieldset>
+ <label for="select:species">Species</label>
+ <select id="select:species" name="species_id" required="required">
+ <option value="">Select species</option>
+ {%for spec in species%}
+ <option value="{{spec.SpeciesId}}">{{spec.MenuName}}</option>
+ {%endfor%}
+ </select>
+ </fieldset>
+
+ <fieldset>
+ <input type="submit" value="submit" class="btn btn-main form-col-2" />
+ </fieldset>
+</form>
+
{%endblock%}
diff --git a/qc_app/templates/samples/select-population.html b/qc_app/templates/samples/select-population.html
new file mode 100644
index 0000000..24decb4
--- /dev/null
+++ b/qc_app/templates/samples/select-population.html
@@ -0,0 +1,105 @@
+{%extends "base.html"%}
+{%from "flash_messages.html" import flash_messages%}
+
+{%block title%}Select Grouping/Population{%endblock%}
+
+{%block contents%}
+<h1 class="heading">Select grouping/population</h1>
+
+<div>
+ <p>We organise the samples/cases/strains in a hierarchichal form, starting
+ with <strong>species</strong> at the very top. Under species, we have a
+ grouping in terms of the relevant population
+ (e.g. Inbred populations, cell tissue, etc.)</p>
+</div>
+
+<hr />
+
+<form method="POST" action="{{url_for('samples.select_population')}}">
+ <legend class="heading">select grouping/population</legend>
+ {{flash_messages("error-select-population")}}
+
+ <input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
+ <fieldset>
+ <label for="select:inbredset" class="form-col-1">grouping/population</label>
+ <select id="select:inbredset"
+ name="inbredset_id"
+ required="required"
+ class="form-col-2">
+ <option value="">Select a grouping/population</option>
+ {%for pop in populations%}
+ <option value="{{pop.InbredSetId}}">
+ {{pop.InbredSetName}} ({{pop.FullName}})</option>
+ {%endfor%}
+ </select>
+ </fieldset>
+
+ <fieldset>
+ <input type="submit"
+ value="select population"
+ class="btn btn-main form-col-2" />
+ </fieldset>
+</form>
+
+<p style="color:#FE3535; padding-left:20em; font-weight:bolder;">OR</p>
+
+<form method="POST" action="{{url_for('samples.create_population')}}">
+ <legend class="heading">create new grouping/population</legend>
+ {{flash_messages("error-create-population")}}
+
+ <input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
+ <fieldset>
+ <legend>mandatory</legend>
+ <label for="txt:inbredset-name" class="form-col-1">name</label>
+ <input id="txt:inbredset-name"
+ name="inbredset_name"
+ type="text"
+ required="required"
+ placeholder="Enter grouping/population name"
+ class="form-col-2" />
+
+ <label for="txt:" class="form-col-1">full name</label>
+ <input id="txt:inbredset-fullname"
+ name="inbredset_fullname"
+ type="text"
+ required = "required"
+ placeholder="Enter the grouping/population's full name"
+ class="form-col-2" />
+ </fieldset>
+ <fieldset>
+ <legend>Optional</legend>
+
+ <label for="num:public" class="form-col-1">public?</label>
+ <input id="num:public"
+ name="public"
+ type="number"
+ min="0" max="2" value="2"
+ class="form-col-2" />
+
+ <label for="txt:inbredset-family" class="form-col-1">family</label>
+ <input id="txt:inbredset-family"
+ name="inbredset_family"
+ type="text"
+ placeholder="I am not sure what this is about."
+ class="form-col-2" />
+
+ <label for="txtarea:" class="form-col-1">Description</label>
+ <textarea id="txtarea:description"
+ name="description"
+ rows="5"
+ placeholder="Enter a description of this grouping/population"
+ class="form-col-2"></textarea>
+ </fieldset>
+
+ <fieldset>
+ <input type="submit"
+ value="create grouping/population"
+ class="btn btn-main form-col-2" />
+ </fieldset>
+</form>
+
+{%endblock%}
+
+
+{%block javascript%}
+{%endblock%}
diff --git a/qc_app/templates/samples/upload-samples.html b/qc_app/templates/samples/upload-samples.html
new file mode 100644
index 0000000..b19e38c
--- /dev/null
+++ b/qc_app/templates/samples/upload-samples.html
@@ -0,0 +1,107 @@
+{%extends "base.html"%}
+{%from "flash_messages.html" import flash_messages%}
+
+{%block title%}Upload Samples{%endblock%}
+
+{%block css%}
+<style type="text/css">
+ #form-samples {
+ background-color: #D1D1D1;
+ }
+ #form-samples fieldset:nth-child(odd){
+ background-color: white;
+ }
+</style>
+{%endblock%}
+
+{%block contents%}
+<h1 class="heading">upload samples</h1>
+
+{{flash_messages("alert-success")}}
+
+<p>You can now upload a character-separated value (CSV) file that contains
+ details about your samples. The CSV file should have the following fields:
+ <dl>
+ <dt>Name</dt>
+ <dd>The primary name for the sample</dd>
+
+ <dt>Name2</dt>
+ <dd>A secondary name for the sample. This can simply be the same as
+ <strong>Name</strong> above. This field <strong>MUST</strong> contain a
+ value.</dd>
+
+ <dt>Symbol</dt>
+ <dd>A symbol for the sample. Can be an empty field.</dd>
+
+ <dt>Alias</dt>
+ <dd>An alias for the sample. Can be an empty field.</dd>
+ </dl>
+ </p>
+
+<form id="form-samples"
+ method="POST"
+ action="#"
+ enctype="multipart/form-data">
+ <legend class="heading">upload samples</legend>
+ <fieldset>
+ <input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
+ <label class="form-col-1">species:</label>
+ <label class="form-col-2">{{species.SpeciesName}} [{{species.MenuName}}]</label>
+ </fieldset>
+
+ <fieldset>
+ <input type="hidden" name="inbredset_id" value="{{population.InbredSetId}}" />
+ <label class="form-col-1">grouping/population:</label>
+ <label class="form-col-2">{{population.Name}} [{{population.FullName}}]</label>
+ </fieldset>
+
+ <fieldset>
+ <label for="select:separator" class="form-col-1">field separator</label>
+ <select id="select:separator"
+ name="separator"
+ required="required"
+ class="form-col-2">
+ <option value="">Select separator for your file</option>
+ <option value="&#x0009;">TAB</option>
+ <option value="&#x0020;">Space</option>
+ <option value=",">Comma</option>
+ <option value=";">Semicolon</option>
+ <option value="other">Other</option>
+ </select>
+ <input type="text" name="other_separator" class="form-col-2" />
+ <label class="form-col-2">
+ This is the character that separates the fields in your CSV file. If you
+ select "<strong>Other</strong>", then you must provide the separator in
+ the text field provided.
+ </label>
+ </fieldset>
+
+ <fieldset>
+ <label for="txt:delimiter" class="form-col-1">field delimiter</label>
+ <input type="text" name="field_delimiter" class="form-col-2" />
+ <label class="form-col-2">
+ If there is a character delimiting the string texts within particular
+ fields in your CSV, provide the character here. This can be left blank if
+ no such delimiters exist in your file.
+ </label>
+ </fieldset>
+
+ <fieldset>
+ <label for="file_upload" class="form-col-1">select file</label>
+ <input type="file" name="samples_file" id="file_upload"
+ accept="text/csv, text/tab-separated-values"
+ class="form-col-2" />
+ </fieldset>
+
+ <fieldset>
+ <input type="submit"
+ value="upload samples file"
+ class="btn btn-main form-col-2" />
+ </fieldset>
+</form>
+
+{%endblock%}
+
+
+{%block javascript%}
+{%endblock%}