about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--uploader/templates/genotypes/add-genotypes-records-base.html39
-rw-r--r--uploader/templates/genotypes/add-genotypes-records-csv.html146
-rw-r--r--uploader/templates/macro-csv-fields.html102
3 files changed, 287 insertions, 0 deletions
diff --git a/uploader/templates/genotypes/add-genotypes-records-base.html b/uploader/templates/genotypes/add-genotypes-records-base.html
new file mode 100644
index 0000000..bf3812f
--- /dev/null
+++ b/uploader/templates/genotypes/add-genotypes-records-base.html
@@ -0,0 +1,39 @@
+{%extends "genotypes/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}Genotypes{%endblock%}
+
+{%block pagetitle%}Genotypes{%endblock%}
+
+{%block contents%}
+
+<div class="row">
+  <form id="frm-add-genotypes-records"
+        method="POST"
+        enctype="multipart/form-data"
+        action="{{url_for(
+                'species.populations.genotypes.add_genotype_records',
+                species_id=species.SpeciesId, population_id=population.Id,
+                dataset_id=dataset.Id)}}"
+        data-resumable-target="{{url_for('files.resumable_upload_post')}}">
+    <legend>Add New Genotype Records</legend>
+
+    {%block frm_add_genotypes_records_elements%}{%endblock%}
+
+    <div class="form-group">
+      <input type="submit"
+             value="upload genotypes"
+             class="btn btn-primary" />
+    </div>
+  </form>
+</div>
+
+<div class="row">
+  <h2 class="heading" id="page-documentation">Help</h2>
+  {%block page_documentation%}{%endblock%}
+</div>
+{%endblock%}
+
+
+{%block javascript%}
+{%endblock%}
diff --git a/uploader/templates/genotypes/add-genotypes-records-csv.html b/uploader/templates/genotypes/add-genotypes-records-csv.html
new file mode 100644
index 0000000..58dbe81
--- /dev/null
+++ b/uploader/templates/genotypes/add-genotypes-records-csv.html
@@ -0,0 +1,146 @@
+{%extends "genotypes/add-genotypes-records-base.html"%}
+{%from "phenotypes/macro-display-preview-table.html" import display_preview_table%}
+{%from "macro-csv-fields.html" import display_csv_fields, display_csv_fields_documentation%}
+{%from "phenotypes/macro-display-resumable-elements.html" import display_resumable_elements%}
+
+{%block frm_add_genotypes_records_elements%}
+<div class="form-text help-block">
+  <p>You can add new genotype records here.</p>
+</div>
+
+{{display_csv_fields()}}
+
+<div class="form-group">
+  <div class="non-resumable-elements">
+    <label for="finput-genotypes-records-file" class="form-label">
+      genotypes records</label>
+    <input id="finput-genotypes-records-file"
+           name="genotypes-records-file"
+           class="form-control"
+           type="file"
+           data-preview-table="tbl-preview-geno-records"
+           required="required"  />
+    <span class="form-text text-muted">
+      Provide a file that contains only the genotypes records,
+      <a href="#docs-file-genotypes-records-csv"
+         title="Documentation of the genotypes records file format.">
+        the documentation for the expected format of the file</a>.</span>
+  </div>
+  {{display_resumable_elements(
+  "resumable-genotypes-records-file",
+  "Genotypes records",
+  '<p>Drag and drop the CSV file here, that contains the genotype records you
+    want to add.</p>
+
+  <p>Please see the
+    <a href="#docs-file-genotypes-records"
+       title="Documentation of the genotypes records data file format.">
+      "Genotypes records" documentation</a> section below for more
+    information on the expected format of the file provided here.</p>')}}
+  {{display_preview_table("tbl-preview-geno-records", "genotypes records")}}
+</div>
+
+<div class="">
+  <h4 class="subheading">Genotype Encoding</h4>
+  <div class="form-text help-block">
+    <p>The symbols in your genotype file need to be mapped to known values to
+      enable mapping.</p>
+  </div>
+
+  <div class="form-group">
+    <div class="row mb-3">
+      <label for="txt-geno-encoding-mat"
+             class="col-form-label col-sm-2">Maternal</label>
+      <div class="col-sm-10">
+        <div class="input-group">
+        <input type="text"
+               maxlength="3"
+               id="txt-geno-encoding-mat"
+               name="geno_encoding_mat"
+               class="form-control" />
+        <div class="input-group-append">
+          <span class="input-group-text">Value = -1</span>
+        </div>
+        </div>
+      </div>
+      <span class="form-text text-muted col-sm-12">
+        Enter the symbol in your file that represents the allele inherited from
+        the mother. This allele will be mapped to the value -1.</span>
+    </div>
+  </div>
+
+  <div class="form-group">
+    <div class="row mb-3">
+      <label for="txt-geno-encoding-pat"
+             class="col-form-label col-sm-2">Paternal</label>
+      <div class="col-sm-10">
+        <div class="input-group">
+          <input type="text"
+                 maxlength="3"
+                 id="txt-geno-encoding-pat"
+                 name="geno_encoding_pat"
+                 class="form-control" />
+          <div class="input-group-append">
+            <span class="input-group-text">Value = 1</span>
+          </div>
+        </div>
+      </div>
+      <span class="form-text text-muted">
+        Enter the symbol in your file that represents the allele inherited from
+        the father. This allele will be mapped to the value 1.</span>
+    </div>
+  </div>
+
+  <div class="form-group">
+    <div class="row mb-3">
+      <label for="txt-geno-encoding-het"
+             class="col-form-label col-sm-2">Heterozygous (value = 0)</label>
+      <div class="col-sm-10">
+        <div class="input-group">
+          <input type="text"
+                 maxlength="3"
+                 id="txt-geno-encoding-het"
+                 name="geno_encoding_het"
+                 class="form-control" />
+          <div class="input-group-append">
+            <span class="input-group-text">Value = 0</span>
+          </div>
+        </div>
+      </div>
+      <span class="form-text text-muted">
+        Enter the symbol in your file that represents the allele inherited from
+        both parents. This allele will be mapped to the value 0.</span>
+    </div>
+  </div>
+</div>
+{%endblock%}
+
+{%block page_documentation%}
+{{super()}}
+
+<h3 class="sub-heading">CSV file metadata</h3>
+{{display_csv_fields_documentation()}}
+{%endblock%}
+
+{%block javascript%}
+{{super()}}
+<script src="{{url_for('base.node_modules',
+             filename='resumablejs/resumable.js')}}"></script>
+<script src="/static/js/files.js"></script>
+
+<script type="text/javascript">
+  $(function(evt) {
+      
+      var preview_tables_to_elements_map = {
+          "#tbl-preview-geno-records": "#finput-genotypes-records-file",
+      };
+
+      makeResumableObject(
+          form_id="frm-add-genotypes-records",
+          file_input_id="finput-genotypes-records-file",
+          resumable_element_id="resumable-genotypes-records-file",
+          preview_table_id="tbl-preview-geno-records",
+          filetypes=["csv", "tsv", "txt", "geno"]);
+  });
+</script>
+{%endblock%}
diff --git a/uploader/templates/macro-csv-fields.html b/uploader/templates/macro-csv-fields.html
new file mode 100644
index 0000000..d4b0f57
--- /dev/null
+++ b/uploader/templates/macro-csv-fields.html
@@ -0,0 +1,102 @@
+{%macro display_csv_fields()%}
+<div class="form-group">
+  <label for="txt-file-separator" class="form-label">File Separator</label>
+  <div class="input-group">
+    <input id="txt-file-separator"
+           name="file-separator"
+           type="text"
+           value="&#9;"
+           class="form-control"
+           maxlength="1" />
+    <span class="input-group-btn">
+      <button id="btn-reset-file-separator" class="btn btn-info">Reset Default</button>
+    </span>
+  </div>
+  <span class="form-text text-muted">
+    Provide the character that separates the fields in your file(s). It should
+    be the same character for all files (if more than one is provided).<br />
+    A tab character will be assumed if you leave this field blank. See
+    <a href="#docs-file-separator"
+       title="Documentation for file-separator characters">
+      documentation for more information</a>.
+  </span>
+</div>
+
+<div class="form-group">
+  <label for="txt-file-comment-character" class="form-label">File Comment-Characters</label>
+  <div class="input-group">
+    <input id="txt-file-comment-character"
+           name="file-comment-character"
+           type="text"
+           value="#"
+           class="form-control" />
+    <span class="input-group-btn">
+      <button id="btn-reset-file-comment-character" class="btn btn-info">
+        Reset Default</button>
+    </span>
+  </div>
+  <span class="form-text text-muted">
+    This specifies that lines that begin with the character(s) provided will be
+    considered comment lines and ignored in their entirety. See
+    <a href="#docs-file-comment-character"
+       title="Documentation for comment characters">
+      documentation for more information</a>.
+  </span>
+</div>
+
+<div class="form-group">
+  <label for="txt-file-na" class="form-label">File "No-Value" Indicators</label>
+  <div class="input-group">
+    <input id="txt-file-na"
+           name="file-na"
+           type="text"
+           value="- NA N/A"
+           class="form-control" />
+    <span class="input-group-btn">
+      <button id="btn-reset-file-na" class="btn btn-info">Reset Default</button>
+    </span>
+  </div>
+  <span class="form-text text-muted">
+    This specifies strings in your file indicate that there is no value for a
+    particular cell (a cell is where a column and row intersect). Provide a
+    space-separated list of strings if you have more than one way of
+    indicating no values. See
+    <a href="#docs-file-na" title="Documentation for no-value fields">
+      documentation for more information</a>.</span>
+</div>
+{%endmacro%}
+
+
+{%macro display_csv_fields_documentation()%}
+<dl>
+  <dt id="docs-file-separator">File separator</dt>
+  <dd>The files you provide should be character-separated value (CSV) files.
+    We need to know what character you used to separate the values in your
+    file. Some common ones are the Tab character, the comma, etc.<br />
+    Providing that information makes it possible for the system to parse and
+    process your files correctly.<br>
+    <strong>NOTE:</strong> All the files you upload MUST use the same
+    separator.</dd>
+
+  <dt id="docs-file-comment-character">Comment characters</dt>
+  <dd>We support use of comment lines in your files. We only support one type
+    of comment style, the <em>line comment</em>.<br />
+    This mean the comment begins at the start of the line, and the end of that
+    line indicates the end of that comment. If you have a really long comment,
+    then you need to break it across multiple lines, marking each line a
+    comment line.<br />
+    The "comment character" is the character at the start of the line that
+    indicates that the line is a line comment.<br />
+    You can provide more than one comment character, separated by spaces.</dd>
+
+  <dt id="docs-file-na">No-Value indicator(s)</dt>
+  <dd>Data in the real world is messy, and in some cases, entirely absent. You
+    need to indicate, in your files, that a particular field did not have a
+    value, and once you do that, you then need to let the system know how you
+    mark such fields. Common ways of indicating "empty values" are, leaving
+    the field blank, using a character such as '-', or using strings like
+    "NA", "N/A", "NULL", etc.<br />
+    Providing this information will help with parsing and processing such
+    no-value fields the correct way.</dd>
+</dl>
+{%endmacro%}