File: Motif.pm

package info (click to toggle)
libtfbs-perl 0.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,608 kB
  • ctags: 725
  • sloc: perl: 6,980; ansic: 699; makefile: 557; sh: 9
file content (102 lines) | stat: -rwxr-xr-x 2,218 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# TFBS module for TFBS::PatternGen::Gibbs::Motif
#
# Copyright Boris Lenhard and Wynand Alkema
# 
# You may distribute this module under the same terms as perl itself
#

# POD


# POD

=head1 NAME

TFBS::PatternGen::Gibbs::Motif - class for unprocessed motifs and associated 
numerical scores created by the Gibbs program


=head1 SYNOPSIS

=head1 DESCRIPTION

TFBS::PatternGen::Gibbs::Motif is used to store and manipulate unprocessed 
motifs and associated numerical scores created by the Gibbs program. You do not 
normally want to create a TFBS::PatternGen::Gibbs::Motif yourself. They are created
by running TFBS::PatternGen::Gibbs 

=head1 FEEDBACK

Please send bug reports and other comments to the author.

=head1 AUTHOR - Boris Lenhard and Wynand Alkema

Boris Lenhard E<lt>Boris.Lenhard@cgb.ki.seE<gt>
Wynand Alkema E<lt>Wynand.Alkema@cgb.ki.seE<gt>

=head1 APPENDIX

The rest of the documentation details each of the object
methods. Internal methods are preceded with an underscore.

=cut



# the code begins here:

package TFBS::PatternGen::Gibbs::Motif;
use vars qw(@ISA);
use strict;

use TFBS::Matrix::PFM;
use TFBS::PatternGen::Motif::Matrix;
@ISA = qw(TFBS::PatternGen::Motif::Matrix);



=head2 MAP

 Title   : MAP
 Usage   : my $map_score = $motif->MAP;
 Function: returns MAP score for the detected motif
	   (This is a backward compatibility method. For consistency,
	    you should use $motif->tag('MAP_score') instead
 Returns : float (a scalar)
 Args    : none

=head2 Other methods

TFBS::PatterGen::Motif::Gibbs inherits from TFBS::PatternGen::Motif,
which inherits from TFBS::Matrix. Please consult the documentation of those modules
for additional available methods.


=cut

sub MAP{
    my ($self) = @_;
    return $self->tag("MAP_score");
}



sub _calculate_PFM  {
    my $self = shift;
    unless ($self->{'nr_hits'}) {
	$self->throw(ref($self).
		     " objects must be created with a (nonzero)".
		     " -nr_hits parameter in constructor"
		     );
    }
    my @PFM;
    foreach my $rowref ( @{$self->{'matrix'}} )  {
	my @PFMrow;
	foreach my $element (@$rowref) {
	    push @PFMrow, int($self->{'nr_hits'}*$element/100 + 0.5);
	}
	push @PFM, [@PFMrow];
    }
    return \@PFM;
}