aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-17 14:18:24 -0500
committerFrederick Muriuki Muriithi2025-06-17 14:18:24 -0500
commitb0991ec5cea1411237b82e92467603bf9da803f5 (patch)
treee6052c3eeac84adf0da008c9b7ea11c051923fd1
parent2c21e5a1715f45e067298000327c389fd45f0909 (diff)
downloadgn-uploader-b0991ec5cea1411237b82e92467603bf9da803f5.tar.gz
Allow users to provide transposed files.HEADmain
-rw-r--r--scripts/rqtl2/phenotypes_qc.py4
-rw-r--r--uploader/phenotypes/views.py4
-rw-r--r--uploader/templates/phenotypes/add-phenotypes-raw-files.html22
3 files changed, 28 insertions, 2 deletions
diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py
index 699c291..5c89ca0 100644
--- a/scripts/rqtl2/phenotypes_qc.py
+++ b/scripts/rqtl2/phenotypes_qc.py
@@ -209,12 +209,12 @@ def qc_phenocovar_file(
(f"Record {_lc} in file {filepath.name} has a different "
"number of columns than the number of headings"))),)
_line = dict(zip(_headings, line))
- if not bool(_line["description"]):
+ if not bool(_line.get("description")):
_errs = _errs + (
save_error(InvalidValue(filepath.name,
_line[_headings[0]],
"description",
- _line["description"],
+ _line.get("description"),
"The description is not provided!")),)
rconn.hset(file_fqkey(fqkey, "metadata", filepath),
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 6bc7471..f4a302a 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -366,6 +366,7 @@ def process_phenotypes_rqtl2_bundle(error_uri):
def process_phenotypes_individual_files(error_uri):
"""Process the uploaded individual files."""
form = request.form
+ _transposed = (form.get("file-transposed") or "off") == "on"
cdata = {
"sep": form["file-separator"],
"comment.char": form["file-comment-character"],
@@ -400,6 +401,9 @@ def process_phenotypes_individual_files(error_uri):
arcname=filepath.name)
cdata[rqtlkey] = cdata.get(rqtlkey, []) + [filepath.name]
+ if rqtlkey not in ("phenocovar",):
+ cdata[f"{rqtlkey}_transposed"] = _transposed
+
zfile.writestr("control_data.json", data=json.dumps(cdata, indent=2))
return bundlepath
diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
index 697c7ad..5c6aaab 100644
--- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html
+++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
@@ -103,6 +103,28 @@
<a href="#docs-file-na" title="Documentation for no-value fields">
documentation for more information</a>.</span>
</div>
+
+ <div class="form-check form-group">
+ <div class="">
+ <input id="chk-file-transposed"
+ name="file-transposed"
+ type="checkbox"
+ class="form-check-input"
+ style="border: solid #8EABF0" />
+ <label for="chk-file-transposed" class="form-check-label">
+ File transposed</label>
+ </div>
+ <span class="form-text text-muted">
+ We expect the data in the file as a matrix of
+ <strong>samples × phenotypes</strong>, but it could be your file is
+ transposed, (i.e. it is a matrix of
+ &ldquo;<em>phenotypes × samples</em>&rdquo;, rather than the expected
+ form).
+ <br />
+ If that is the case for your files, mark your files as trasposed by
+ ensuring that this checkbox is checked.
+ </span>
+ </div>
</fieldset>
<fieldset id="fldset-data-files">