Skip to content

Commit

Permalink
Displaying disease gene icon also for SVs (#620).
Browse files Browse the repository at this point in the history
Related-Issue: #620
Closes: #620
Projected-Results-Impact: none
  • Loading branch information
holtgrewe committed Aug 25, 2022
1 parent 26ae2b2 commit 1b850e6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ End-User Summary
- Adding section presets for SV filtration (#616).
- Adjusting SV filtration presets (#616).
- Fix bug with thousand genomes frequencies in SV filtration (#619).
- Displaying disease gene icon also for SVs (#620).

Full Change List
================
Expand Down Expand Up @@ -85,6 +86,7 @@ Full Change List
- Adding section presets for SV filtration (#616).
- Adjusting SV filtration presets (#616).
- Fix bug with thousand genomes frequencies in SV filtration (#619).
- Displaying disease gene icon also for SVs (#620).

------
v1.2.0
Expand Down
7 changes: 7 additions & 0 deletions svs/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ExtendQueryPartsBase,
ExtendQueryPartsGenotypeDefaultBase,
ExtendQueryPartsCaseJoinAndFilter as _ExtendQueryPartsCaseJoinAndFilter,
ExtendQueryPartsDiseaseGeneJoin as _ExtendQueryPartsDiseaseGeneJoin,
)

#: Logger to use in this module.
Expand Down Expand Up @@ -682,6 +683,11 @@ class EnsemblRegulatoryFeatureTypes(enum.Enum):
TF_BINDING_SITE = "TF_binding_site"


class ExtendQueryPartsDiseaseGeneJoin(_ExtendQueryPartsDiseaseGeneJoin):

gene_id_model = StructuralVariantGeneAnnotation


class ExtendQueryPartsEnsemblRegulatoryJoinAndFilter(ExtendQueryPartsBase):
"""Extend ``QueryParts`` with information for ENSEMBL regulatory region overlap."""

Expand Down Expand Up @@ -951,6 +957,7 @@ def extend_selectable(self, query_parts):
ExtendQueryPartsVistaEnhancerJoinAndFilter,
ExtendQueryPartsRegMapJoinAndFilter,
ExtendQueryPartsHgncJoin,
ExtendQueryPartsDiseaseGeneJoin,
]


Expand Down
5 changes: 4 additions & 1 deletion svs/templates/svs/filter_result/row_sv.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@
<span class="text-muted">&empty; genes</span>
{% else %}
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary sodar-list-btn">
<button type="button" class="btn btn-outline-secondary sodar-list-btn" {% if entry.disease_gene %}title="disease gene"{% endif %}>
{% if not entry.symbol %}
{{ entry.gene_id }}
{% else %}
{{ entry.symbol }}
{% endif %}
{% if entry.disease_gene %}
<i class="iconify text-danger" data-icon="fa-regular:lightbulb"></i>
{% endif %}
</button>
<button
class="btn btn-primary sodar-list-btn"
Expand Down
1 change: 0 additions & 1 deletion svs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def form_valid(self, form):
query = SingleCaseFilterQuery(self.get_case_object(), get_engine())
args = dict(form.cleaned_data)
# TODO: variant types
print("XXX\n\n", args, "\n\nXXX")
with contextlib.closing(query.run(args)) as results:
context_data = self._fetch_context_data(form, results)
context_data["elapsed_seconds"] = timezone.now() - before
Expand Down
7 changes: 6 additions & 1 deletion variants/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,10 @@ def extend_selectable(self, query_parts):


class ExtendQueryPartsDiseaseGeneJoin(ExtendQueryPartsBase):

# Model with the gene ID
gene_id_model = SmallVariant

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.kwargs["database_select"] == "refseq":
Expand All @@ -1329,7 +1333,8 @@ def __init__(self, *args, **kwargs):
select([column("id")])
.select_from(GeneIdInHpo.sa)
.where(
getattr(SmallVariant.sa, "%s_gene_id" % self.kwargs["database_select"]) == gene_id
getattr(self.gene_id_model.sa, "%s_gene_id" % self.kwargs["database_select"])
== gene_id
)
.lateral("disease_gene_subquery")
)
Expand Down
14 changes: 7 additions & 7 deletions variants/templates/variants/second_hit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load variants_tags %}
{% load humanize %}

<table class="table table-sm table-striped table-hover" style="font-size: 11px;">
<table class="table table-sm table-striped table-hover" style="font-size: 11px; table-layout: fixed;">
<thead>
<tr>
<th scope="col"></th>
Expand Down Expand Up @@ -41,22 +41,22 @@
<tr>
<td class="text-right">{{ forloop.counter }}</td>
<td>{{ small_var.chromosome }}:{{ small_var.start|intcomma }}</td>
<td>{{ small_var.reference }}</td>
<td>{{ small_var.alternative }}</td>
<td style="max-width: 50px;"><div class="sodar-overflow-container">{{ small_var.reference }}</div></td>
<td style="max-width: 50px;"><div class="sodar-overflow-container">{{ small_var.alternative }}</div></td>
<td class="text-right">{{ small_var.gnomad_exomes_frequency }}</td>
<td class="text-right">{{ small_var.gnomad_exomes_homozygous|intcomma }}</td>
<td class="text-right">{{ small_var.gnomad_genomes_frequency }}</td>
<td class="text-right">{{ small_var.gnomad_genomes_homozygous|intcomma }}</td>
<td class="text-right">{{ small_var.inhouse_carriers|intcomma }}</td>
<td class="text-right">{{ small_var.inhouse_hom_alt|intcomma }}</td>
{% if small_var.hgvs_p == "p.=" %}
<td>{{ small_var.hgvs_c }}</td>
<td><div class="sodar-overflow-container">{{ small_var.hgvs_c }}</div></td>
{% elif small_var.hgvs_c == "p.?" %}
<td>{{ small_var.hgvs_c }} / p.?</td>
<td><div class="sodar-overflow-container">{{ small_var.hgvs_c }} / p.?</div></td>
{% else %}
<td>{{ small_var.hgvs_p }}</td>
<td><div class="sodar-overflow-container">{{ small_var.hgvs_p }}</div></td>
{% endif %}
<td>{{ small_var.effect|join:";" }}</td>
<td><div class="sodar-overflow-container">{{ small_var.effect|join:";" }}</div></td>
{% for name in samples %}
{% with genotype=small_var.genotype|keyvalue:name %}
<td class="text-center" data-order="{{ genotype|keyvalue:"gt" }}">
Expand Down

0 comments on commit 1b850e6

Please sign in to comment.