-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Additional algorithm 54.html
69 lines (55 loc) · 3.42 KB
/
Additional algorithm 54.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
<!-- ############################################################################################################################## -->
<!-- # John Wiley & Sons, Inc. # -->
<!-- # # -->
<!-- # Book: Algorithms in Bioinformatics: Theory and Implementation # -->
<!-- # Author: Dr. Paul A. Gagniuc # -->
<!-- # # -->
<!-- # Institution: # -->
<!-- # University Politehnica of Bucharest # -->
<!-- # Faculty of Engineering in Foreign Languages # -->
<!-- # Department of Engineering in Foreign Languages # -->
<!-- # # -->
<!-- # Area: European Union # -->
<!-- # Date: 04/01/2021 # -->
<!-- # # -->
<!-- # Cite this work as: # -->
<!-- # Paul A. Gagniuc. Algorithms in Bioinformatics: Theory and Implementation. John Wiley & Sons, 2021, ISBN: 9781119697961. # -->
<!-- # # -->
<!-- ############################################################################################################################## -->
<script>
// A SCANNER THAT USES A KNOWN PWM
c = "|G -0.92 -0.22 0.69 1.39 -40.06 0.69 -0.92 1.16 -0.92" +
"|A 0.18 0.47 -0.22 -40.06 -40.06 0.69 1.03 -0.92 -40.06" +
"|T -0.22 0.18 -0.22 -40.06 1.39 -40.06 -40.06 -0.92 1.03" +
"|C 0.47 -0.92 -0.92 -40.06 -40.06 -40.06 -0.22 -40.06 -0.22"
var n = [];
var m = [];
var p = [];
m = c.split('|');
// LOAD PWM
for(var i=1; i<m.length; i++) {
p[i-1]=[];
n = m[i].split('\t');
for(var j=0; j<n.length; j++){
p[i-1][j]=n[j]
}
}
// SEARCH MOTIF IN Z
var z = "AAAAAACAGGTGAGTAAAAAAAA";
var r = '';
var w = '';
var u = z.length - n.length + 2;
for(var l=0; l<u; l++) {
w = z.substr(l, n.length-1);
var d = w.split('');
var score = 0;
for(var f=0; f<d.length; f++){
for(var h=1; h<m.length; h++){
if(d[f]==p[h-1][0]) {score += Number(p[h-1][f+1]);}
}
}
if(score<0){score=0;}
r += score.toFixed(0) + ',';
}
document.write(r);
</script>