aboutsummaryrefslogtreecommitdiff
path: root/qc_app/upload/rqtl2.py
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app/upload/rqtl2.py')
-rw-r--r--qc_app/upload/rqtl2.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
new file mode 100644
index 0000000..e54f141
--- /dev/null
+++ b/qc_app/upload/rqtl2.py
@@ -0,0 +1,31 @@
+"""Module to handle uploading of R/qtl2 bundles."""
+
+from flask import (
+ flash,
+ request,
+ url_for,
+ redirect,
+ Blueprint,
+ render_template)
+
+from qc_app.dbinsert import species as all_species
+from qc_app.dbinsert import species_by_id, groups_by_species
+from qc_app.db_utils import with_db_connection
+
+rqtl2 = Blueprint("rqtl2", __name__)
+
+@rqtl2.route("/", methods=["GET", "POST"])
+@rqtl2.route("/select-species", methods=["POST"])
+def select_species():
+ """Select the species."""
+ if request.method == "GET":
+ return render_template("rqtl2/index.html", species=all_species())
+
+ species_id = request.form.get("species_id")
+ species = with_db_connection(
+ lambda conn: species_by_id(conn, species_id))
+ if bool(species):
+ return redirect(url_for(
+ "upload.rqtl2.select_population", species_id=species_id))
+ flash("Invalid species or no species selected!", "alert-error error-rqtl2")
+ return redirect(url_for("upload.rqtl2.select_species"))