File Coverage

blib/lib/MW/ssNA.pm
Criterion Covered Total %
statement 6 53 11.3
branch 0 18 0.0
condition 0 3 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 78 10.2


line stmt bran cond sub pod time code
1             package MW::ssNA;
2              
3 1     1   23859 use 5.006;
  1         6  
  1         46  
4 1     1   6 use strict;
  1         3  
  1         1027  
5             require Exporter;
6             our @ISA = qw(Exporter);
7             our @EXPORT = qw(ssNA);
8              
9             =head1 NAME
10              
11             MW::ssNA - Perl extension to calculate molecular weight of ssDNA or ssRNA.
12              
13             =head1 VERSION
14              
15             Version 1.00
16              
17             =cut
18              
19             our $VERSION = '1.00';
20              
21              
22             =head1 SYNOPSIS
23              
24             use MW::ssNA;
25             my @foo = ssNA("input_filename","option");
26             # option : 'd'-DNA, 'r'-RNA, 'cd'-total count of ATGC in DNA, 'cr'-total count of AUGC in RNA
27             foreach(@foo) { print;}
28              
29              
30             =cut
31              
32              
33             sub ssNA {
34 0     0 0   my $input=$_[0];
35 0           my $choice=$_[1];
36 0           my $flag11=0;
37 0           my ($flag,$count,$A,$T,$G,$C,$ssdna);
38 0           my ($x,$a1,$a2,$a3,$a4,$tu);
39 0 0         if ($choice eq 'd')
    0          
    0          
    0          
40             {
41 0           $a1=313.2;
42 0           $a2=304.2;
43 0           $a3=329.2;
44 0           $a4=289.2;
45 0           $tu='T';
46             }
47             elsif ($choice eq 'r')
48 0           {
49 0           $a1=329.2;
50 0           $a2=306.2;
51 0           $a3=345.2;
52 0           $a4=305.2;
53 0           $tu='U';
54             }
55 0           elsif ($choice eq 'cd') {$flag11=1;$tu='T';}
  0            
56 0           elsif ($choice eq 'cr') {$flag11=1;$tu='U';}
  0            
57 0           else {print "Invalid option!";exit;}
58 0 0         open(ID,"$input") or die "Could not open $input: $!";;
59 0           $flag=$count=0;
60 0           while()
61             {
62 0           chomp $_;
63 0 0         if(eof)
64             {
65 0           $A+=()=$_=~/A/g; $T+=()=$_=~/$tu/g; $G+=()=$_=~/G/g; $C+=()=$_=~/C/g;
  0            
  0            
  0            
66 0           $count++;
67 0           $flag=1;
68             }
69 0 0 0       if ($_=~/^>/ || $flag == 1)
70             {
71 0 0         if($count!=0)
72             {
73 0           $ssdna=($A*$a1)+($T*$a2)+($G*$a3)+($C*$a4);
74 0 0         if ($flag11 == 1) { print "$x\t A=$A\t$tu=$T\tC=$C\tG=$G\n"; }
  0            
  0            
75             else {print "$x\tMW : $ssdna\n";}
76 0           $A=$T=$G=$C='';
77             }
78 0           $x=$_;
79 0           next;
80             }
81 0           $A+=()=$_=~/A/g; $T+=()=$_=~/$tu/g; $G+=()=$_=~/G/g; $C+=()=$_=~/C/g;
  0            
  0            
  0            
82 0           $count++;
83             }
84              
85             }
86             =head1 AUTHOR
87              
88             SHANKAR M, C<< >>
89              
90             =head1 BUGS
91              
92             Please report any bugs or feature requests to C
93              
94             =head1 ACKNOWLEDGEMENTS
95              
96             Saravanan S E and Sabarinathan Radhakrishnan, for all their valuable thoughts and care.
97              
98             =head1 LICENSE AND COPYRIGHT
99              
100             Copyright 2011 Shankar M.
101              
102             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
103              
104              
105             =cut
106              
107             1; # End of MW::ssNA