From b0991ec5cea1411237b82e92467603bf9da803f5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 17 Jun 2025 14:18:24 -0500 Subject: Allow users to provide transposed files. --- uploader/phenotypes/views.py | 4 ++++ .../phenotypes/add-phenotypes-raw-files.html | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'uploader') 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 @@ documentation for more information. + +
+
+ + +
+ + We expect the data in the file as a matrix of + samples × phenotypes, but it could be your file is + transposed, (i.e. it is a matrix of + “phenotypes × samples”, rather than the expected + form). +
+ If that is the case for your files, mark your files as trasposed by + ensuring that this checkbox is checked. +
+
-- cgit 1.4.1