BioPerl
view release on metacpan or search on metacpan
Bio/Seq/BaseSeqProcessor.pm view on Meta::CPAN
source stream. Otherwise the return value is the value
returned from the source stream from writing the last
object resulting from processing the last sequence object
given as argument.
Args : Bio::SeqI object, or an array of such objects
=cut
sub write_seq{
my ($self, @seqs) = @_;
my $ret;
foreach my $seq (@seqs) {
foreach my $processed ($self->process_seq($seq)) {
$ret = $self->source_stream->write_seq($seq);
return unless $ret;
}
}
return $ret;
}
=head2 sequence_factory
Title : sequence_factory
Usage : $seqio->sequence_factory($seqfactory)
Function: Get the Bio::Factory::SequenceFactoryI
Returns : Bio::Factory::SequenceFactoryI
Args : none
=cut
sub sequence_factory{
my $self = shift;
return $self->{'sequence_factory'} = shift if @_;
return $self->{'sequence_factory'};
}
=head2 object_factory
Title : object_factory
Usage : $obj->object_factory($newval)
Function: This is an alias to sequence_factory with a more generic name.
Example :
Returns : a L<Bio::Factory::ObjectFactoryI> compliant object
Args : on set, new value (a L<Bio::Factory::ObjectFactoryI>
compliant object or undef, optional)
=cut
sub object_factory{
return shift->sequence_factory(@_);
}
=head2 close
Title : close
Usage :
Function: Closes the stream. We override this here in order to cascade
to the source stream.
Example :
Returns :
Args : none
=cut
sub close{
my $self = shift;
return $self->source_stream() ? $self->source_stream->close(@_) : 1;
}
=head1 To be overridden by a derived class
=cut
=head2 process_seq
Title : process_seq
Usage :
Function: This is the method that is supposed to do the actual
processing. It needs to be overridden to do what you want
it to do.
Generally, you do not have to override or implement any other
method to derive your own sequence processor.
The implementation provided here just returns the unaltered
input sequence and hence is not very useful other than
serving as a neutral default processor.
Example :
Returns : An array of zero or more Bio::PrimarySeqI (or derived
interface) compliant object as the result of processing the
input sequence.
Args : A Bio::PrimarySeqI (or derived interface) compliant object
to be processed.
=cut
sub process_seq{
my ($self,$seq) = @_;
return ($seq);
}
1;
( run in 0.576 second using v1.01-cache-2.11-cpan-e93a5daba3e )