TFBS::PatternGen SimplePFM
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
TFBS::PatternGen::SimplePFM - a simple position frequency matrix factory
Package variables
No package variables defined.
Included modules
TFBS::PatternGen
TFBS::PatternGen::Motif::Matrix
Inherit
TFBS::PatternGen
Synopsis
  
my @sequences = qw( AAGCCT AGGCAT AAGCCT
AAGCCT AGGCAT AGGCCT
AGGCAT AGGTTT AGGCAT
AGGCCT AGGCCT );
my $patterngen =
TFBS::PatternGen::SimplePFM->new(-seq_list=>\@sequences);

my $pfm = $patterngen->pattern(); # $pfm is now a TFBS::Matrix::PFM object
Description
TFBS::PatternGen::SimplePFM generates a position frequency matrix from a set
of nucleotide sequences of equal length, The sequences can be passed either
as strings, as Bio::Seq objects or as a fasta file.
This pattern generator always creates only one pattern from a given set
of sequences.
Methods
_create_motif
No description
Code
_validate_seq
No description
Code
newDescriptionCode
Methods description
newcode    nextTop
 Title   : new
Usage : my $db = TFBS::PatternGen::SimplePFM->new(%args);
Function: the constructor for the TFBS::PatternGen::SimplePFM
object
Returns : a TFBS::PatternGen::SimplePFM obkect
Args : This method takes named arguments;
you must specify one of the following
-seq_list # a reference to an array of strings
# and/or Bio::Seq objects
# or
-seq_stream # A Bio::SeqIO object
# or
-seq_file # the name of the fasta file containing
# all the sequences
Methods code
_create_motifdescriptionprevnextTop
sub _create_motif {
    my  $self = shift;
    my $length = $self->{'seq_set'}->[-1]->length();
    # initialize the matrix
my $matrixref = []; for my $i (0..3) { for my $j (0..$length-1) { $matrixref->[$i][$j] = 0; } } #fill the matrix
my @base = qw(A C G T); foreach my $seqobj ( @{ $self->{seq_set} } ) { for my $i (0..3) { my $seqstring = $seqobj->seq; my @seqbase = split "", uc $seqstring; for my $j (0..$length-1) { $matrixref->[$i][$j] += ($base[$i] eq $seqbase[$j])?1:0; } } } my $nrhits =0; for my $i (0..3) {$nrhits += $matrixref->[$i][0];} my $motif = TFBS::PatternGen::Motif::Matrix->new(-matrix => $matrixref, -nr_hits=> $nrhits); return $motif;
}
_validate_seqdescriptionprevnextTop
sub _validate_seq {
    # a utility function
my ($sequence)=@_; $sequence=~ s/[ACGT]//g; return ($sequence eq "" ? 1 : 0); } 1;
}
newdescriptionprevnextTop
sub new {
    my ($caller, %args) = @_;
    my $self = bless {}, ref($caller) || $caller;
    $self->_create_seq_set(%args) or die ('Error creating sequence set');
    $self->_check_seqs_for_uniform_length();
    $self->{'motifs'} = [$self->_create_motif()];
    return $self;
}
General documentation
patternTop
all_patternsTop
patternSetTop
The three above methods are used fro the retrieval of patterns,
and are common to all TFBS::PatternGen::* classes. Please
see TFBS::PatternGen for details.