Debian Codegraph @

blib/lib/TFBS/PatternGen/Motif/Matrix.pm

raw
1 package TFBS::PatternGen::Motif::Matrix;
2 use vars qw(@ISA);
3 use strict;
4
5 use TFBS::Matrix;
6 use TFBS::Matrix::PFM;
7
8 @ISA = qw(TFBS::Matrix);
9
10 sub new {
11 my ($caller, %args) = @_;
12 #my $matrix = TFBS::Matrix->new(%args, -matrixtype=>"PFM");
13 #my $self = bless $matrix, ref($caller) || $caller;
14 my $self = $caller->SUPER::new(%args, -matrixtype=>"PFM");
15 $self->{'length'} = $args{'-length'} || scalar @{$self->{'matrix'}->[0]};
16 $self->{'nr_hits'} = ($args{'-nr_hits'} || undef);
17 # || $self->throw("No -nr_hits provided.");
18 # Why was nr_hits required ?? (Boris)
19 $self->{'sites'}=$args{'-sites'};
20 # $self->{'tags'} = ($args{'-tags'} || {});
21 return $self;
22 }
23
24 sub PFM {
25 my ($self, %args) = @_;
26 return TFBS::Matrix::PFM->new (-name => "unknown",
27 -ID => "unknown",
28 -class=> "unknown",
29 -tags => { %{$self->{'tags'} } },
30 %args,
31 -matrix => $self->_calculate_PFM()
32 );
33 }
34
35 sub pattern {
36 my ($self, %args ) = @_;
37 $self->PFM(%args);
38 }
39
40
41 sub _calculate_PFM { # simplest case: matrix already IS PFM
42 my $self = shift;
43 return [@{$self->{'matrix'}}];
44 }
45
46 sub get_sites{
47 return @{$_[0]->{'sites'}};
48 }
49
50 1;