| 1 | package MW::ssNA; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | require Exporter; | |||||||||||||||||||||||||||
| 6 | 2 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 7 | 2 | 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 | 2 | 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 | 0 | ▶ | sub ssNA { | ||||||||||||||||||||||||||
|
Subroutine
ssNA: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 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 | ▶ | if ($choice eq 'd') | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 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 | { | ||||||||||||||||||||||||||||
| 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';} | |||||||||||||||||||||||||||
| 56 | 0 | elsif ($choice eq 'cr') {$flag11=1;$tu='U';} | |||||||||||||||||||||||||||
| 57 | 0 | else {print "Invalid option!";exit;} | |||||||||||||||||||||||||||
| 58 | 0 | ▶ | open(ID,"$input") or die "Could not open $input: $!";; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | $flag=$count=0; | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | while(<ID>) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | 0 | chomp $_; | |||||||||||||||||||||||||||
| 63 | 0 | ▶ | if(eof) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 0 | $A+=()=$_=~/A/g; $T+=()=$_=~/$tu/g; $G+=()=$_=~/G/g; $C+=()=$_=~/C/g; | |||||||||||||||||||||||||||
| 66 | 0 | $count++; | |||||||||||||||||||||||||||
| 67 | 0 | $flag=1; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($_=~/^>/ || $flag == 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ =~ /^>/ or $flag == 1
MC/DC0%0/2
$_ =~ /^>/ or $flag == 1
$_ =~ /^>/
$flag == 1
Truth table0%0/3
A or B
A= $_ =~ /^>/B= $flag == 1
| |||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if($count!=0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||
| 73 | 0 | $ssdna=($A*$a1)+($T*$a2)+($G*$a3)+($C*$a4); | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ($flag11 == 1) { print "$x\t A=$A\t$tu=$T\tC=$C\tG=$G\n"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 0 | 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; | |||||||||||||||||||||||||||
| 82 | 0 | $count++; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | SHANKAR M, C<< <msinfopl at gmail.com> >> | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =head1 BUGS | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | Please report any bugs or feature requests to C<msinfopl at gmail.com> | ||||||||||||||||||||||||||||
| 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 | 2 | 1; # End of MW::ssNA | |||||||||||||||||||||||||||