-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathods.php
125 lines (94 loc) · 3.45 KB
/
ods.php
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
<?php
// ________________________________ ____________________________
// / PromKappa \________________________/ v2.00 |
// | |
// | Name: PromKappa (ported from VB6 to PHP) |
// | Original language : Visual Basic 6 |
// | Original source V1 : http://www.biomedcentral.com/1471-2164/13/512/additional |
// | Original source V2 : http://www.biomedcentral.com/1471-2164/14/278/additional |
// | Category: Open source software |
// | Author: Paul A. Gagniuc |
// | Email: [email protected] |
// | |
// | Date Created: October 2013 |
// | Language: PHP |
// | Use: DNA patterns, analysis of DNA sequences |
// | |
// | _____________________________ |
// |_________________/ \______________________________________|
//
$sequence = $_GET["s"];
function Sliding_Windw($sequence)
{
$window = 30;
$step = 1;
for ($u=0; $u<=strlen($sequence) - $window; $u += $step)
{
echo substr($sequence, $u, $window) . "<br>";
}
}
function CG($sequence)
{
$a = 0;
$t = 0;
$c = 0;
$g = 0;
for ($u=0; $u<=strlen($sequence); $u ++)
{
$nucleotida = strtolower(substr($sequence, $u, 1));
if ($nucleotida == "a") {$a = $a + 1;}
if ($nucleotida == "t") {$t = $t + 1;}
if ($nucleotida == "g") {$g = $g + 1;}
if ($nucleotida == "c") {$c = $c + 1;}
}
return (100 / ($c + $g + $t + $a)) * ($c + $g);
}
function IC($sequence)
{
$count = 0;
$total = 0;
$S1 = strtolower($sequence);
$max = strlen($S1) - 1;
for ($u=1; $u<=$max; $u++)
{
$s2 = substr($S1, $u + 1, strlen($S1));
for ($i=1; $i<=strlen($s2); $i++)
{
if (substr($S1, $i, 1) == substr($s2, $i, 1)) {
$count = $count + 1;
}
}
if ($count <= 0) {
$count = 0;
} else {
$total = $total + ($count / strlen($s2) * 100);
$count = 0;
}
}
return round(($total / $max), 2);
}
$width = 255;
$height = 255;
$image = imagecreatetruecolor($width, $height);
$window = 30;
$step = 1;
$no_points = strlen($sequence) - $window;
for ($u=0; $u<=$no_points; $u += $step)
{
$window_string = substr($sequence, $u, $window);
$CGP = CG($window_string);
$KIC = IC($window_string);
$X_CG = round(($width/100) * $CGP);
$Y_IC = round(($height/100) * $KIC);
$line_with = round($width/$no_points);
$x1 =$X_CG;
$y1 =$height - $Y_IC;
$x2 =$X_CG + $line_with;
$y2 =$height - $Y_IC;
$color = imagecolorallocate($image, 255, 0, 0); ;
imageline($image, $x1, $y1, $x2, $y2, $color);
}
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>