scout-browser 4.92__py3-none-any.whl → 4.94__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.
- scout/adapter/mongo/base.py +3 -0
- scout/adapter/mongo/case.py +27 -2
- scout/adapter/mongo/ccv.py +131 -0
- scout/adapter/mongo/query.py +88 -53
- scout/adapter/mongo/variant.py +6 -5
- scout/adapter/mongo/variant_events.py +45 -1
- scout/build/ccv.py +59 -0
- scout/commands/export/export_command.py +0 -0
- scout/commands/load/base.py +0 -0
- scout/commands/load/user.py +0 -0
- scout/commands/serve.py +2 -1
- scout/commands/update/disease.py +0 -0
- scout/commands/update/genes.py +0 -0
- scout/commands/wipe_database.py +0 -0
- scout/constants/__init__.py +2 -0
- scout/constants/case_tags.py +2 -0
- scout/constants/ccv.py +244 -0
- scout/demo/643594.config.yaml +2 -2
- scout/demo/images/custom_images/1300x1000.jpg +0 -0
- scout/models/ccv_evaluation.py +26 -0
- scout/models/variant/variant.py +1 -0
- scout/parse/variant/compound.py +0 -0
- scout/parse/variant/gene.py +0 -0
- scout/parse/variant/genotype.py +0 -0
- scout/resources/custom_igv_tracks/mane.bb +0 -0
- scout/server/blueprints/cases/controllers.py +21 -0
- scout/server/blueprints/cases/templates/cases/case_report.html +53 -0
- scout/server/blueprints/cases/templates/cases/collapsible_actionbar.html +2 -2
- scout/server/blueprints/cases/templates/cases/index.html +0 -2
- scout/server/blueprints/clinvar/controllers.py +4 -5
- scout/server/blueprints/institutes/controllers.py +129 -67
- scout/server/blueprints/institutes/forms.py +5 -2
- scout/server/blueprints/institutes/templates/overview/cases.html +6 -0
- scout/server/blueprints/institutes/templates/overview/causatives.html +1 -1
- scout/server/blueprints/institutes/templates/overview/utils.html +18 -6
- scout/server/blueprints/institutes/templates/overview/verified.html +1 -1
- scout/server/blueprints/institutes/views.py +4 -0
- scout/server/blueprints/panels/controllers.py +5 -6
- scout/server/blueprints/panels/templates/panels/panel.html +5 -5
- scout/server/blueprints/variant/controllers.py +148 -1
- scout/server/blueprints/variant/templates/variant/cancer-variant.html +1 -1
- scout/server/blueprints/variant/templates/variant/ccv.html +183 -0
- scout/server/blueprints/variant/templates/variant/components.html +61 -3
- scout/server/blueprints/variant/templates/variant/tx_overview.html +3 -3
- scout/server/blueprints/variant/templates/variant/variant.html +1 -1
- scout/server/blueprints/variant/templates/variant/variant_details.html +29 -11
- scout/server/blueprints/variant/utils.py +21 -1
- scout/server/blueprints/variant/views.py +114 -3
- scout/server/blueprints/variants/controllers.py +31 -0
- scout/server/blueprints/variants/templates/variants/cancer-sv-variants.html +4 -18
- scout/server/blueprints/variants/templates/variants/cancer-variants.html +4 -13
- scout/server/blueprints/variants/templates/variants/components.html +77 -73
- scout/server/blueprints/variants/templates/variants/indicators.html +11 -0
- scout/server/blueprints/variants/templates/variants/sv-variants.html +2 -2
- scout/server/links.py +1 -1
- scout/server/static/custom_images.js +19 -2
- scout/utils/acmg.py +0 -1
- scout/utils/ccv.py +201 -0
- scout/utils/md5.py +0 -0
- {scout_browser-4.92.dist-info → scout_browser-4.94.dist-info}/METADATA +67 -45
- {scout_browser-4.92.dist-info → scout_browser-4.94.dist-info}/RECORD +54 -49
- {scout_browser-4.92.dist-info → scout_browser-4.94.dist-info}/WHEEL +1 -2
- scout/__version__.py +0 -1
- scout/demo/images/custom_images/640x480_two.jpg +0 -0
- scout_browser-4.92.dist-info/top_level.txt +0 -1
- {scout_browser-4.92.dist-info → scout_browser-4.94.dist-info}/entry_points.txt +0 -0
- {scout_browser-4.92.dist-info → scout_browser-4.94.dist-info/licenses}/LICENSE +0 -0
@@ -74,7 +74,7 @@
|
|
74
74
|
{{ matching_variants(managed_variant, causatives, variant.matching_ranked, variant.matching_tiered) }}
|
75
75
|
<div class="row">
|
76
76
|
<div class="col-sm-3">
|
77
|
-
{{ panel_classify(variant, institute, case, ACMG_OPTIONS, manual_rank_options, cancer_tier_options, dismiss_variant_options, mosaic_variant_options, evaluations) }}
|
77
|
+
{{ panel_classify(variant, institute, case, ACMG_OPTIONS, CCV_OPTIONS, manual_rank_options, cancer_tier_options, dismiss_variant_options, mosaic_variant_options, evaluations, ccv_evaluations) }}
|
78
78
|
</div>
|
79
79
|
<div class="col-sm-4">{{ panel_summary() }}</div>
|
80
80
|
<div class="col-sm-3">
|
@@ -0,0 +1,183 @@
|
|
1
|
+
{% extends "layout.html" %}
|
2
|
+
|
3
|
+
{% block title %}
|
4
|
+
{{ super() }} - {{ institute.display_name }} - {{ case.display_name }} - {{ variant.display_name }} - Classify
|
5
|
+
{% endblock %}
|
6
|
+
|
7
|
+
{% block top_nav %}
|
8
|
+
{{ super() }}
|
9
|
+
<li class="nav-item">
|
10
|
+
<a class="nav-link text-nowrap" href="{{ url_for('cases.index') }}">Institutes</a>
|
11
|
+
</li>
|
12
|
+
<li class="nav-item">
|
13
|
+
<a class="nav-link text-nowrap" href="{{ url_for('overview.cases', institute_id=institute._id) }}">
|
14
|
+
{{ institute.display_name }}
|
15
|
+
</a>
|
16
|
+
</li>
|
17
|
+
<li class="nav-item">
|
18
|
+
<a class="nav-link text-nowrap" href="{{ url_for('cases.case', institute_id=institute._id, case_name=case.display_name) }}">
|
19
|
+
{{ case.display_name }}
|
20
|
+
</a>
|
21
|
+
</li>
|
22
|
+
<li class="nav-item active d-flex align-items-center">
|
23
|
+
<span class="navbar-text">{{ variant.display_name }}</span>
|
24
|
+
</li>
|
25
|
+
{% endblock %}
|
26
|
+
|
27
|
+
{% block content_main %}
|
28
|
+
<div class="container mt-3 mb-5">
|
29
|
+
<form action="{{ url_for('variant.variant_ccv', institute_id=institute._id, case_name=case.display_name, variant_id=variant._id) }}" method="POST">
|
30
|
+
<div class="card panel-default mt-3">
|
31
|
+
<div class="card-body">
|
32
|
+
{% if evaluation %}
|
33
|
+
<h4>
|
34
|
+
{{ evaluation.ccv_classification.label }}
|
35
|
+
<span class="badge bg-info">{{ evaluation.ccv_classification.short|safe }}</span>
|
36
|
+
</h4>
|
37
|
+
By {{ evaluation.user_name }} on {{ evaluation.created_at.date() }}
|
38
|
+
{% if edit %}
|
39
|
+
<br><br>
|
40
|
+
<button class="btn btn-primary form-control" data-bs-toggle="tooltip" title="Editing this classification will result in a new classification">Reclassify</button>
|
41
|
+
{% endif %}
|
42
|
+
{% elif not evaluation %}
|
43
|
+
<button class="btn btn-primary form-control">Submit</button>
|
44
|
+
{% endif %}
|
45
|
+
<div id="conflicts_div" class="bg-warning"></div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="d-flex flex-row justify-content-between mt-3">
|
50
|
+
{% for category, criteria_group in CRITERIA.items() %}
|
51
|
+
<div class="flex-column {{ 'me-3' if not loop.last }}">
|
52
|
+
<h4>Evidence of {{ category }}</h4>
|
53
|
+
{% for evidence, criteria in criteria_group.items() %}
|
54
|
+
<ul class="list-group mt-3">
|
55
|
+
<li class="list-group-item">{{ evidence }}</li>
|
56
|
+
{% for criterion_code, criterion in criteria.items() %}
|
57
|
+
{% if evaluation and evaluation.ccv_criteria.get(criterion_code).comment %}
|
58
|
+
{% set comment = evaluation.ccv_criteria.get(criterion_code).comment %}
|
59
|
+
{% endif %}
|
60
|
+
{% if evaluation and evaluation.ccv_criteria.get(criterion_code).links %}
|
61
|
+
{% set link = evaluation.ccv_criteria.get(criterion_code).links[0] %}
|
62
|
+
{% endif %}
|
63
|
+
{% if evaluation and evaluation.ccv_criteria.get(criterion_code).modifier %}
|
64
|
+
{% set modifier = evaluation.ccv_criteria.get(criterion_code).modifier %}
|
65
|
+
{% endif %}
|
66
|
+
<div class="list-group-item">
|
67
|
+
<div class="d-flex justify-content-between">
|
68
|
+
<div data-bs-toggle="tooltip" data-bs-placement="top" title="{{ criterion.description|safe }}">
|
69
|
+
<span class="badge bg-info me-1">{{ criterion_code }}</span>
|
70
|
+
{{ criterion.short|safe}}
|
71
|
+
</div>
|
72
|
+
<div class="form-check form-switch">
|
73
|
+
<input type="checkbox" class="form-check-input" id="checkbox-{{ criterion_code }}" name="criteria" value="{{ criterion_code }}" {{ 'checked' if evaluation and criterion_code in evaluation.ccv_criteria }} {{ 'disabled' if evaluation and edit is false }}>
|
74
|
+
<label class="form-check-label" for="checkbox-{{ criterion_code }}"></label>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div id="comment-{{ criterion_code }}" class="{{ 'collapse' if not (comment or link or modifier) }} mt-2">
|
78
|
+
{% if criterion.documentation %}<div class="row"><span class="me-1 fw-light text-wrap">{{ criterion.documentation | safe }}</span></div>{% endif %}
|
79
|
+
<div class="row">
|
80
|
+
<select {{ 'disabled' if evaluation and edit is false}} id="modifier-{{ criterion_code }}" name="modifier-{{ criterion_code }}" class="form-control form-select">
|
81
|
+
<option value="" {% if not modifier %}selected{% endif %}>Strength modifier...</option>
|
82
|
+
{% for level in "Strong", "Moderate", "Supporting" %}
|
83
|
+
{% if(level != evidence) %}
|
84
|
+
<option id="{{ criterion_code }}-{{ level }}" value="{{ level }}" {% if modifier == level %}selected{% endif %}>{{ level }}</option>
|
85
|
+
{% endif %}
|
86
|
+
{% endfor %}
|
87
|
+
</select>
|
88
|
+
</div>
|
89
|
+
<div class="row">
|
90
|
+
<textarea {{ 'disabled' if evaluation and edit is false }} class="form-control"
|
91
|
+
name="comment-{{ criterion_code }}" rows="3" placeholder="Comment (optional)">{{ comment }}</textarea>
|
92
|
+
</div>
|
93
|
+
<input type="url" {{ 'disabled' if evaluation and edit is false }} class="form-control" name="link-{{ criterion_code }}"
|
94
|
+
placeholder="{{ link or 'Supporting link (optional)' }}" value="">
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
{% endfor %}
|
98
|
+
</li>
|
99
|
+
</ul>
|
100
|
+
{% endfor %}
|
101
|
+
</div>
|
102
|
+
{% endfor %}
|
103
|
+
</div>
|
104
|
+
<!-- classification preview in the footer-->
|
105
|
+
<div class="mt-3 fixed-bottom bg-light border">
|
106
|
+
<div class="row">
|
107
|
+
<div class="col-3" style="font-size:1.5em">
|
108
|
+
<a href="https://doi.org/10.1016/j.gim.2022.01.001" data-bs-toggle="tooltip" title="Suggested classification based on Horak et al 2022." rel="noopener noreferrer" target="_blank"><span id="temperature_span" class="badge"></span></a>
|
109
|
+
</div>
|
110
|
+
<div class="col-6 text-center">
|
111
|
+
{% for option in CCV_OPTIONS %}
|
112
|
+
<a id="ccv-{{ option.code }}" href="https://doi.org/10.1016/j.gim.2022.01.001" class="btn ccv-preview" data-bs-toggle="tooltip" title="Suggested classification based on Horak et al 2022." rel="noopener noreferrer" target="_blank">{{ option.label }}</a>
|
113
|
+
{% endfor %}
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
</form>
|
118
|
+
</div>
|
119
|
+
{% endblock %}
|
120
|
+
|
121
|
+
{% block scripts %}
|
122
|
+
{{ super() }}
|
123
|
+
|
124
|
+
<script>
|
125
|
+
|
126
|
+
window.onload=function() {
|
127
|
+
update_classification();
|
128
|
+
}
|
129
|
+
|
130
|
+
$(function () {
|
131
|
+
$('[data-bs-toggle="tooltip"]').tooltip();
|
132
|
+
|
133
|
+
$('.form-switch').change(function(event) {
|
134
|
+
var el = $('#comment-' + event.target.value);
|
135
|
+
if (event.target.checked) {
|
136
|
+
el.collapse('show');
|
137
|
+
} else {
|
138
|
+
el.collapse('hide');
|
139
|
+
}
|
140
|
+
update_classification()
|
141
|
+
});
|
142
|
+
|
143
|
+
$('.form-select').change(function(event) {
|
144
|
+
update_classification()
|
145
|
+
});
|
146
|
+
});
|
147
|
+
|
148
|
+
|
149
|
+
function update_classification() {
|
150
|
+
var criteria = $(':checked').map(function(idx, elem) {
|
151
|
+
const modifiers = ["Strong", "Moderate", "Supporting"];
|
152
|
+
for (possible_modifier of modifiers) {
|
153
|
+
var modifier_option;
|
154
|
+
if(elem.value !== null && elem.value !== '') {
|
155
|
+
modifier_option = document.getElementById(elem.value + '-' + possible_modifier)
|
156
|
+
}
|
157
|
+
if(modifier_option) {
|
158
|
+
if (modifier_option.selected) {
|
159
|
+
return 'criterion=' + elem.value + '_' + possible_modifier
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
return 'criterion=' + elem.value
|
164
|
+
});
|
165
|
+
|
166
|
+
|
167
|
+
$.getJSON('/api/v1/ccv?' + criteria.toArray().join('&'), function(data) {
|
168
|
+
// reset the selection
|
169
|
+
$('.ccv-preview').removeClass('btn-primary');
|
170
|
+
// add new selection
|
171
|
+
$('#ccv-' + data.classification).addClass('btn-primary');
|
172
|
+
|
173
|
+
var temperature_span = document.getElementById("temperature_span");
|
174
|
+
temperature_span.innerHTML = 'Score ' + data.points + ' <span class="fa ' + data.temperature_icon + '"></span> ' + data.temperature + ' (' + data.point_classification + ')'
|
175
|
+
temperature_span.className = 'badge bg-' + data.temperature_class
|
176
|
+
|
177
|
+
// Update any classification conflicts
|
178
|
+
var conflicts_div = document.getElementById("conflicts_div");
|
179
|
+
conflicts_div.innerHTML = data.conflicts.join("<br>");
|
180
|
+
});
|
181
|
+
}
|
182
|
+
</script>
|
183
|
+
{% endblock %}
|
@@ -133,7 +133,7 @@
|
|
133
133
|
{% endmacro %}
|
134
134
|
|
135
135
|
{% macro acmg_form(institute, case, variant, ACMG_OPTIONS, selected=None) %}
|
136
|
-
<label class="mt-3">ACMG classification</label>
|
136
|
+
<label class="mt-3" data-bs-toggle="tooltip" title="Richards et al 2015"><a href="https://www.acmg.net/docs/standards_guidelines_for_the_interpretation_of_sequence_variants.pdf" rel="noopener noreferrer" target="_blank" style="color: inherit; text-decoration: inherit;">ACMG classification</a></label>
|
137
137
|
<form action="{{ url_for('variant.variant_update', institute_id=institute._id, case_name=case.display_name, variant_id=variant._id) }}" method="POST">
|
138
138
|
<div class="d-flex justify-content-between">
|
139
139
|
{% for option in ACMG_OPTIONS %}
|
@@ -145,11 +145,56 @@
|
|
145
145
|
</form>
|
146
146
|
{% endmacro %}
|
147
147
|
|
148
|
+
{% macro ccv_classification_item(variant, data) %}
|
149
|
+
{% set current_variant = (data.variant_specific == variant._id) %}
|
150
|
+
<li class="list-group-item {{ 'list-group-item-info' if current_variant }}">
|
151
|
+
<div class="d-flex">
|
152
|
+
<span>
|
153
|
+
<a href="{{ url_for('variant.ccv_evaluation', evaluation_id=data._id) }}">
|
154
|
+
{{ data.ccv_classification.label }}
|
155
|
+
</a>
|
156
|
+
<span class="badge bg-info">{{ data.ccv_classification.short }}</span>
|
157
|
+
</span>
|
158
|
+
<span>
|
159
|
+
{% if not current_variant %}
|
160
|
+
<small>{{ data.case.display_name }}</small>
|
161
|
+
{% endif %}
|
162
|
+
</span>
|
163
|
+
</div>
|
164
|
+
<span>
|
165
|
+
<small class="text-muted">
|
166
|
+
{{ data.user_name }} on {{ data.created_at.date() }}
|
167
|
+
{% if current_variant %}
|
168
|
+
<form action="{{ url_for('variant.ccv_evaluation', evaluation_id=data._id) }}" method="POST" style="display: inline-block;">
|
169
|
+
<button class="btn btn-xs btn-link" >Delete</button>
|
170
|
+
</form>
|
171
|
+
{% if data.ccv_criteria %}
|
172
|
+
<a class="btn btn-xs btn-link" href="{{ url_for('variant.ccv_evaluation', evaluation_id=data._id, edit=True) }}" data-bs-toggle="tooltip" title="Editing this classification will result in a new classification">Edit</a>
|
173
|
+
{% endif %}
|
174
|
+
{% endif %}
|
175
|
+
</small>
|
176
|
+
</span>
|
177
|
+
</li>
|
178
|
+
{% endmacro %}
|
148
179
|
|
149
|
-
|
180
|
+
|
181
|
+
{% macro ccv_form(institute, case, variant, CCV_OPTIONS, selected=None) %}
|
182
|
+
<label class="mt-3" data-bs-toggle="tooltip" title="Horak et al 2022"><a href="https://doi.org/10.1016/j.gim.2022.01.001" rel="noopener noreferrer" target="_blank" style="color: inherit; text-decoration: inherit;">ClinGen-CGC-VICC Oncogenicity classification</a></label>
|
183
|
+
<form action="{{ url_for('variant.variant_update', institute_id=institute._id, case_name=case.display_name, variant_id=variant._id) }}" method="POST">
|
184
|
+
<div class="d-flex justify-content-between">
|
185
|
+
{% for option in CCV_OPTIONS %}
|
186
|
+
<button class="btn btn-{{ option.color if (option.code == selected or not selected) else 'outline-secondary' }} form-control {{ 'me-1' if not loop.last }}" name="ccv_classification" value="{{ option.code }}" title="{{ option.label }}">
|
187
|
+
{{ option.short }}
|
188
|
+
</button>
|
189
|
+
{% endfor %}
|
190
|
+
</div>
|
191
|
+
</form>
|
192
|
+
{% endmacro %}
|
193
|
+
|
194
|
+
{% macro panel_classify(variant, institute, case, ACMG_OPTIONS, CCV_OPTIONS, manual_rank_options, cancer_tier_options, dismiss_variant_options, mosaic_variant_options, evaluations, ccv_evaluations) %}
|
150
195
|
<div class="card panel-default">
|
151
196
|
<div class="panel-heading">Classify</div>
|
152
|
-
<div class="card-body">
|
197
|
+
<div class="card-body" style="margin-top: -30px">
|
153
198
|
{{ variant_tag_button(variant, institute, case, manual_rank_options) }}
|
154
199
|
{% if case.track == "cancer" %}
|
155
200
|
{{ variant_tier_button(variant, institute, case, cancer_tier_options) }}
|
@@ -169,6 +214,19 @@
|
|
169
214
|
{% endfor %}
|
170
215
|
</div>
|
171
216
|
{% endif %}
|
217
|
+
{% if case.track == "cancer" %}
|
218
|
+
{{ ccv_form(institute, case, variant, CCV_OPTIONS, variant.ccv_classification.code if variant.ccv_classification) }}
|
219
|
+
<div class="mt-3">
|
220
|
+
<a href="{{ url_for('variant.variant_ccv', institute_id=institute._id, case_name=case.display_name, variant_id=variant._id) }}" class="btn btn-outline-secondary form-control">Classify</a>
|
221
|
+
</div>
|
222
|
+
{% if ccv_evaluations %} <!-- scrollable previous ClinGen-CGC-VICC evaluations div-->
|
223
|
+
<div class="list-group mt-3" style="max-height:200px;overflow-y: scroll;">
|
224
|
+
{% for ccv_evaluation in ccv_evaluations %}
|
225
|
+
{{ ccv_classification_item(variant, ccv_evaluation) }}
|
226
|
+
{% endfor %}
|
227
|
+
</div>
|
228
|
+
{% endif %}
|
229
|
+
{% endif %}
|
172
230
|
</div>
|
173
231
|
</div>
|
174
232
|
{% endmacro %}
|
@@ -76,15 +76,15 @@
|
|
76
76
|
</td> <!-- end of ID col-->
|
77
77
|
|
78
78
|
<td> <!-- HGVS Description col -->
|
79
|
-
{% set hgvs_c = (tx.coding_sequence_name or '')|truncate(
|
79
|
+
{% set hgvs_c = (tx.coding_sequence_name or '')|truncate(30, True) %}
|
80
80
|
{% if variant.chromosome in ["MT","M"] %}
|
81
81
|
{% set mt_notation = "m." ~ variant.position ~ variant.reference ~ ">" ~ variant.alternative %}
|
82
|
-
{{ mt_notation|truncate(
|
82
|
+
{{ mt_notation|truncate(30,True) }} <span class="text-muted">({{ hgvs_c }})</span>
|
83
83
|
{% else %}
|
84
84
|
{{ hgvs_c }}
|
85
85
|
{% endif %}
|
86
86
|
<span class="text-muted float-end">
|
87
|
-
{{ (tx.protein_sequence_name or '')|url_decode }}
|
87
|
+
{{ (tx.protein_sequence_name or '')|url_decode|truncate(30, True) }}
|
88
88
|
</span>
|
89
89
|
</td> <!-- end of HGVS Description col -->
|
90
90
|
|
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
<div class="row">
|
86
86
|
<div class="col-lg-3 col-md-6">
|
87
|
-
{{ panel_classify(variant, institute, case, ACMG_OPTIONS, manual_rank_options, cancer_tier_options, dismiss_variant_options, mosaic_variant_options, evaluations) }}
|
87
|
+
{{ panel_classify(variant, institute, case, ACMG_OPTIONS, CCV_OPTIONS, manual_rank_options, cancer_tier_options, dismiss_variant_options, mosaic_variant_options, evaluations, ccv_evaluations) }}
|
88
88
|
</div>
|
89
89
|
<div class="col-lg-5 col-md-6">
|
90
90
|
{{ panel_summary() }}
|
@@ -200,6 +200,20 @@
|
|
200
200
|
</div>
|
201
201
|
{% endmacro %}
|
202
202
|
|
203
|
+
{% macro observation_badge(observed_case) %}
|
204
|
+
|
205
|
+
{% if observed_case.variant and observed_case.variant.category == "snv"%}
|
206
|
+
<a class="badge rounded-pill bg-light text-dark" target="_blank" href="{{ url_for('variant.variant', institute_id=observed_case.case.owner, case_name=observed_case.case.display_name, variant_id=observed_case.variant._id) }}">{{ observed_case.case.display_name }}</a>
|
207
|
+
{% elif observed_case.variant and observed_case.variant.category == "sv"%}
|
208
|
+
<a class="badge rounded-pill bg-light text-dark" target="_blank" href="{{ url_for('variant.sv_variant', institute_id=observed_case.case.owner, case_name=observed_case.case.display_name, variant_id=observed_case.variant._id) }}">{{ observed_case.case.display_name }}</a>
|
209
|
+
{% else %}
|
210
|
+
<span data-bs-toggle="tooltip" title="Missing link, this might be caused by variants not loaded after a rerun or inexact SV matching.">
|
211
|
+
<span class="ml-3 badge rounded-pill bg-light text-dark">{{ observed_case.case.display_name }}</span>
|
212
|
+
</span>
|
213
|
+
{% endif %}
|
214
|
+
|
215
|
+
{% endmacro %}
|
216
|
+
|
203
217
|
{% macro observations_panel(variant, observations, case) %}
|
204
218
|
<div class="card panel-default">
|
205
219
|
<div class="panel-heading d-flex justify-content-between">
|
@@ -240,19 +254,23 @@
|
|
240
254
|
</span>
|
241
255
|
{% endif %}
|
242
256
|
{% endif %}
|
243
|
-
{% for
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
<a class="badge rounded-pill bg-light text-dark" target="_blank" href="{{ url_for('variant.sv_variant', institute_id=data.case.owner, case_name=data.case.display_name, variant_id=data.variant._id) }}">{{ data.case.display_name }}</a>
|
248
|
-
{% else %}
|
249
|
-
<span data-bs-toggle="tooltip" title="Missing link, this might be caused by variants not loaded after a rerun or inexact SV matching.">
|
250
|
-
<span class="ml-3 badge rounded-pill bg-light text-dark">{{ data.case.display_name }}</span>
|
251
|
-
</span>
|
252
|
-
{% endif %}
|
257
|
+
{% for observed_case in obs.cases %}
|
258
|
+
{% if loop.index <= 10 %}
|
259
|
+
{{ observation_badge(observed_case) }}
|
260
|
+
{% endif %}
|
253
261
|
{% endfor %}
|
262
|
+
|
254
263
|
{% if obs.cases|length > 10 %}
|
255
|
-
|
264
|
+
<span class="collapse" id="additionalCases_{{ loqusid }}">
|
265
|
+
{% for observed_case in obs.cases %}
|
266
|
+
{% if loop.index > 10 %}
|
267
|
+
{{ observation_badge(observed_case) }}
|
268
|
+
{% endif %}
|
269
|
+
{% endfor %}
|
270
|
+
</span>
|
271
|
+
<button class="btn btn-link p-0 toggle-button" type="button" data-bs-toggle="collapse" href="#additionalCases_{{ loqusid }}">
|
272
|
+
<span class="toggle-text">Show more/less</span>
|
273
|
+
</button>
|
256
274
|
{% endif %}
|
257
275
|
</td>
|
258
276
|
</tr>
|
@@ -2,7 +2,14 @@ import logging
|
|
2
2
|
from typing import Dict, List, Optional, Tuple
|
3
3
|
|
4
4
|
from scout.adapter import MongoAdapter
|
5
|
-
from scout.constants import
|
5
|
+
from scout.constants import (
|
6
|
+
ACMG_COMPLETE_MAP,
|
7
|
+
CALLERS,
|
8
|
+
CCV_COMPLETE_MAP,
|
9
|
+
CLINSIG_MAP,
|
10
|
+
SO_TERMS,
|
11
|
+
VARIANT_FILTERS,
|
12
|
+
)
|
6
13
|
from scout.server.links import add_gene_links, add_tx_links
|
7
14
|
|
8
15
|
LOG = logging.getLogger(__name__)
|
@@ -472,6 +479,19 @@ def evaluation(store, evaluation_obj):
|
|
472
479
|
return evaluation_obj
|
473
480
|
|
474
481
|
|
482
|
+
def ccv_evaluation(store, evaluation_obj):
|
483
|
+
"""Fetch and fill-in evaluation object."""
|
484
|
+
evaluation_obj["institute"] = store.institute(evaluation_obj["institute_id"])
|
485
|
+
evaluation_obj["case"] = store.case(evaluation_obj["case_id"])
|
486
|
+
evaluation_obj["variant"] = store.variant(evaluation_obj["variant_specific"])
|
487
|
+
evaluation_obj["ccv_criteria"] = {
|
488
|
+
criterion["term"]: criterion for criterion in evaluation_obj["ccv_criteria"]
|
489
|
+
}
|
490
|
+
evaluation_obj["ccv_classification"] = CCV_COMPLETE_MAP.get(
|
491
|
+
evaluation_obj["ccv_classification"]
|
492
|
+
)
|
493
|
+
|
494
|
+
|
475
495
|
def transcript_str(transcript_obj, gene_name=None):
|
476
496
|
"""Generate amino acid change as a string.
|
477
497
|
|
@@ -13,13 +13,26 @@ from flask import (
|
|
13
13
|
from flask_login import current_user
|
14
14
|
from markupsafe import Markup
|
15
15
|
|
16
|
-
from scout.constants import
|
17
|
-
|
16
|
+
from scout.constants import (
|
17
|
+
ACMG_CRITERIA,
|
18
|
+
ACMG_MAP,
|
19
|
+
ACMG_OPTIONS,
|
20
|
+
CCV_CRITERIA,
|
21
|
+
CCV_MAP,
|
22
|
+
CCV_OPTIONS,
|
23
|
+
)
|
24
|
+
from scout.server.blueprints.variant.controllers import ccv_evaluation as ccv_evaluation_controller
|
25
|
+
from scout.server.blueprints.variant.controllers import (
|
26
|
+
check_reset_variant_ccv_classification,
|
27
|
+
check_reset_variant_classification,
|
28
|
+
)
|
18
29
|
from scout.server.blueprints.variant.controllers import evaluation as evaluation_controller
|
19
30
|
from scout.server.blueprints.variant.controllers import observations, str_variant_reviewer
|
20
31
|
from scout.server.blueprints.variant.controllers import variant as variant_controller
|
21
32
|
from scout.server.blueprints.variant.controllers import variant_acmg as acmg_controller
|
22
33
|
from scout.server.blueprints.variant.controllers import variant_acmg_post
|
34
|
+
from scout.server.blueprints.variant.controllers import variant_ccv as ccv_controller
|
35
|
+
from scout.server.blueprints.variant.controllers import variant_ccv_post
|
23
36
|
from scout.server.blueprints.variant.verification_controllers import (
|
24
37
|
MissingVerificationRecipientError,
|
25
38
|
variant_verification,
|
@@ -27,6 +40,7 @@ from scout.server.blueprints.variant.verification_controllers import (
|
|
27
40
|
from scout.server.extensions import loqusdb, store
|
28
41
|
from scout.server.utils import institute_and_case, public_endpoint, templated
|
29
42
|
from scout.utils.acmg import get_acmg, get_acmg_conflicts, get_acmg_temperature
|
43
|
+
from scout.utils.ccv import get_ccv, get_ccv_conflicts, get_ccv_temperature
|
30
44
|
from scout.utils.ensembl_rest_clients import EnsemblRestApiClient
|
31
45
|
|
32
46
|
LOG = logging.getLogger(__name__)
|
@@ -205,9 +219,40 @@ def variant_acmg(institute_id, case_name, variant_id):
|
|
205
219
|
)
|
206
220
|
|
207
221
|
|
222
|
+
@variant_bp.route("/<institute_id>/<case_name>/<variant_id>/ccv", methods=["GET", "POST"])
|
223
|
+
@templated("variant/ccv.html")
|
224
|
+
def variant_ccv(institute_id, case_name, variant_id):
|
225
|
+
"""ClinGen-CCG-VICC classification form."""
|
226
|
+
if request.method == "GET":
|
227
|
+
data = ccv_controller(store, institute_id, case_name, variant_id)
|
228
|
+
return data
|
229
|
+
|
230
|
+
criteria = []
|
231
|
+
criteria_terms = request.form.getlist("criteria")
|
232
|
+
for term in criteria_terms:
|
233
|
+
criteria.append(
|
234
|
+
dict(
|
235
|
+
term=term,
|
236
|
+
comment=request.form.get("comment-{}".format(term)),
|
237
|
+
links=[request.form.get("link-{}".format(term))],
|
238
|
+
)
|
239
|
+
)
|
240
|
+
ccv = variant_ccv_post(store, institute_id, case_name, variant_id, current_user.email, criteria)
|
241
|
+
flash("classified as: {}".format(ccv), "info")
|
242
|
+
return redirect(
|
243
|
+
url_for(
|
244
|
+
".variant",
|
245
|
+
institute_id=institute_id,
|
246
|
+
case_name=case_name,
|
247
|
+
variant_id=variant_id,
|
248
|
+
)
|
249
|
+
)
|
250
|
+
|
251
|
+
|
208
252
|
@variant_bp.route("/<institute_id>/<case_name>/<variant_id>/update", methods=["POST"])
|
209
253
|
def variant_update(institute_id, case_name, variant_id):
|
210
|
-
"""Update user-defined information about a variant: manual rank
|
254
|
+
"""Update user-defined information about a variant: manual rank, cancer tier,
|
255
|
+
CLinGen-CGC-VICC classification, dismissal & mosaic tags."""
|
211
256
|
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
|
212
257
|
variant_obj = store.variant(variant_id)
|
213
258
|
user_obj = store.user(current_user.email)
|
@@ -250,6 +295,7 @@ def variant_update(institute_id, case_name, variant_id):
|
|
250
295
|
flash("Variant tag was updated", "info")
|
251
296
|
else:
|
252
297
|
flash("Variant tag was reset", "info")
|
298
|
+
|
253
299
|
elif request.form.get("acmg_classification"):
|
254
300
|
new_acmg = request.form["acmg_classification"]
|
255
301
|
acmg_classification = variant_obj.get("acmg_classification")
|
@@ -268,6 +314,24 @@ def variant_update(institute_id, case_name, variant_id):
|
|
268
314
|
)
|
269
315
|
flash("updated ACMG classification: {}".format(new_acmg), "info")
|
270
316
|
|
317
|
+
elif request.form.get("ccv_classification"):
|
318
|
+
new_ccv = request.form["ccv_classification"]
|
319
|
+
ccv_classification = variant_obj.get("ccv_classification")
|
320
|
+
# If there already is a classification and the same one is sent again this means that
|
321
|
+
# We want to remove the classification
|
322
|
+
if isinstance(ccv_classification, int) and (new_ccv == CCV_MAP[ccv_classification]):
|
323
|
+
new_ccv = None
|
324
|
+
|
325
|
+
store.submit_ccv_evaluation(
|
326
|
+
variant_obj=variant_obj,
|
327
|
+
user_obj=user_obj,
|
328
|
+
institute_obj=institute_obj,
|
329
|
+
case_obj=case_obj,
|
330
|
+
link=link,
|
331
|
+
classification=new_ccv,
|
332
|
+
)
|
333
|
+
flash("updated ClinGen-CGC-VIGG classification: {}".format(new_ccv), "info")
|
334
|
+
|
271
335
|
new_dismiss = request.form.getlist("dismiss_variant")
|
272
336
|
if new_dismiss:
|
273
337
|
store.update_dismiss_variant(
|
@@ -353,6 +417,53 @@ def acmg():
|
|
353
417
|
return jsonify({"classification": classification, "conflicts": acmg_conflicts, **acmg_bayesian})
|
354
418
|
|
355
419
|
|
420
|
+
@variant_bp.route("/ccv_evaluations/<evaluation_id>", methods=["GET", "POST"])
|
421
|
+
@templated("variant/ccv.html")
|
422
|
+
def ccv_evaluation(evaluation_id):
|
423
|
+
"""Show, edit or delete an ClinGen-CGC-VIGG evaluation."""
|
424
|
+
|
425
|
+
evaluation_obj = store.get_ccv_evaluation(evaluation_id)
|
426
|
+
if evaluation_obj is None:
|
427
|
+
flash("Evaluation was not found in database", "warning")
|
428
|
+
return redirect(request.referrer)
|
429
|
+
ccv_evaluation_controller(store, evaluation_obj)
|
430
|
+
if request.method == "POST":
|
431
|
+
link = url_for(
|
432
|
+
".variant",
|
433
|
+
institute_id=evaluation_obj["institute"]["_id"],
|
434
|
+
case_name=evaluation_obj["case"]["display_name"],
|
435
|
+
variant_id=evaluation_obj["variant_specific"],
|
436
|
+
)
|
437
|
+
store.delete_ccv_evaluation(evaluation_obj)
|
438
|
+
|
439
|
+
if check_reset_variant_ccv_classification(store, evaluation_obj, link):
|
440
|
+
flash("Cleared ClinGen-CGC-VIGG classification.", "info")
|
441
|
+
|
442
|
+
return redirect(link)
|
443
|
+
|
444
|
+
return dict(
|
445
|
+
evaluation=evaluation_obj,
|
446
|
+
edit=bool(request.args.get("edit")),
|
447
|
+
institute=evaluation_obj["institute"],
|
448
|
+
case=evaluation_obj["case"],
|
449
|
+
variant=evaluation_obj["variant"],
|
450
|
+
CRITERIA=CCV_CRITERIA,
|
451
|
+
CCV_OPTIONS=CCV_OPTIONS,
|
452
|
+
)
|
453
|
+
|
454
|
+
|
455
|
+
@variant_bp.route("/api/v1/ccv")
|
456
|
+
@public_endpoint
|
457
|
+
def ccv():
|
458
|
+
"""Calculate an ClinGen-CVC-VIGG classification from submitted criteria."""
|
459
|
+
criteria = request.args.getlist("criterion")
|
460
|
+
classification = get_ccv(criteria)
|
461
|
+
|
462
|
+
ccv_bayesian = get_ccv_temperature(criteria)
|
463
|
+
ccv_conflicts = get_ccv_conflicts(criteria)
|
464
|
+
return jsonify({"classification": classification, "conflicts": ccv_conflicts, **ccv_bayesian})
|
465
|
+
|
466
|
+
|
356
467
|
@variant_bp.route(
|
357
468
|
"/<institute_id>/<case_name>/<variant_id>/<order>",
|
358
469
|
methods=["POST"],
|
@@ -17,6 +17,8 @@ from scout.constants import (
|
|
17
17
|
CANCER_EXPORT_HEADER,
|
18
18
|
CANCER_SPECIFIC_VARIANT_DISMISS_OPTIONS,
|
19
19
|
CANCER_TIER_OPTIONS,
|
20
|
+
CCV_COMPLETE_MAP,
|
21
|
+
CCV_MAP,
|
20
22
|
CHROMOSOMES,
|
21
23
|
CHROMOSOMES_38,
|
22
24
|
CLINSIG_MAP,
|
@@ -362,6 +364,7 @@ def get_manual_assessments(variant_obj):
|
|
362
364
|
## display manual input of interest: classified, commented, tagged, mosaicism or dismissed.
|
363
365
|
assessment_keywords = [
|
364
366
|
"acmg_classification",
|
367
|
+
"ccv_classification",
|
365
368
|
"manual_rank",
|
366
369
|
"cancer_tier",
|
367
370
|
"dismiss_variant",
|
@@ -402,6 +405,16 @@ def get_manual_assessments(variant_obj):
|
|
402
405
|
assessment["label"] = classification["short"]
|
403
406
|
assessment["display_class"] = classification["color"]
|
404
407
|
|
408
|
+
if assessment_type == "ccv_classification":
|
409
|
+
ccv_classification = variant_obj[assessment_type]
|
410
|
+
if isinstance(ccv_classification, int):
|
411
|
+
ccv_code = CCV_MAP[ccv_classification]
|
412
|
+
ccv_classification = CCV_COMPLETE_MAP[ccv_code]
|
413
|
+
|
414
|
+
assessment["title"] = "ClinGen-CGC-VIGG: {}".format(ccv_classification["label"])
|
415
|
+
assessment["label"] = ccv_classification["short"]
|
416
|
+
assessment["display_class"] = ccv_classification["color"]
|
417
|
+
|
405
418
|
if assessment_type == "dismiss_variant":
|
406
419
|
dismiss_variant_options = {
|
407
420
|
**DISMISS_VARIANT_OPTIONS,
|
@@ -918,6 +931,11 @@ def parse_variant(
|
|
918
931
|
acmg_code = ACMG_MAP[variant_obj["acmg_classification"]]
|
919
932
|
variant_obj["acmg_classification"] = ACMG_COMPLETE_MAP[acmg_code]
|
920
933
|
|
934
|
+
ccv_classification = variant_obj.get("ccv_classification")
|
935
|
+
if isinstance(ccv_classification, int):
|
936
|
+
ccv_code = CCV_MAP[variant_obj["ccv_classification"]]
|
937
|
+
variant_obj["ccv_classification"] = CCV_COMPLETE_MAP[ccv_code]
|
938
|
+
|
921
939
|
# convert length for SV variants
|
922
940
|
variant_length = variant_obj.get("length")
|
923
941
|
variant_obj["length"] = {100000000000: "inf", -1: "n.d."}.get(variant_length, variant_length)
|
@@ -1409,6 +1427,19 @@ def cancer_variants(store, institute_id, case_name, variants_query, variant_coun
|
|
1409
1427
|
secondary_gene = gene
|
1410
1428
|
variant_obj["second_rep_gene"] = secondary_gene
|
1411
1429
|
variant_obj["clinical_assessments"] = get_manual_assessments(variant_obj)
|
1430
|
+
|
1431
|
+
evaluations = []
|
1432
|
+
# Get previous ClinGen-CGC-VIGG evaluations of the variant from other cases
|
1433
|
+
for evaluation_obj in store.get_ccv_evaluations(variant_obj):
|
1434
|
+
if evaluation_obj["case_id"] == case_obj["_id"]:
|
1435
|
+
continue
|
1436
|
+
|
1437
|
+
ccv_classification = evaluation_obj["ccv_classification"]
|
1438
|
+
|
1439
|
+
evaluation_obj["ccv_classification"] = CCV_COMPLETE_MAP.get(ccv_classification)
|
1440
|
+
evaluations.append(evaluation_obj)
|
1441
|
+
variant_obj["ccv_evaluations"] = evaluations
|
1442
|
+
|
1412
1443
|
variants_list.append(variant_obj)
|
1413
1444
|
|
1414
1445
|
data = dict(
|