-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiviewlogo.html
More file actions
409 lines (363 loc) · 20.1 KB
/
multiviewlogo.html
File metadata and controls
409 lines (363 loc) · 20.1 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> -->
<!-- <script src="js/dom.js"></script> -->
<link rel="stylesheet" type="text/css" href="style/style.css">
<script src="js/d3.min.js"></script>
<script src="js/visualization.js"></script>
<script src="simg.min.js"></script>
<script src="saveSvgAsPng.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jspdf.js"></script>
<!-- <script src= "js/valueofinput.js"></script> -->
<!-- <script src="js/svg.js"></script> -->
<!-- <script src="js/file.js"></script> -->
</head>
<body >
<div class="navbar navbar-default navbar" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">Bio logo</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">sequencelogo</a></li>
<li><a href="multiviewlogo.html">multiviewlogo</a></li>
<li><a href="mutationlogo.html">mutationlogo</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!--end Navigation-->
<div class="container-fluid">
<!--start fluid container for responsive content-->
<div class="row" >
<!--outermost row container-->
<h1>
<p class="text-center">Bio logo</p>
</h1>
<!-- <form enctype="multipart/form-data" action="" name="logoform" method="post"> -->
<!--start WebLogo form-->
<div class="row">
<!--open sequence data form row-->
<div class="col-sm-1">
<br>
</div>
<!--left margin column for sequence data form -->
<div class="col-sm-10">
<!--central column for sequence data form-->
<div class="thumbnail clearfix row" id="thumbnail-1">
<!--open thumbnail 1 div-->
<h2> Sequence Data Input:</h2>
<hr>
<div class="form-group clearfix">
<!--start clearfix div for browse & open buttons-->
<div class="col-sm-4">
<input type="file" id="affectedsequence" name="sequences_file"></input>
</div>
<div class="col-sm-2">
<!--center spacing div-->
</div>
<!--start URL download container div-->
</div>
</div>
<div class="thumbnail clearfix row" id="hide">
<!--open thumbnail 1 div-->
<h2> Germline Data Input:</h2>
<hr>
<div class="form-group clearfix">
<!--start clearfix div for browse & open buttons-->
<div class="col-sm-4">
<input type="file" id="germlinesequence" name="germlines_file"></input>
</div>
<div class="col-sm-2">
<!--center spacing div-->
</div>
</div>
<!--start clearfix div for browse & open buttons-->
<!--close paste seqence data textbox-->
<!--End clearfix row div for Download and Dropbox button-->
</div>
<!--end clearfix #thumbnail-1 div-->
</div>
<!--end col-sm-10 central column for sequence data form-->
<div class="col-sm-1">
<!--start margin row for sequence data form-->
<br>
</div>
<!--end margin row for sequence data form-->
</div>
<!--end sequence data form row-->
<div class="row">
<div class="col-sm-12 center-block">
<button id="singlebutton" name="singlebutton" onclick="calculation()" class="btn btn-primary center-block">
Generate Bio Logo
</button>
</div>
</div>
<div class="row">
<div class="col-sm-12" id="hiddenblock" >
</div>
</div>
<div class="row">
<!--start row for logo options-->
<form enctype="multipart/form-data" name="logoform" id="requirements" >
<div class="col-sm-1">
<br>
</div>
<!--left column margin for logo options form-->
<div class="col-sm-10" id="wrap">
<!--central col-sm-10 logo options column-->
<div class="thumbnail col-sm-14" id="thumbnail-2">
<!--start thumbnail-2 div; left side logo options-->
<div class="form-group">
<!--open title div-->
<label>Title:</label>
<input type="text" name="logo_title" value="" maxlength="80" placeholder="max 80 char " id="title">
</div>
<!--close title div-->
<div class="form-group clearfix">
<!--open output format div-->
<label>Output Format:</label>
<!--open div for format options-->
<select name="format">
<option value="png_print">PNG</option>
<option value="pdf">PDF </option>
<option value="svg">SVG </option>
</select>
<!--close div for format options-->
</div>
<!--close output format div-->
<!--open div for sequence type option-->
<div class="form-group">
<label >Sequence type </label>
<select type="submit" name="alphabet">
<option value="protein">protein</option>
<option value="dna">dna</option>
</select>
</div>
<div class="form-group">
<!--open first position number div-->
<label > First position number: </label>
<input type="text" name="first_index" placeholder="max length 80" size="4" maxlength="80" value="1">
</div>
<!--close first position div-->
<div class="form-group">
<!--open logo range div-->
<label > Logo range: </label>
<input type="text" placeholder="logo start" name="logo_start" id="firstposition" size="4" />
<input type="text" placeholder="logo end" name="logo_end" id="lastposition" size="4" />
</div>
<!--close logo range div-->
<div class="form-group">
<!--open figure label div-->
<label>Figure label:</label>
<input type="text" name="logo_label" value="" maxlength="100">
</div>
<div id="padding-div">
<br>
</div>
</div>
</form>
</div>
</div>
<!--end outermost row container-->
</div>
<!--end fluid container for responsive content-->
<!--fallback to server-hosted files in case CDNs fail-->
<script type="text/javascript">
var affectedarray=[],germlinearray=[];
for(var i=0;i<400;i++)
{
germlinearray[i]= new Array(2).fill(0);
}
var affectedlength,lengthofgchar,germlinelength,numberofpatients;
document.getElementById('germlinesequence').onchange = function(){
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(progressEvent){
var text=this.result;
var newtext=text.replace(/^.*>.*$/mg, "@");
var lines = newtext.split('@');
var size=lines[1].length; //length of one dna sequence
var size2=lines.length; //length of the total dna sequence array
// console.log(lines);
//to keep track of the frequency of alphabets
/*var germlinefreq= [];
for(var i=0;i<size;i++)
{
germlinefreq[i] = new Array(2).fill(0);
}*/
var index=0;
for(var j=1;j<size;j++)
{
if(lines[1][j]>='A'&& lines[1][j]<='Z')
{
var ascii=lines[1][j].charCodeAt(); //getting the ascii value of one character in one position
//console.log(j + ' '+ ascii);
germlinearray[index][0]=ascii;
index++;
//console.log(germlinear[j-1][0]); //remember to change it when done
}
else
{
console.log(lines[1][j]);
}
}
//germlinelength=germlinefreq.length;
//germlinearray=Array.from(germlinefreq);
germlinelength=size-1; // first and last index of the line contains LF char
//console.log(lines[1][0] +"and"+ lines[1][5]);
};
reader.readAsText(file);
};
document.getElementById('affectedsequence').onchange = function(){
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(progressEvent){
var text=this.result;
var newtext=text.replace(/^.*>.*$/mg, "@");
var lines = newtext.split('@');
var size=lines[1].length;
var size2=lines.length;
lengthofgchar=size2;
//to keep track of the frequency of alphabets
//we are starting from i=1 and j=1 because in the first line every first character is the main header which is useless
var freq= [];
for(var i=0;i<size-1;i++) //first and last index of every line contains LF because of splitting
{
freq[i] = new Array(26).fill(0);
}
for(var j=1;j<size-1;j++)
{
lengthofgchar=size2-1;
//console.log("lengthofgchar "+lengthofgchar);
for(var i=1;i<size2;i++)
{
if(!(lines[i][j]==undefined | lines[i][j]==null ))
{
var index=lines[i][j].charCodeAt()-65;
//console.log(index);
/*if(index<65 | index >90)
console.log(index);*/
if(index>=0 && index <=25 /*&& lines[i][j].charCodeAt()!=germlinearray[j][0]*/)
freq[j-1][index]=freq[j-1][index]+1;
else if(lines[i][j]=='-')
{
lengthofgchar--;
}
}
}
germlinearray[j-1][1]=lengthofgchar;
}
//console.log(size2);
// console.log(lengthofgchar);
numberofpatients=size2-1;
console.log("number of patients are "+numberofpatients);
affectedarray=Array.from(freq);
affectedlength=affectedarray.length;
// console.log(affectedarray);
};
reader.readAsText(file);
};
//console.log(germlinearray);
function calculation(){
document.getElementById("hide").style.visibility = "hidden";
var value;
var x=document.getElementById("requirements"); //reading value from requirements form field
title=x.elements[0].value;
outputformat=x.elements[1].value;
sequencetype=x.elements[2].value;
firstposition=x.elements[3].value;
rangestart=x.elements[4].value;
rangeend=x.elements[5].value;
figurelabel=x.elements[6].value;
var bitcalc;
if(rangestart==0 && rangeend==0)
{
rangestart=0;
rangeend=affectedlength;
}
else
{
rangestart--;
rangeend;
}
if(sequencetype=="protein")
{
bitcalc=20;
}
else if(sequencetype=="dna")
{
bitcalc=4;
}
//console.log(bitcalc);
//console.log(rangeend);
var Ii;
console.log("came here");
for(var i=0;i<affectedlength;i++)
{
var sum=0;
for(var j=0;j<26;j++)// calculating Ii for every index
{
if(affectedarray[i][j]>0)
{
sum=sum+((affectedarray[i][j]/numberofpatients)*Math.log2(affectedarray[i][j]/numberofpatients));
}
}
Ii=Math.log2(bitcalc)-sum;
//germlinearray[i][1]=Ii;
var total=0;
for(var j=0;j<26;j++)// calculating Ii for every index
{
if(affectedarray[i][j]>0)
{
affectedarray[i][j]=((affectedarray[i][j]/numberofpatients)/Ii);
total+=affectedarray[i][j];
//console.log(String.fromCharCode(j+65)+" "+affectedarray[i][j]);
}
}
//console.log(i+" "+i+" "+germlinearray[i][0]+" "+total);
germlinearray[i][1]=total;
//console.log(germlinearray[i][1]);
}
for(var j=0;j<germlinelength-1;j++) //for cancelling the characters which matches the germline character
{
var mainacid=germlinearray[j][0]-65;
var kk=mainacid+65;
//if(kk<65 | kk>90)
//console.log("mainacid "+kk);
if(mainacid>=0) //ignoring the newline LF,RF characters
{
value=affectedarray[j][mainacid];
germlinearray[j][1]-=value;
affectedarray[j][mainacid]=0;
}
console.log(germlinearray[j][1]);
//console.log("came here");
//console.log(germlinearray[j][1]);
}
var rangedarray=affectedarray.slice(rangestart,rangeend);
visualization(affectedlength,affectedarray,germlinelength,germlinearray,numberofpatients);
//console.log(germlinearray);
//is the git working
};
</script>
</body>
</html>