Skip to content

Commit

Permalink
modified: Motif.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchaolin committed Feb 3, 2024
1 parent 1859d08 commit f353284
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Motif.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package Motif;

require Exporter;

our $VERSION = 1.03;
our $VERSION = 1.04;

@ISA = qw (Exporter);

Expand All @@ -30,6 +30,7 @@ our $VERSION = 1.03;
countToBayesianMatrix
countToFrequencyMatrix
countToStormoMatrix
frequencyToScoringMatrix
getMatrix
getMatrixScore
getMaxMatrixScore
Expand Down Expand Up @@ -696,6 +697,25 @@ sub countToBayesianMatrix
}
}

=head2 frequencyToScoringMatrix
=cut

sub frequencyToScoringMatrix
{
my ($matrix, $baseComp) = @_;

my @scoringMatrix;
my $width = @$matrix;

my @bases = ('A', 'C', 'G', 'T');
for (my $p = 0; $p < $width; $p++)
{
map {$scoringMatrix[$p]{$_} = log ($matrix->[$p]{$_} / $baseComp->{$_}) / log (2)} @bases;
}
return \@scoringMatrix;
}


=head2 revComMatrix
Expand Down Expand Up @@ -799,6 +819,7 @@ sub getMatrixScore
}



#handle pattern-based motifs


Expand Down

0 comments on commit f353284

Please sign in to comment.