/
variant.html
234 lines (226 loc) · 11 KB
/
variant.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
{% extends "layout.html" %}
{% block body %}
<!-- Render context vars in JS here -->
<script type="text/javascript">
window.variant = {{ variant|tojson|safe }};
window.base_coverage = {{ base_coverage|tojson|safe }};
window.any_covered = {{ any_covered|tojson|safe }};
$(document).ready(function() {
{# if (!window.variant) {#}
draw_region_coverage(window.base_coverage, 'mean', window.variant.ref);
$('.coverage_metric_buttons').change(function () {
var v = $(this).attr('id').replace('_covmet_button', '');
$('.coverage_subcat_selectors').hide();
if (v == 'covered') {
$('#over_x_select_container').show();
v = $('#over_x_select').val();
} else {
$('#average_select_container').show();
v = $("#average_select").val();
}
draw_region_coverage(window.base_coverage, v, window.variant.ref);
});
$('#over_x_select').change(function () {
draw_region_coverage(window.base_coverage, $(this).val(), window.variant.ref);
});
$('#average_select').change(function () {
draw_region_coverage(window.base_coverage, $(this).val(), window.variant.ref);
});
{# }#}
});
</script>
<style>
.d3_graph {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
.bar text {
fill: #fff;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
<script>
$(document).ready(function() {
$('.frequency_display_buttons').change(function() {
$('.frequency_displays').hide();
var v = $(this).attr('id').replace('_button', '');
$('#' + v + '_container').show();
});
$('#frequency_table').tablesorter({
sortList: [[1,1], [0,0]]
});
if (window.variant != null && 'genotype_info' in window.variant && 'genotype_depths' in window.variant.genotype_info) {
draw_histogram_d3(window.variant.genotype_info.genotype_depths);
$('.quality_display_buttons').change(function() {
var v = $(this).attr('id').replace('_button', '');
var f = $('#quality_variant_sites_only_button').hasClass('active');
draw_histogram_d3(window.variant.genotype_info[v]);
});
$('#quality_variant_sites_only_button').click(function() {
var v = $('.quality_display_buttons.active').attr('id').replace('_button', '');
// TODO: Fix to do this properly
var f = !$(this).hasClass('active');
draw_histogram_d3(window.variant.genotype_info[v]);
});
} else {
$('#quality_metrics_container').hide();
{# $('#frequency_info_container').hide();#}
}
});
</script>
<div class="container">
<h1>Variant: {{ variant.chrom }}:{{ variant.pos }} {{ variant.ref }} / {{ variant.alt }}</h1>
<hr/>
{% if variant.orig_alt_alleles|length > 1 %}
<p><span class="label label-info">Note:</span> This variant is multiallelic! The other alt alleles are:</p>
<ul>
{% for allele in variant.orig_alt_alleles %}
{% if allele != variant.alt %}
<li>
<a href="/variant/{{ variant.chrom }}-{{ variant.pos }}-{{ variant.ref }}-{{ allele }}">{{ allele }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
<hr/>
{% endif %}
{% if variant.allele_freq %}
<div class="row">
<div class="col-md-6">
<dl class="dl-horizontal">
{% if variant.rsid and variant.rsid != "." %}
<dt>Known variant</dt>
<dd><a href="http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs={{ variant.rsid }}" target="_blank">{{ variant.rsid }}</a></dd>
{% endif %}
<dt>Allele Frequency</dt>
<dd>{{ variant.allele_freq }}</dd>
<dt>Allele Count</dt>
<dd>{{ variant.allele_count }} / {{ variant.allele_num }}</dd>
</dl>
</div>
<div class="col-md-6">
<dl class="dl-horizontal">
<dt>Site Quality</dt>
<dd>{{ variant.site_quality }}</dd>
<dt>Filter Status</dt>
<dd>{{ variant.filter }}</dd>
</dl>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-md-6">
<div id="annotation_container">
<div class="section_header">Annotations</div>
{% if variant.vep_annotations %}
<p>This variant falls on {{ variant.transcripts|length }} transcripts in {{ variant.genes|length }} genes:</p>
<div class="panel-group" id="annotation_accordion">
{% for consequence in consequences %}
<h4>{{ consequence }}</h4>
<ul>
{% for gene in consequences[consequence] %}
<li>
<a href="/gene/{{ gene }}">{{ gene }}</a>
{% if consequences[consequence][gene][0].SYMBOL %}
({{ consequences[consequence][gene][0].SYMBOL }})
{% endif %}
</li>
<ul>
{% for annotation in consequences[consequence][gene] %}
<li>
<a href="/transcript/{{ annotation.Feature }}">{{ annotation.Feature }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
{% endfor %}
</div>
{% else %}
No annotations were found for this variant.
{% endif %}
</div>
<div id="browser_container">
</div>
</div>
<div class="col-md-6">
{% if variant.pop_acs %}
<div id="frequency_info_container">
<h3>Population Frequencies</h3>
<div id="frequency_table_container" class="frequency_displays">
<table id="frequency_table">
<thead>
<tr>
<th>Population</th>
<th>Allele Count</th>
<th>Number of Homozygotes</th>
<th>Allele Frequency</th>
</tr>
</thead>
<tbody>
{% for pop in variant.pop_acs %}
<tr>
<td>{{ pop }}</td>
<td>{{ variant.pop_acs[pop] }}</td>
<td>{{ variant.pop_homs[pop] }}</td>
{% if variant.pop_ans[pop] > 0 %}
<td>{{ variant.pop_acs[pop]/variant.pop_ans[pop] }}</td>
{% else %}
<td>NA</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td><b>Total</b></td>
<td><b>{{ variant.pop_acs.values()|sum }}</b></td>
<td><b>{{ variant.pop_homs.values()|sum }}</b></td>
<td><b>{{ variant.allele_freq }}</b></td>
</tr>
</tfoot>
</table>
</div>
</div>
<div id="quality_metrics_container">
<h3>Quality Metrics</h3>
{# <button type="button" data-toggle="button" class="btn btn-primary" id="quality_variant_sites_only_button">#}
{# Variants only#}
{# </button>#}
<span class="btn-group" data-toggle="buttons" id="quality_display_button_group" style="float: right;">
<button class="btn btn-primary active quality_display_buttons" id="genotype_depths_button">
<input type="radio"> Depth
</button>
<button class="btn btn-primary quality_display_buttons" id="genotype_qualities_button">
<input type="radio" > Genotype Quality
</button>
</span>
<div id="quality_display_container" class="d3_graph"></div>
</div>
{% else %}
{% if any_covered %}
<div class="row">
<span class="section_header">Coverage</span>
{% if base_coverage|length > 1 %}
{% include 'coverage_selectors.html' %}
{% endif %}
</div>
<div id="region_coverage"></div>
{% else %}
This region is not covered in the ExAC dataset.
{% endif %}
{% endif %}
</div>
</div>
{# <hr/>#}
{# <p>The variant object that we are displaying looks like this:</p>#}
{# <pre>{{ variant|pprint(True) }}</pre>#}
</div>
{% endblock %}