scout-browser 4.81__py3-none-any.whl → 4.82.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. scout/__version__.py +1 -1
  2. scout/adapter/mongo/disease_terms.py +5 -2
  3. scout/adapter/mongo/query.py +23 -11
  4. scout/build/managed_variant.py +12 -1
  5. scout/build/variant/genotype.py +2 -0
  6. scout/build/variant/variant.py +5 -0
  7. scout/constants/clinvar.py +1 -1
  8. scout/constants/query_terms.py +3 -1
  9. scout/models/variant/variant.py +1 -0
  10. scout/parse/variant/frequency.py +56 -54
  11. scout/parse/variant/genotype.py +89 -15
  12. scout/parse/variant/transcript.py +17 -9
  13. scout/parse/variant/variant.py +12 -0
  14. scout/server/app.py +6 -3
  15. scout/server/blueprints/alignviewers/templates/alignviewers/utils.html +1 -1
  16. scout/server/blueprints/cases/controllers.py +2 -57
  17. scout/server/blueprints/cases/templates/cases/case_bionano.html +3 -24
  18. scout/server/blueprints/cases/templates/cases/case_report.html +87 -69
  19. scout/server/blueprints/cases/templates/cases/case_sma.html +2 -13
  20. scout/server/blueprints/cases/templates/cases/chanjo2_form.html +47 -0
  21. scout/server/blueprints/cases/templates/cases/collapsible_actionbar.html +4 -4
  22. scout/server/blueprints/cases/templates/cases/gene_panel.html +4 -11
  23. scout/server/blueprints/cases/templates/cases/individuals_table.html +2 -12
  24. scout/server/blueprints/cases/templates/cases/utils.html +20 -1
  25. scout/server/blueprints/cases/views.py +0 -22
  26. scout/server/blueprints/clinvar/controllers.py +3 -3
  27. scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html +29 -2
  28. scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html +36 -18
  29. scout/server/blueprints/clinvar/views.py +13 -1
  30. scout/server/blueprints/diagnoses/controllers.py +2 -0
  31. scout/server/blueprints/institutes/controllers.py +76 -38
  32. scout/server/blueprints/institutes/templates/overview/cases.html +54 -42
  33. scout/server/blueprints/managed_variants/templates/managed_variants/managed_variants.html +1 -1
  34. scout/server/blueprints/managed_variants/views.py +2 -4
  35. scout/server/blueprints/panels/templates/panels/panel.html +8 -7
  36. scout/server/blueprints/panels/views.py +2 -11
  37. scout/server/blueprints/phenotypes/templates/phenotypes/hpo_terms.html +3 -2
  38. scout/server/blueprints/variant/controllers.py +3 -2
  39. scout/server/blueprints/variant/templates/variant/components.html +1 -1
  40. scout/server/blueprints/variant/templates/variant/utils.html +3 -1
  41. scout/server/blueprints/variant/templates/variant/variant.html +20 -15
  42. scout/server/blueprints/variant/templates/variant/variant_details.html +78 -26
  43. scout/server/blueprints/variant/utils.py +9 -13
  44. scout/server/blueprints/variants/controllers.py +30 -3
  45. scout/server/blueprints/variants/forms.py +15 -1
  46. scout/server/blueprints/variants/templates/variants/components.html +55 -0
  47. scout/server/blueprints/variants/templates/variants/fusion-variants.html +3 -50
  48. scout/server/blueprints/variants/templates/variants/str-variants.html +8 -5
  49. scout/server/blueprints/variants/templates/variants/utils.html +57 -31
  50. scout/server/blueprints/variants/templates/variants/variants.html +1 -1
  51. scout/server/blueprints/variants/utils.py +7 -10
  52. scout/server/extensions/clinvar_extension.py +10 -2
  53. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/METADATA +6 -5
  54. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/RECORD +58 -57
  55. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/LICENSE +0 -0
  56. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/WHEEL +0 -0
  57. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/entry_points.txt +0 -0
  58. {scout_browser-4.81.dist-info → scout_browser-4.82.2.dist-info}/top_level.txt +0 -0
@@ -3,18 +3,9 @@ import datetime
3
3
  import json
4
4
  import logging
5
5
 
6
- from flask import (
7
- Blueprint,
8
- Response,
9
- escape,
10
- flash,
11
- redirect,
12
- render_template,
13
- request,
14
- send_file,
15
- url_for,
16
- )
6
+ from flask import Blueprint, Response, flash, redirect, render_template, request, send_file, url_for
17
7
  from flask_login import current_user
