-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
248 lines (190 loc) · 12.3 KB
/
index.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
235
236
237
238
239
240
241
242
243
244
245
246
247
<html>
<head>
<title>Ancestry analysis on PLCO data</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src='https://cdn.plot.ly/plotly-2.18.0.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<!--<script src="ancestry.js"></script>
<link rel="stylesheet" href="ancestry.css">-->
<script src="gendoc.js"></script>
<link rel="stylesheet" href="gendoc.css">
<!--<script src="index.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="container">
<section id="header">
<h1>
Ancestry PLCO
<sup style="font-size:medium;color:green"><a href="https://dceg.cancer.gov/" target="_blank" style="color:green">DCEG</a></sup> <br>
<span style="font-size:small;color:blue">
[<a href="https://github.com/episphere/vcf" target="_blank">code</a>]
[<a href="https://github.com/episphere/vcf/issues" target="_blank">issues</a>]
[<a href="https://observablehq.com/@episphere/vcf" target="_blank" style="font-size:large;font-weight:bold;color:blue">Notebook</a>]
[<a href="https://www.youtube.com/watch?v=pvtzGEx51R0" target="_blank" style="font-size:large;font-weight:bold;color:red">YouTube</a>]
[<a href="https://gitter.im/episphere/vcf" target="_blank">gitter</a>]
</span>
</h1>
<hr>
</section>
<ul class="nav nav-tabs" id="options" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">About Ancestry Js Library</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="documentation-tab" data-bs-toggle="tab" data-bs-target="#documentation" type="button" role="tab" aria-controls="documentation" aria-selected="false">Documentation</button>
</li>
</ul>
<div class="tab-content" id="optionsContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<section id="ancestry" class="mt-3">
<div class="row">
<div class="col-12">
<h3>
Analysis of ancestrality on PLCO data, discovering the distribution of each population in the samples.
</h3>
<p>
This web application presents inferred ancestry labels and populations according to several sizes of principal component (Ks) to explain genetic diversity in the cohort. The models were trained using 1kGenomes, SGPC, HDPC, to infer ancestry populations in PLCO cohort.<br/>
Choose the K referred to the number of populations in consideration:
</p>
<p id='notice' style='display: none'>Loading model ...</p>
<select id="kpca" onchange='change_kpc()' class="form-control"> </select>
<p id='noticep1' style='display: none'>Loading samples plot ...</p>
<div id="sample_dist" > </div>
<table class="table table-striped" id='infosample' style="display: none" >
<thead id="tabsampleh" > </thead>
<tbody id="tabsampleb" > </tbody>
</table>
<div id="sample_dist_pie" > </div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<h3>
Distribution of a certain principal component in the countries:
</h3>
<select id='pca_chosen' class="form-control" onchange="plot_map_allSource(); plot_map_plco();" > </select>
<div class="col-12 mt-3">
<h4> Reference panel: </h4>
<p id='noticep2' style='display: none'>Loading map plot of principal component frequency in countries ...</p>
<div id="map_pca" > </div>
</div>
<div class="col-12 mt-3">
<h4> PLCO inferred populations: </h4>
<p id='noticep3' style='display: none'>Loading map plot of principal component frequency in countries ...</p>
<div id="map_pca_plco" > </div>
</div>
</div>
</div>
</section>
</div>
<div class="tab-pane fade" id="documentation" role="tabpanel" aria-labelledby="documentation-tab">
<section id="documentation-content" class="mt-3">
</section>
</div>
</div>
<script src="plot.js"></script>
<script>
var ancestry = {data: null, pcs: [], k_chosen: 0}
ancestry.get_pcs_available = async () => {
var f=await fetch('pcs_available.tsv')
var t = await f.text()
var pcs = t.replace('\n','').split(',')
pcs = pcs.sort( (a,b) => a-b)
ancestry.pcs=pcs
var min = parseInt(pcs[0])
ancestry.k_chosen=min
var html1=''
pcs.forEach(el => {
var add = ''
if(el==min){
add=' selected '
}
html1+=`<option value='k-${el}' ${add} >${el} components</option>`
})
document.getElementById('kpca').innerHTML=html1
change_kpc()
}
ancestry.get_pcs_available()
ancestry.get_table_data = () => {
var k = ancestry.k_chosen
var html2=''
for(var i=0; i<parseInt(k); i++){
var add = ''
if(i==0){
add=' selected '
}
html2+=`<option value='PC${i}' ${add} >Principal Component ${i+1}</option>`
}
document.getElementById('pca_chosen').innerHTML=html2
notice.style.display=''
d3.csv(location.href+'k_data/data_k-'+k+'/merged_labels.csv', function(err, rows){
var keys = Object.keys(rows[0])
var t='<tr>'
for (k of keys){
if(k!=''){
t+=`<th>${k}</th>`
}
}
t+='</tr>'
tabsampleh.innerHTML=t
ancestry.data=rows
notice.style.display='none'
})
}
function change_kpc(){
ancestry.k_chosen=document.getElementById('kpca').value.split('-')[1]
ancestry.get_table_data()
render_plots()
}
function searchShowSample(ids){
infosample.style.display='none'
var t = ''
var row={}
ancestry.data.forEach( el => {
var keys = Object.keys(el)
if(el['Sample']==ids){
t='<tr>'
for (k of keys){
if(k!=''){
t+=`<td>${el[k]}</th>`
}
}
t+='</tr>'
row = el
}
})
tabsampleb.innerHTML=t
if(t!=''){
infosample.style.display=''
plot_distribution_sample(row)
}
}
function plot_distribution_sample(row){
var k = ancestry.k_chosen
var x = []
var y=[]
for (var i=0; i<parseInt(k); i++ ){
x.push('Principal Component '+(i+1))
y.push(row[''+i])
}
var data = [{
values: y,
labels: x,
type: 'pie'
}];
var layout = {
title: 'Detailed sample distribution',
height: 400,
width: 500
};
Plotly.newPlot('sample_dist_pie', data, layout);
}
//gendoc.buildDocumentation( location.href.split('#')[0]+'vcf.js', 'documentation-content', 'https://github.com/episphere/vcf/blob/main/vcf.js')
</script>
</div>
</div>
</body>
</html>