Created
February 18, 2013 14:22
-
-
Save pcantalupo/4977773 to your computer and use it in GitHub Desktop.
mono and dinucleotide frequency methods for Bio::SeqUtils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 monofreq | |
Title : monofreq | |
Usage : $seq = Bio::SeqUtils->monofreq($seq) | |
Function: Method for determining the mononucleotide frequencies of | |
a DNA sequence | |
Returns : Array of mononucleotide frequencies T, C, G, A | |
Args : none | |
=cut | |
sub monofreq { | |
my ($self, $seq) = @_; | |
$seq->isa('Bio::PrimarySeqI') || | |
$self->throw("Not a Bio::PrimarySeqI object but [$self]"); | |
$seq->alphabet =~ /DNA/i || | |
$self->throw('Not a DNA sequence'); | |
my $DNA = $seq->seq; | |
my $Total = $seq->length; | |
my $T=($DNA=~tr/T//); my $C=($DNA=~tr/C//); my $G=($DNA=~tr/G//); my $A=($DNA=~tr/A//); | |
my $Tper = $T/$Total; my $Cper = $C/$Total; my $Gper = $G/$Total; my $Aper = $A/$Total; | |
return ($Tper, $Cper, $Gper, $Aper); | |
} | |
=head2 dinucbias | |
Title : dinucbias | |
Usage : $seq = Bio::SeqUtils->dinucbias($seq) | |
Function: Method for determining the dinucleotide bias | |
frequencies for a DNA sequence | |
Returns : Array of dinucleotide bias frequencies TT, TC, ...CT,..GT,..AT,AC,AG,AA | |
Args : none | |
=cut | |
sub dinucbias { | |
my ($self, $seq) = @_; | |
$seq->isa('Bio::PrimarySeqI') || | |
$self->throw("Not a Bio::PrimarySeqI object but [$self]"); | |
$seq->alphabet =~ /DNA/i || | |
$self->throw('Not a DNA sequence'); | |
# needs implemented | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment