7 use base qw(Root Read Write);
11 Profile - Base object for various types of profile
17 my $prof = Profile->new;
21 Basic methods for storing information sequence profiles. The model of this object is for each sequence position to have an array of data associated with it.
25 Inherits from Root, Read and Write.
27 =head2 $prof->add_pos(@data)
29 Add data to the end position of the profile.
35 @_ or croak "No data passed to ".__PACKAGE__."\n";
36 push @{ $self->{__PACKAGE__."lines"} }, pack "d*", @_;
41 map { [ $self->get_pos ] } 0.. $self->get_size - 1;
44 =head2 $prof->add_line(@data)
52 =head2 @data $prof->get_pos
54 Itterator for getting all the positions in a profile. Returns the same information as get_num_pos, or undef when it reaches the end of the profile. When this happens, a new call starts at the begining of the profile.
60 $self->{__PACKAGE__."counter"} ||= 0;
62 if ((my @foo = $self->get_num_pos( $self->{__PACKAGE__."counter"}++ )) > 0) {
66 $self->{__PACKAGE__."counter"} = 0;
71 =head2 @data = $prof->get_num_pos($position)
73 Access the profile information for a particular position in the profile.
78 my ($self, $pos) = @_;
80 confess "get_num_pos didn't receive position" unless defined $pos;
84 #print Dumper unpack "d*", @{ $self->{__PACKAGE__."lines"}->[$pos]};
86 confess "No positions present" unless exists $self->{__PACKAGE__."lines"};
87 return undef unless defined $self->{__PACKAGE__."lines"}->[$pos];
88 return unpack "d*", $self->{__PACKAGE__."lines"}->[$pos];
91 =head2 $prof->get_size
93 Returns the number of positions in the profile.
99 return @{ $self->{__PACKAGE__."lines"} };
102 =head2 $prof->get_line($position)
104 Alias for get_num_pos().
108 *get_line = *get_num_pos;