BioPerl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
Bio/Tools/FootPrinter.pm view on Meta::CPAN
Returns : Bio::Tools::FootPrinter
Args : -fh/-file => $val, # for initing input, see Bio::Root::IO
=cut
sub new {
my($class,@args) = @_;
my $self = $class->SUPER::new(@args);
$self->_initialize_io(@args);
return $self;
}
=head2 next_feature
Title : next_feature
Usage : my $r = $footprint->next_feature
Function: Get the next feature from parser data
Returns : L<Bio::SeqFeature::Generic>
Args : none
=cut
sub next_feature{
my ($self) = @_;
$self->_parse_predictions() unless $self->_predictions_parsed();
return shift @{$self->{'_feature'}};
}
=head2 _add_feature
Title : _add_feature
Usage : $footprint->_add_feature($feat)
Function: Add feature to array
Returns : none
Args : none
=cut
sub _add_feature {
my ($self,$feat) = @_;
if($feat){
push @{$self->{'_feature'}},$feat;
}
}
=head2 _parse_predictions
Title : _parse_predictions
Usage : my $r = $footprint->_parse_predictions
Function: do the parsing
Returns : none
Args : none
=cut
sub _parse_predictions {
my ($self) = @_;
$/="";
my ($seq,$second,$third,$name);
while ($_ = $self->_readline) {
chomp;
my @array = split("\n",$_);
if ($#array == 5) {
# get rid of header
shift(@array); shift(@array);
}
if($#array == 3){
if($name){
$name=~s/>//;
my $feat = $self->_parse($name,$seq,$second,$third);
$self->_add_feature($feat);
}
$name = shift @array;
$seq = $array[0];
$second = $array[1];
$third = $array[2];
next;
}
$seq .= $array[0];
$third .= $array[2];
}
$seq || return;
$name=~s/>//;
my $feat = $self->_parse($name,$seq,$second,$third);
$self->_add_feature($feat);
$self->_predictions_parsed(1);
}
=head2 _predictions_parsed
Title : _predictions_parsed
Usage : $footprint->_predictions_parsed(1)
Function: Get/Set for whether predictions parsed
Returns : 1/0
Args : none
=cut
sub _predictions_parsed {
my ($self,$val) = @_;
if($val){
$self->{'_predictions_parsed'} = $val;
}
return $self->{'_predictions_parsed'};
}
=head2 _parse
Title : _parse
Usage : $footprint->_parse($name,$seq,$pattern)
Function: do the actual parsing
Returns : L<Bio::SeqFeature::Generic>
Args : none
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.464 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )