aboutsummaryrefslogtreecommitdiff
path: root/uploader/genotypes/views.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-18 17:10:50 -0500
committerFrederick Muriuki Muriithi2024-09-18 17:11:53 -0500
commit66e7970c3ff5305f8a7d6d60d34b974389f8fe78 (patch)
tree6e6d5fd819dee82b88439c828e4083000ef6e1cf /uploader/genotypes/views.py
parent590ef1232032958dd448c2eaa9ca760e008a9687 (diff)
downloadgn-uploader-66e7970c3ff5305f8a7d6d60d34b974389f8fe78.tar.gz
Separate genetic markers from encodings and datasets
Diffstat (limited to 'uploader/genotypes/views.py')
-rw-r--r--uploader/genotypes/views.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py
index 0618949..2ff9965 100644
--- a/uploader/genotypes/views.py
+++ b/uploader/genotypes/views.py
@@ -90,6 +90,26 @@ def list_genotypes(species_id: int, population_id: int):
"species.populations.genotypes.select_population",
species_id=species_id))
+ return render_template("genotypes/list-genotypes.html",
+ species=species,
+ population=population,
+ genocode=genocode_by_population(
+ conn, population_id),
+ total_markers=genotype_markers_count(
+ conn, species_id),
+ activelink="list-genotypes")
+
+
+@genotypesbp.route("/<int:species_id>/genotypes/list-markers", methods=["GET"])
+@require_login
+def list_markers(species_id: int):
+ """List a species' genetic markers."""
+ with database_connection(app.config["SQL_URI"]) as conn:
+ species = species_by_id(conn, species_id)
+ if not bool(species):
+ flash("Invalid species provided!", "alert-danger")
+ return redirect(url_for("species.populations.genotypes.index"))
+
start_from = safe_int(request.args.get("start_from") or 0)
if start_from < 0:
start_from = 0
@@ -97,14 +117,11 @@ def list_genotypes(species_id: int, population_id: int):
markers = enumerate_sequence(
genotype_markers(conn, species_id, offset=start_from, limit=count),
start=start_from+1)
- return render_template("genotypes/list-genotypes.html",
+ return render_template("genotypes/list-markers.html",
species=species,
- population=population,
- genocode=genocode_by_population(
- conn, population_id),
total_markers=genotype_markers_count(
conn, species_id),
start_from=start_from,
count=count,
markers=markers,
- activelink="list-genotypes")
+ activelink="list-markers")