| 1 | package TFBS::PatternGen::Motif::Matrixscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/; |
| 2 | use varsscip-perl cpan TFBS v0.5.0 vars/ qw(@ISA); |
| 3 | use strictscip-perl cpan TFBS v0.5.0 strict/; |
| 4 | |
| 5 | use TFBS::Matrixscip-perl cpan TFBS v0.5.0 TFBS/Matrix/; |
| 6 | use TFBS::Matrix::PFMscip-perl cpan TFBS v0.5.0 TFBS/Matrix/PFM/; |
| 7 | |
| 8 | @ISAscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`@ISA`. = qw(TFBS::Matrix); |
| 9 | |
| 10 | sub newscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/new(). { |
| 11 | my ($caller, %args) = @_scip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`@_`.; |
| 12 | #my $matrix = TFBS::Matrix->new(%args, -matrixtype=>"PFM"); |
| 13 | #my $self = bless $matrix, ref($caller) || $caller; |
| 14 | my $self = $caller->SUPER::newscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`SUPER::new`().(%args, -matrixtype=>"PFM"); |
| 15 | $self->{'length'} = $args{'-length'} || scalarscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/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 PFMscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/PFM(). { |
| 25 | my ($self, %args) = @_scip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`@_`.; |
| 26 | return TFBS::Matrix::PFM->newscip-perl cpan TFBS v0.5.0 TFBS/Matrix/PFM/new(). (-name => "unknown", |
| 27 | -ID => "unknown", |
| 28 | -class=> "unknown", |
| 29 | -tags => { %{$self->{'tags'} } }, |
| 30 | %args, |
| 31 | -matrix => $self->_calculate_PFMscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/_calculate_PFM().() |
| 32 | ); |
| 33 | } |
| 34 | |
| 35 | sub patternscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/pattern(). { |
| 36 | my ($self, %args ) = @_scip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`@_`.; |
| 37 | $self->PFMscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/PFM().(%args); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | sub _calculate_PFMscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/_calculate_PFM(). { # simplest case: matrix already IS PFM |
| 42 | my $self = shiftscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/shift().; |
| 43 | return [@{$self->{'matrix'}}]; |
| 44 | } |
| 45 | |
| 46 | sub get_sitesscip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/get_sites().{ |
| 47 | return @{$_scip-perl cpan TFBS v0.5.0 TFBS/PatternGen/Motif/Matrix/`@_`.[0]->{'sites'}}; |
| 48 | } |
| 49 | |
| 50 | 1; |