diff options
Diffstat (limited to 'uploader/genotypes/views.py')
-rw-r--r-- | uploader/genotypes/views.py | 27 |
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") |