Skip to content

Commit

Permalink
issue #814 - T2T - handle looking up contig if build not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
davmlaw committed Dec 5, 2024
1 parent f99cb81 commit 42c5b7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions snpdb/templates/snpdb/genomics/view_contig.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@
</div>
</div>

{% if has_annotation %}
<div class="card">
<div class="card-header">Genes on contig</div>
<div class="card-body">
{% load jqgrid_tags %}
{% jqgrid 'genes_grid' 'gene-annotation-versions' genome_build_name=genome_build.name search=False delete=False jqgrid_config_get_parameters_func='getConfigUrl' %}
</div>
</div>
{% else %}
This build has no annotation, so we can't list genes
{% endif %}

</div>

Expand Down
3 changes: 3 additions & 0 deletions snpdb/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,10 @@ def view_contig(request, contig_accession):
# Prefer builds with annotation
builds_with_annotation = list(contig.get_genome_builds(require_annotation=True))
if builds_with_annotation:
has_annotation = True
builds = builds_with_annotation
else:
has_annotation = False
builds = list(contig.get_genome_builds(require_annotation=False))

if builds:
Expand All @@ -1671,6 +1673,7 @@ def view_contig(request, contig_accession):
context = {
"contig": contig,
"genome_build": genome_build,
"has_annotation" : has_annotation,
}
return render(request, "snpdb/genomics/view_contig.html", context)

Expand Down

0 comments on commit 42c5b7b

Please sign in to comment.