-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAdditional algorithm 26.html
46 lines (39 loc) · 2.93 KB
/
Additional algorithm 26.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
<!-- ############################################################################################################################## -->
<!-- # 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 step-by-step version for (C+G)%
document.write(CG_content('ATACCGGTCACGCGCGGCGCGCGCAC'));
function CG_content(s)
{
s = s.toLowerCase();
var a = 0;
var t = 0;
var c = 0;
var g = 0;
for (var u=0; u<=s.length; u ++)
{
var n = s.substr(u,1);
if (n == "a") {a = a + 1;}
if (n == "t") {t = t + 1;}
if (n == "g") {g = g + 1;}
if (n == "c") {c = c + 1;}
}
return (((c + g)/s.length) * 100).toFixed(2);
}
</script>