From 66e7970c3ff5305f8a7d6d60d34b974389f8fe78 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 18 Sep 2024 17:10:50 -0500 Subject: Separate genetic markers from encodings and datasets --- uploader/genotypes/views.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'uploader/genotypes') 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("//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") -- cgit v1.2.3