8
+ from markupsafe import escape
18
9
 
19
10
  from scout.constants import DATE_DAY_FORMATTER
20
11
  from scout.export.panel import export_gene_panels
@@ -21,7 +21,7 @@
21
21
  <div class="row mt-3">
22
22
  <div class="col-md-12">
23
23
  <div class="card">
24
- <div class="card-header">HPO terms</div>
24
+ <div class="card-header">Number of HPO terms present in the database:{{phenotypes|length}}</div>
25
25
  <div class="card-body">
26
26
  {% if phenotypes|length == 0 %}
27
27
  The search didn't return any phenotype term
@@ -54,7 +54,8 @@
54
54
  <script type="text/javascript">
55
55
  $(document).ready(function() {
56
56
  $('#phenotypes_table').DataTable( {
57
- paging: false,
57
+ paging: true,
58
+ pageLength: 50,
58
59
  dom: 'fBrtip',
59
60
  buttons: [
60
61
  {
@@ -3,8 +3,9 @@ import os
3
3
  from typing import Dict, List, Optional
4
4
 
5
5
  import requests
6
- from flask import Markup, abort, current_app, flash, url_for
6
+ from flask import abort, current_app, flash, url_for
7
7
  from flask_login import current_user
8
+ from markupsafe import Markup
8
9
 
9
10
  from scout.adapter import MongoAdapter
10
11
  from scout.constants import (
@@ -238,7 +239,7 @@ def variant(
238
239
  # The hierarchical call order is relevant: cases are used to populate variants
239
240
  update_variant_case_panels(case_obj, variant_obj)
240
241
 
241
- associate_variant_genes_with_case_panels(store, variant_obj)
242
+ associate_variant_genes_with_case_panels(case_obj, variant_obj)
242
243
 
243
244
  # Provide basic info on alignment files availability for this case
244
245
  case_has_alignments(case_obj)
@@ -241,7 +241,7 @@
241
241
  <div class="card panel-default">
242
242
  <div class="panel-heading">Compounds (top 20)</div>
243
243
  <div class="card-body">
244
- {{ compounds_table(institute, case, variant.compounds[:20]) }}
244
+ {{ compounds_table(institute, case, variant.compounds[:20], is_popover=false) }}
245
245
  </div>
246
246
  </div>
247
247
  {% endmacro %}
@@ -131,7 +131,9 @@
131
131
  <th>Variant</th>
132
132
  <th>Gene</th>
133
133
  <th>Type</th>
134
- <th>Combined score</th>
134
+ <th>Combined score
135
+ <span data-bs-toggle='tooltip' data-bs-title='Combined score is the sum of variants´s score and overlapping variant´s score'>?</span>
136
+ </th>
135
137
  <th>Rank score</th>
136
138
  <th>Length</th>
137
139
  <th>Region</th>
@@ -5,7 +5,7 @@
5
5
  {% from "variant/utils.html" import causative_button, genes_panel, modal_causative, overlapping_panel, pin_button, proteins_panel, transcripts_panel, custom_annotations %}
6
6
  {% from "variant/tx_overview.html" import disease_associated, transcripts_overview %}
7
7
  {% from "variant/gene_disease_relations.html" import autozygosity_panel, genemodels_panel, inheritance_panel, orpha_omim_phenotypes %}
8
- {% from "variant/variant_details.html" import frequencies, gtcall_panel, old_observations, observations_panel, severity_list, conservations, mappability %}
8
+ {% from "variant/variant_details.html" import conservations, frequencies, gtcall_panel, mappability, observations_panel, old_observations, severity_list, str_db_card %}
9
9
  {% from "variant/components.html" import alignments, clinsig_table, compounds_panel, external_links, external_scripts, external_stylesheets, matching_variants, panel_classify, variant_scripts %}
10
10
  {% from "variant/sanger.html" import modal_cancel_sanger, modal_sanger, sanger_button %}
11
11
  {% from "variant/rank_score_results.html" import rankscore_panel %}
@@ -90,11 +90,15 @@
90
90
  {{ panel_summary() }}
91
91
  </div>
92
92
  <div class="col-lg-4">
93
- {{ frequencies(variant) }}
94
- {% if config['LOQUSDB_SETTINGS'] %}
95
- {{ observations_panel(variant, observations, case) }}
93
+ {% if str %}
94
+ {{ str_db_card(variant) }}
95
+ {% else %}
96
+ {{ frequencies(variant) }}
97
+ {% if config['LOQUSDB_SETTINGS'] %}
98
+ {{ observations_panel(variant, observations, case) }}
99
+ {% endif %}
100
+ {{ old_observations(variant) }}
96
101
  {% endif %}
97
- {{ old_observations(variant) }}
98
102
  </div>
99
103
  </div>
100
104
  <div class="row">
@@ -227,8 +231,8 @@
227
231
  <tr>
228
232
  <td>
229
233
  Position:
230
- <strong>{{ variant.chromosome }}:<span class="text-muted">{{ variant.position }}</span></strong>
231
- <button type="button" class="fa fa-copy btn-xs js-tooltip js-copy" style="background-color: Transparent;outline:none; border: none;" data-bs-toggle="tooltip" data-bs-placement="bottom" data-copy="{{ variant.chromosome }}:{{ variant.position }}" title="Copy to clipboard">
234
+ <strong>{{ variant.chromosome }}:<span class="text-muted">{{ variant.position }}</span></strong>
235
+ <button type="button" class="fa fa-copy btn-xs js-tooltip js-copy" style="background-color: Transparent;outline:none; border: none;" data-bs-toggle="tooltip" data-bs-placement="bottom" data-copy="{{ variant.chromosome }}:{{ variant.position }}" title="Copy to clipboard">
232
236
  </button>
233
237
  </td>
234
238
  <td {% if not mei %}colspan="3"{% endif %}>
@@ -282,13 +286,12 @@
282
286
  </strong></span>
283
287
  </td>
284
288
  </tr>
285
-
286
289
  </tbody>
287
290
  </table>
288
291
  <table class="table table-bordered table-fixed table-sm">
289
292
  <tbody class="border-top">
290
293
  <tr>
291
- <td>
294
+ <td {% if str %}colspan="2"{% endif %}>
292
295
  Matches OMIM inhert.
293
296
  {% if variant.is_matching_inheritance %}
294
297
  <span class="badge bg-success float-end">Yes</span>
@@ -296,12 +299,14 @@
296
299
  <div class="badge bg-warning float-end">No</div>
297
300
  {% endif %}
298
301
  </td>
299
- <td>
300
- Frequency
301
- <div class="badge bg-{% if variant.frequency == 'common' %}danger{% elif variant.frequency == 'uncommon' %}warning{% else %}success{% endif %} float-end">
302
- {{ variant.frequency }}
303
- </div>
304
- </td>
302
+ {% if not str %}
303
+ <td>
304
+ Frequency
305
+ <div class="badge bg-{% if variant.frequency == 'common' %}danger{% elif variant.frequency == 'uncommon' %}warning{% else %}success{% endif %} float-end">
306
+ {{ variant.frequency }}
307
+ </div>
308
+ </td>
309
+ {% endif %}
305
310
  </tr>
306
311
  </tbody>
307
312
  </table>
@@ -105,37 +105,89 @@
105
105
  </div>
106
106
  {% endmacro %}
107
107
 
108
- {% macro frequencies(variant) %}
108
+ {% macro str_db_card(variant) %}
109
109
  <div class="card panel-default">
110
- <div class="panel-heading">Frequencies</div>
110
+ <div class="panel-heading">STR locus details</div>
111
111
  <div class="card-body">
112
- <table class="table">
112
+ <table class="table" aria-label="STR locus details">
113
113
  <thead class="thead table-light">
114
- <tr>
115
- <th scope="col">Source</th>
116
- <th scope="col">Frequency</th>
117
- </tr>
118
- </thead>
119
- <tbody>
120
- {% for freq_name, value, link in variant.frequencies %}
121
- <tr>
122
- <td>
123
- {% if link %}
124
- <a href="{{ link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer">{{ freq_name }}</a>
125
- {% else %}
126
- {{ freq_name }}
114
+ <tr>
115
+ <th scope="col">Source</th>
116
+ <th scope="col">Value</th>
117
+ </tr>
118
+ </thead>
119
+ <tbody>
120
+ <tr><td>Normal max</td><td>{{ variant.str_normal_max }}</td></tr>
121
+ <tr><td>Pathologic min</td><td>{{ variant.str_pathologic_min }}</td><tr>
122
+ {% if variant.str_status == 'full_mutation' %}
123
+ <tr class="bg-danger">
124
+ {% elif variant.str_status == 'pre_mutation' %}
125
+ <tr class="bg-warning">
126
+ {% else %}
127
+ <tr>
128
+ {% endif %}
129
+ <td>Motif copies</td><td>{{ variant.str_mc }} <span class="badge bg-secondary text-white">{{ variant.str_status }}</span></td>
130
+ </tr>
131
+ <tr><td colspan=2>&nbsp;</td></tr>
132
+ {% if variant.str_swegen_mean %}
133
+ <tr><td>SweGen Z-score</td><td>
134
+ {% if variant.str_mc %}
135
+ {{ ((variant.str_mc - variant.str_swegen_mean ) / variant.str_swegen_std) | round(2) }}
136
+ {% endif %}
137
+ </td></tr>
138
+ <tr><td>SweGen mean</td><td>{{variant.str_swegen_mean|round(2)}}</td></tr>
139
+ <tr><td>SweGen std</td><td>{{variant.str_swegen_std|round(2)}}</td></tr>
140
+ <tr><td colspan=2>&nbsp;</td></tr>
141
+ {% endif %}
142
+ {% for gene in variant.genes %}
143
+ {% if gene.stripy_link %}
144
+ <tr><td>
145
+ <a href="{{ gene.str_gnomad_link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer">gnomAD</a>
146
+ </td><td>{{ gene.hgnc_symbol }}</td></tr>
127
147
  {% endif %}
128
- </td>
129
- <td>
130
- {% if value %}
131
- <span class="badge bg-secondary">{{ value|human_decimal }}</span>
132
- {% else %}
133
- -
148
+ {% if gene.stripy_link %}
149
+ <tr><td>
150
+ <a href="{{ gene.stripy_link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer">STRipy</a>
151
+ </td><td>{{ gene.hgnc_symbol }}</td></tr>
134
152
  {% endif %}
135
- </td>
136
- </tr>
137
- {% endfor %}
138
- </tbody>
153
+ {% endfor %}
154
+ </tbody>
155
+ </table>
156
+ </div>
157
+ </div>
158
+ {% endmacro %}
159
+
160
+ {% macro frequencies(variant) %}
161
+ <div class="card panel-default">
162
+ <div class="panel-heading">Frequencies</div>
163
+ <div class="card-body">
164
+ <table class="table">
165
+ <thead class="thead table-light">
166
+ <tr>
167
+ <th scope="col">Source</th>
168
+ <th scope="col">Frequency</th>
169
+ </tr>
170
+ </thead>
171
+ <tbody>
172
+ {% for freq_name, value, link in variant.frequencies %}
173
+ <tr>
174
+ <td>
175
+ {% if link %}
176
+ <a href="{{ link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer">{{ freq_name }}</a>
177
+ {% else %}
178
+ {{ freq_name }}
179
+ {% endif %}
180
+ </td>
181
+ <td>
182
+ {% if value %}
183
+ <span class="badge bg-secondary">{{ value|human_decimal }}</span>
184
+ {% else %}
185
+ -
186
+ {% endif %}
187
+ </td>
188
+ </tr>
189
+ {% endfor %}
190
+ </tbody>
139
191
  </table>
140
192
  </div>
141
193
  </div>
@@ -175,15 +175,13 @@ def update_variant_case_panels(case_obj: dict, variant_obj: dict):
175
175
  The case_obj should be up-to-date first. Call update_case_panels() as needed in context:
176
176
  to save some resources we do not call it here for each variant.
177
177
  """
178
-
178
+ variant_obj["case_panels"] = []
179
179
  variant_panel_names = variant_obj.get("panels") or []
180
- case_panel_objs = [
181
- panel
182
- for panel in (case_obj.get("panels") or [])
183
- if panel["panel_name"] in variant_panel_names
184
- ]
185
-
186
- variant_obj["case_panels"] = case_panel_objs
180
+ for latest_panel in case_obj.get("latest_panels") or []:
181
+ if latest_panel["panel_name"] not in variant_panel_names:
182
+ continue
183
+ if not set(latest_panel["hgnc_ids"]).isdisjoint(variant_obj["hgnc_ids"]):
184
+ variant_obj["case_panels"].append(latest_panel)
187
185
 
188
186
 
189
187
  def get_extra_info(gene_panels: list) -> Dict[int, dict]:
@@ -660,17 +658,15 @@ def callers(variant_obj):
660
658
  return list(calls)
661
659
 
662
660
 
663
- def associate_variant_genes_with_case_panels(store: MongoAdapter, variant_obj: Dict) -> None:
661
+ def associate_variant_genes_with_case_panels(case_obj: Dict, variant_obj: Dict) -> None:
664
662
  """Add associated gene panels to each gene in variant object"""
665
663
 
666
664
  genes = variant_obj.get("genes", [])
667
- gene_panels = variant_obj.get("case_panels", [])
668
665
 
669
666
  for gene in genes:
670
667
  hgnc_id = gene["hgnc_id"]
671
668
  matching_panels = []
672
- for panel in gene_panels:
673
- genes_on_panel = store.panel_to_genes(panel_id=panel["panel_id"], gene_format="hgnc_id")
674
- if hgnc_id in genes_on_panel:
669
+ for panel in case_obj.get("latest_panels", []):
670
+ if hgnc_id in panel["hgnc_ids"]:
675
671
  matching_panels.append(panel["panel_name"])
676
672
  gene["associated_gene_panels"] = matching_panels
@@ -51,6 +51,8 @@ from scout.server.utils import (
51
51
  from .forms import FILTERSFORMCLASS, CancerSvFiltersForm, FusionFiltersForm, SvFiltersForm
52
52
  from .utils import update_case_panels
53
53
 
54
+ NUM = re.compile(r"\d+")
55
+
54
56
  LOG = logging.getLogger(__name__)
55
57
 
56
58
 
@@ -938,6 +940,9 @@ def parse_variant(
938
940
  if not "end_chrom" in variant_obj:
939
941
  variant_obj["end_chrom"] = variant_obj["chromosome"]
940
942
 
943
+ # common motif count for STR variants
944
+ variant_obj["str_mc"] = get_str_mc(variant_obj)
945
+
941
946
  # variant level links shown on variants page
942
947
  variant_obj["cosmic_links"] = cosmic_links(variant_obj)
943
948
  variant_obj["str_source_link"] = str_source_link(variant_obj)
@@ -959,6 +964,30 @@ def parse_variant(
959
964
  return variant_obj
960
965
 
961
966
 
967
+ def get_str_mc(variant_obj: dict) -> Optional[int]:
968
+ """Return variant Short Tandem Repeat motif count, either as given by its ALT MC value
969
+ from the variant FORMAT field, or as a number given in the ALT on the form
970
+ '<STR123>'.
971
+ """
972
+ alt_mc = None
973
+ if variant_obj["alternative"] == ".":
974
+ return alt_mc
975
+
976
+ for sample in variant_obj["samples"]:
977
+ if sample["genotype_call"] in ["./.", ".|", "0/0", "0|0"]:
978
+ continue
979
+ alt_mc = sample.get("alt_mc")
980
+ if alt_mc:
981
+ return alt_mc
982
+
983
+ alt_num = NUM.search(variant_obj["alternative"])
984
+ if alt_num:
985
+ alt_mc = int(alt_num.group())
986
+ return alt_mc
987
+
988
+ return None
989
+
990
+
962
991
  def download_str_variants(case_obj, variant_objs):
963
992
  """Download filtered STR variants for a case to a CSV file
964
993
 
@@ -995,9 +1024,7 @@ def download_str_variants(case_obj, variant_objs):
995
1024
  variant_line.append(
996
1025
  variant.get("str_display_ru", variant.get("str_ru", ""))
997
1026
  ) # Reference repeat unit
998
- variant_line.append(
999
- variant.get("alternative", "").replace("STR", "").replace("<", "").replace(">", "")
1000
- ) # Estimated size
1027
+ variant_line.append(get_str_mc(variant) or ".") # Estimated size
1001
1028
  variant_line.append(str(variant.get("str_ref", ""))) # Reference size
1002
1029
  variant_line.append(str(variant.get("str_status", ""))) # Status
1003
1030
  gt_cell = ""
@@ -95,6 +95,7 @@ class VariantFiltersForm(FlaskForm):
95
95
  variant_type = HiddenField(default="clinical")
96
96
 
97
97
  gene_panels = NonValidatingSelectMultipleField(choices=[])
98
+ gene_panels_exclude = BooleanField("Exclude genes")
98
99
  hgnc_symbols = TagListField("HGNC Symbols/Ids (case sensitive)")
99
100
 
100
101
  region_annotations = SelectMultipleField(choices=REGION_ANNOTATIONS)
@@ -111,7 +112,7 @@ class VariantFiltersForm(FlaskForm):
111
112
  clinsig = NonValidatingSelectMultipleField("ClinVar CLINSIG", choices=CLINSIG_OPTIONS)
112
113
 
113
114
  gnomad_frequency = BetterDecimalField("gnomadAF", validators=[validators.Optional()])
114
- local_obs = IntegerField("Local obs. (archive)", validators=[validators.Optional()])
115
+ local_obs_old = IntegerField("Local obs. (archive)", validators=[validators.Optional()])
115
116
 
116
117
  filters = NonValidatingSelectField(choices=[], validators=[validators.Optional()])
117
118
  filter_display_name = StringField(default="")
@@ -165,6 +166,12 @@ class CancerFiltersForm(VariantFiltersForm):
165
166
  clinvar_tag = BooleanField("ClinVar hits")
166
167
  cosmic_tag = BooleanField("Cosmic hits")
167
168
  mvl_tag = BooleanField("Managed Variants hits")
169
+ local_obs_cancer_somatic_old = IntegerField(
170
+ "Local somatic obs. (archive)", validators=[validators.Optional()]
171
+ )
172
+ local_obs_cancer_germline_old = IntegerField(
173
+ "Local germline obs. (archive)", validators=[validators.Optional()]
174
+ )
168
175
 
169
176
  # polymorphic constant base for clinical filter
170
177
  clinical_filter_base = CLINICAL_FILTER_BASE_CANCER
@@ -196,6 +203,13 @@ class SvFiltersForm(VariantFiltersForm):
196
203
  swegen = IntegerField("SweGen obs")
197
204
  clinical_filter = SubmitField(label="Clinical filter")
198
205
 
206
+ local_obs_cancer_somatic_old = IntegerField(
207
+ "Local somatic obs. (archive)", validators=[validators.Optional()]
208
+ )
209
+ local_obs_cancer_germline_old = IntegerField(
210
+ "Local germline obs. (archive)", validators=[validators.Optional()]
211
+ )
212
+
199
213
  # polymorphic constant base for clinical filter
200
214
  clinical_filter_base = CLINICAL_FILTER_BASE_SV
201
215
 
@@ -23,6 +23,61 @@
23
23
  </div>
24
24
  {% endmacro %}
25
25
 
26
+ {% macro fusion_variants_header() %}
27
+ <thead class="table-light">
28
+ <tr>
29
+ <th id="checkbox" style="width:1%"></th>
30
+ <th id="rank" style="width:3%;" title="Beta version. Currently testing" class="text-left">Rank (beta)</th>
31
+ <th id="genes" style="width:6%" title="Genes">Fusion Genes</th>
32
+ <th id="callers" style="width:4%" title="Number of callers detecting a given event">Callers</th>
33
+ <th id="observed" style="width:4%" title="Observed database matches">Observed</th>
34
+ <th id="score" style="width:4%" title="Beta version. Currently testing">Score (beta)</th>
35
+ <th id="junction_reads" style="width:6%" title="Number of paired-ends that support the event">Junction Reads</th>
36
+ <th id="split_reads" style="width:6%" title="Number of split reads that support the event">Split Reads</th>
37
+ <th id="ffpm" style="width:6%" title="Fusion fragments per million total RNA-seq fragments">FFPM</th>
38
+ <th id="frame_status" style="width:8%" title="Frame status of the fusion">Frame Status</th>
39
+ <th id="transcripts" style="width:8%" title="Transcript ID">Transcript ID</th>
40
+ <th id="exons" style="width:4%" title="Exon Number">Exon Number</th>
41
+ <th id="brealpoints" style="width:4%" title="Breakpoints">Breakpoints</th>
42
+ <th id="oriantation" style="width:4%" title="Orientation">Orientation</th>
43
+ </tr>
44
+ </thead>
45
+ {% endmacro %}
46
+
47
+ {% macro default_fusion_variant_cells(institute, case, variant) %}
48
+ <td>
49
+ {{ fusion_variant_gene_symbols_cell(variant) }}
50
+ </td>
51
+ <td class="text-center"><span data-bs-toggle="tooltip" data-bs-html="true" title="{% for name, caller in variant.callers %}{{ name }}: {{ caller }}<br>{% endfor %}">
52
+ {{ variant.tool_hits|int }}</span></td>
53
+ <td>{{variant.found_db|join(", ") if variant.found_db else "-"}}</td>
54
+ <td class="text-center">{{ variant.fusion_score|float|round(3) }}</td>
55
+ <td class="text-center">{{ variant.samples[0].read_depth }}</td>
56
+ <td class="text-center">{{ variant.samples[0].split_read }}</td>
57
+ <td class="text-center">{{ variant.samples[0].ffpm }}</td>
58
+ <td>{{ variant.frame_status }}</td>
59
+ <td>
60
+ {% if variant.genes %}
61
+ {% for gene in variant.genes %}
62
+ {% for transcript in gene.transcripts %}
63
+ <div>{{ transcript.transcript_id }} </div>
64
+ {% endfor %}
65
+ {% endfor %}
66
+ {% endif %}
67
+ </td>
68
+ <td>
69
+ {% if variant.genes %}
70
+ {% for gene in variant.genes %}
71
+ {% for transcript in gene.transcripts %}
72
+ <div>{% if "exon" in transcript %}{{ transcript.exon|int }}{% endif %} </div>
73
+ {% endfor %}
74
+ {% endfor %}
75
+ {% endif %}
76
+ </td>
77
+ <td> {{ variant.chromosome }}:{{ variant.position }} <br> {{ variant.end_chrom }}:{{ variant.end }} </td>
78
+ <td class="text-center">{{ variant.orientation }}</td>
79
+ {% endmacro %}
80
+
26
81
  {% macro fusion_variant_gene_symbols_cell(variant) %}
27
82
  <div class="align-items-center">
28
83
  {% if variant.genes %}
@@ -1,6 +1,6 @@
1
1
  {% extends "layout.html" %}
2
2
  {% from "variants/utils.html" import fusion_filters, cell_rank, pagination_footer, pagination_hidden_div, dismiss_variants_block, filter_form_footer, filter_script_main, update_stash_filter_button_status %}
3
- {% from "variants/components.html" import external_scripts, external_stylesheets, fusion_variant_gene_symbols_cell %}
3
+ {% from "variants/components.html" import external_scripts, external_stylesheets, fusion_variant_gene_symbols_cell, fusion_variants_header, default_fusion_variant_cells %}
4
4
 
5
5
  {% block title %}
6
6
  {{ super() }} - {{ institute.display_name }} - {{ case.display_name }} - Fusion variants
@@ -54,24 +54,7 @@ onsubmit="return validateForm()">
54
54
 
55
55
  <div class="card mt-3">
56
56
  <table id="variantsTable" class="table table-hover table-bordered" aria-label="Fusion variants table">
57
- <thead class="table-light thead">
58
- <tr>
59
- <th style="width:3%"></th>
60
- <th style="width:4%" title="Beta version. Currently testing">Rank (beta)</th>
61
- <th style="width:6%" title="Genes">Fusion Genes</th>
62
- <th style="width:4%" title="Number of callers detecting a given event">Callers</th>
63
- <th style="width:4%" title="Observed database matches">Observed</th>
64
- <th style="width:4%" title="Beta version. Currently testing">Score (beta)</th>
65
- <th style="width:6%" title="Number of paired-ends that support the event">Junction Reads</th>
66
- <th style="width:6%" title="Number of split reads that support the event">Split Reads</th>
67
- <th style="width:6%" title="Fusion fragments per million total RNA-seq fragments">FFPM</th>
68
- <th style="width:8%" title="Frame status of the fusion">Frame Status</th>
69
- <th style="width:8%" title="Transcript ID">Transcript ID</th>
70
- <th style="width:4%" title="Exon Number">Exon Number</th>
71
- <th style="width:4%" title="Breakpoints">Breakpoints</th>
72
- <th style="width:4%" title="Orientation">Orientation</th>
73
- </tr>
74
- </thead>
57
+ {{ fusion_variants_header() }}
75
58
  <tbody>
76
59
  {% for variant in variants %}
77
60
  {{ variant_row(variant) }}
@@ -103,37 +86,7 @@ onsubmit="return validateForm()">
103
86
  <td class="text-start">
104
87
  {{ cell_rank(variant, institute, case, form, manual_rank_options) }}
105
88
  </td>
106
- <td>
107
- {{ fusion_variant_gene_symbols_cell(variant) }}
108
- </td>
109
- <td><span data-bs-toggle="tooltip" data-bs-html="true" title="{% for name, caller in variant.callers %}{{ name }}: {{ caller }}<br>{% endfor %}">
110
- {{ variant.tool_hits|int }}</span></td>
111
- <td>{{variant.found_db|join(", ") if variant.found_db else "-"}}</td>
112
- <td class="text-end">{{ variant.fusion_score|float|round(3) }}</td>
113
- <td>{{ variant.samples[0].read_depth }}</td>
114
- <td>{{ variant.samples[0].split_read }}</td>
115
- <td>{{ variant.samples[0].ffpm }}</td>
116
- <td>{{ variant.frame_status }}</td>
117
- <td>
118
- {% if variant.genes %}
119
- {% for gene in variant.genes %}
120
- {% for transcript in gene.transcripts %}
121
- <div>{{ transcript.transcript_id }} </div>
122
- {% endfor %}
123
- {% endfor %}
124
- {% endif %}
125
- </td>
126
- <td>
127
- {% if variant.genes %}
128
- {% for gene in variant.genes %}
129
- {% for transcript in gene.transcripts %}
130
- <div>{% if "exon" in transcript %}{{ transcript.exon|int }}{% endif %} </div>
131
- {% endfor %}
132
- {% endfor %}
133
- {% endif %}
134
- </td>
135
- <td> {{ variant.chromosome }}:{{ variant.position }} <br> {{ variant.end_chrom }}:{{ variant.end }} </td>
136
- <td>{{ variant.orientation }}</td>
89
+ {{ default_fusion_variant_cells(institute, case, variant) }}
137
90
  </tr>
138
91
  {% endmacro %}
139
92
 
@@ -91,9 +91,9 @@
91
91
  {% endif %}
92
92
  <td class="str-link">{{ cell_rank(variant, institute, case, form, manual_rank_options) }}</td>
93
93
  <td class="str-link">{{ str_locus_info(variant) }}</td>
94
- <td class="text-end">{{ variant.str_display_ru or variant.str_ru }}</td>
95
- <td class="text-end"><b>{{ variant.alternative|replace("STR", "")|replace("<", "")|replace(">", "") }}</b></td>
96
- <td class="text-end">{{ variant.str_ref }}</td>
94
+ <td class="text-end">{{ variant.str_display_ru or variant.str_ru or variant.reference }}</td>
95
+ <td class="text-end"><b><span data-bs-toggle="tooltip" title="{{ variant.alternative }}">{{ variant.str_mc }}</span></b></td>
96
+ <td class="text-end"><span data-bs-toggle="tooltip" title="{{ variant.reference }}">{{ variant.str_ref or "." }}</span></td>
97
97
  <td>{{ str_status(variant) }}</td>
98
98
  <td>{% for sample in variant.samples %}
99
99
  {% if sample.genotype_call != "./." %}
@@ -187,7 +187,9 @@
187
187
  <tr><td colspan=2>&nbsp;</td></tr>
188
188
  {% if variant.str_swegen_mean %}
189
189
  <tr><td>SweGen Z-score</td><td>
190
- {{ ((variant.alternative|replace("STR", "")|replace("<", "")|replace(">", "")|int - variant.str_swegen_mean ) / variant.str_swegen_std) | round(2) }}
190
+ {% if variant.str_mc %}
191
+ {{ ((variant.str_mc - variant.str_swegen_mean ) / variant.str_swegen_std) | round(2) }}
192
+ {% endif %}
191
193
  </td></tr>
192
194
  <tr><td>SweGen mean</td><td>{{variant.str_swegen_mean|round(2)}}</td></tr>
193
195
  <tr><td>SweGen std</td><td>{{variant.str_swegen_std|round(2)}}</td></tr>
@@ -233,7 +235,8 @@
233
235
  {% endfor %}
234
236
  {%endif%}
235
237
  </div>"
236
- title="">{{ variant.str_repid }}
238
+ title="">{% if variant.str_repid %} {{ variant.str_repid }} {% elif variant.str_trid %} {{ variant.str_trid }} {% else %}
239
+ {% for gene in variant.genes %} {{ gene.symbol }} {% endfor %} {% endif %}
237
240
  </a>
238
241
  {% for gene in variant.genes %}
239
242
  <span class="badge bg-secondary"><a href="{{ gene.stripy_link }}" class="text-white" referrerpolicy="no-referrer" rel="noopener" target="_blank">S</a></span>