line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Water; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21075
|
use 5.012003; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
522
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#Intially the module Named as Water now its moved to Bio::Water |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
) ] ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @EXPORT = qw(wbridge); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub wbridge{ |
24
|
0
|
|
|
0
|
0
|
|
my ($v,$file,$dstart,$dend)=@_; |
25
|
0
|
|
|
|
|
|
chomp($file); |
26
|
0
|
|
|
|
|
|
chomp($dstart); |
27
|
0
|
|
|
|
|
|
chomp($dend); |
28
|
0
|
|
|
|
|
|
my @h=(); |
29
|
0
|
|
|
|
|
|
my @tmp=(); |
30
|
0
|
|
|
|
|
|
my @result=(); |
31
|
0
|
0
|
|
|
|
|
open(RD,"$file") or die "Cannot open the file"; |
32
|
0
|
|
|
|
|
|
while(){ |
33
|
0
|
0
|
|
|
|
|
push(@h,$_),if($_=~/^HETATM.*HOH/); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
my $len=$#h; |
36
|
0
|
|
|
|
|
|
for(my $i=0;$i<$len;$i++){ |
37
|
0
|
|
|
|
|
|
my $flag=0; |
38
|
0
|
|
|
|
|
|
my @tmp=(); |
39
|
0
|
|
|
|
|
|
my $val=''; |
40
|
0
|
|
|
|
|
|
my $tmp1=$h[$i]; |
41
|
0
|
|
|
|
|
|
for(my $j=0;$j<$len;$j++){ |
42
|
0
|
|
|
|
|
|
my $di=calc($tmp1,$h[$j]); |
43
|
0
|
0
|
0
|
|
|
|
if($di >=$dstart && $di <=$dend){if($flag==0){push(@tmp,$h[$i]);delete $h[$i];$flag++;}else{ |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
push(@tmp,$h[$j]);delete $h[$j]; |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
for(my $k=0;$k
|
49
|
0
|
|
|
|
|
|
for(my $j=0;$j
|
50
|
0
|
|
|
|
|
|
my $di=calc($tmp[$k],$h[$j]); |
51
|
0
|
0
|
0
|
|
|
|
if($di >=$dstart && $di <=$dend){ |
52
|
0
|
|
|
|
|
|
push(@tmp,$h[$j]);delete $h[$j]; |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
foreach my $dd (@tmp){ |
57
|
0
|
|
|
|
|
|
$val.=substr($dd,21,5).",";$val=~s/\s//g; |
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
chop $val; |
60
|
|
|
|
|
|
|
#print($val."\n")if($val); |
61
|
0
|
0
|
|
|
|
|
push(@result,$val."\n")if($val); |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
return @result; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
sub calc{ |
66
|
1
|
|
|
1
|
|
4
|
no warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
251
|
|
67
|
0
|
|
|
0
|
0
|
|
my ($tmpv,$hv)=@_; |
68
|
0
|
|
|
|
|
|
my $x1=substr($tmpv,30,8);$x1=~s/\s//g; |
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $x2=substr($hv,30,8);$x2=~s/\s+//; |
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $y1=substr($tmpv,38,8);$y1=~s/\s+//; |
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $y2=substr($hv,38,8);$y2=~s/\s+//; |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $z1=substr($tmpv,46,8);$z1=~s/\s+//; |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $z2=substr($hv,46,8);$z2=~s/\s+//; |
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $dis=sqrt((($x2-$x1)**2)+(($y2-$y1)**2)+(($z2-$z1)**2)); |
75
|
0
|
|
|
|
|
|
return $dis; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
__END__ |