blib/lib/Bio/Water.pm

filter: Statementstmt 26.7% 19 / 71 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 20.7% 23 / 111 CC 15 SCAR 51.9
CC
15
Cov
19%
wbridge
240.0
calc
1.6
BEGIN
1.0
CRAP 180.3
↑ Summary
1 package Bio::Water;
2  
3 1 ▶use 5.012003;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 require Exporter;
8  
9 #Intially the module Named as Water now its moved to Bio::Water
10  
11 1 our @ISA = qw(Exporter);
12  
13 1 our %EXPORT_TAGS = ( 'all' => [ qw(
14
15 ) ] );
16  
17 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
18  
19 1 our @EXPORT = qw(wbridge);
20  
21 1 our $VERSION = '0.02';
22  
23 0 ▶sub wbridge{
Subroutine wbridge: not called CC=15 SCAR=54.8
Pod undocumented
24 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 ▶open(RD,"$file") or die "Cannot open the file";
Branch: 1 branch
BranchTrueFalseTotal
open RD, "$file" or die "Cannot open the file" 0 0 0
32 0 ▶while(<RD>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline RD)) 0 0 0
33 0 ▶push(@h,$_),if($_=~/^HETATM.*HOH/);
Branch: 1 branch
BranchTrueFalseTotal
if $_ =~ /^HETATM.*HOH/u 0 0 0
34 }
35 0 my $len=$#h;
36 0 ▶for(my $i=0;$i<$len;$i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $len) 0 0 0
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++){
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $len) 0 0 0
42 0 my $di=calc($tmp1,$h[$j]);
43 0 ▶ if($di >=$dstart && $di <=$dend){if($flag==0){push(@tmp,$h[$i]);delete $h[$i];$flag++;}else{
Branch: 2 branches
BranchTrueFalseTotal
if ($di >= $dstart and $di <= $dend) 0 0 0
if ($flag == 0) { } 0 0 0
Condition0%0/3
$di >= $dstart and $di <= $dend
!ll&&!rl&&r
000
MC/DC0%0/2
$di >= $dstart and $di <= $dend
$di >= $dstart $di <= $dend
Truth table0%0/3
A and B
A= $di >= $dstartB= $di <= $dend
ABresult
0X0
100
111
44 0 push(@tmp,$h[$j]);delete $h[$j];
45 }
46 }
47 }
48 0 ▶for(my $k=0;$k<scalar(@tmp);$k++){
Branch: 1 branch
BranchTrueFalseTotal
if ($k < scalar @tmp) 0 0 0
49 0 ▶ for(my $j=0;$j<scalar(@h);$j++){
Branch: 1 branch
BranchTrueFalseTotal
if ($j < scalar @h) 0 0 0
50 0 my $di=calc($tmp[$k],$h[$j]);
51 0 ▶ if($di >=$dstart && $di <=$dend){
Branch: 1 branch
BranchTrueFalseTotal
if ($di >= $dstart and $di <= $dend) 0 0 0
Condition0%0/3
$di >= $dstart and $di <= $dend
!ll&&!rl&&r
000
MC/DC0%0/2
$di >= $dstart and $di <= $dend
$di >= $dstart $di <= $dend
Truth table0%0/3
A and B
A= $di >= $dstartB= $di <= $dend
ABresult
0X0
100
111
52 0 push(@tmp,$h[$j]);delete $h[$j];
53 }
54 }
55 }
56 0 foreach my $dd (@tmp){
57 0 $val.=substr($dd,21,5).",";$val=~s/\s//g;
58 }
59 0 chop $val;
60 #print($val."\n")if($val);
61 0 ▶push(@result,$val."\n")if($val);
Branch: 1 branch
BranchTrueFalseTotal
if $val 0 0 0
62 }
63 0 return @result;
64 }
65 0 ▶sub calc{
Subroutine calc: not called CC=1 SCAR=4.6
Pod undocumented
66 1 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 0 my ($tmpv,$hv)=@_;
68 0 my $x1=substr($tmpv,30,8);$x1=~s/\s//g;
69 0 my $x2=substr($hv,30,8);$x2=~s/\s+//;
70 0 my $y1=substr($tmpv,38,8);$y1=~s/\s+//;
71 0 my $y2=substr($hv,38,8);$y2=~s/\s+//;
72 0 my $z1=substr($tmpv,46,8);$z1=~s/\s+//;
73 0 my $z2=substr($hv,46,8);$z2=~s/\s+//;
74 0 my $dis=sqrt((($x2-$x1)**2)+(($y2-$y1)**2)+(($z2-$z1)**2));
75 0 return $dis;
76 }
77  
78  
79 1 1;
80 __END__
↑ Summary