Bio::F...essorI(3pm)
π Bio::Factory::SequenceProcessorI β the interface for chained sequence processing algorithms π
okay bestie, sit down, hydrate, and let's talk about Bio::Factory::SequenceProcessorI (that's the 3pm page, we love a Perl module). this one lives in the User Contributed Perl Documentation and it's genuinely one of those "wait this is kind of iconic" interfaces. it's the blueprint for gluing a bunch of sequence-processing algorithms into one long pipeline, and the whole point is that the end of the pipeline still looks like a plain old Bio::SeqIO stream. main character behaviour, honestly. β¨
πΈ SYNOPSIS πΈ
here's the vibe, in code, exactly as it goes:
use Bio::SeqIO;
use MySeqProcessor; # is-a Bio::Factory::SequenceProcessorI
# obtain your source stream, e.g., an EMBL file
my $seqin = Bio::SeqIO->new(-fh => \*STDIN, -format => 'embl');
# create your processor (it must implement this interface)
my $seqalgo = MySeqProcessor->new();
# chain together
$seqalgo->source_stream($seqin);
# you could create more processors and chain them one after another
# ...
# finally, the last link in the chain is your SeqIO stream
my $seqpipe = $seqalgo;
# once you've established the pipeline, proceed as if you had a
# single SeqIO stream
while(my $seq = $seqpipe->next_seq()) {
# ... do something ...
}
likeβ¦ you build the chain, and then you just keep calling next_seq() like nothing ever happened. no cap. π¦
π DESCRIPTION π
so what even is this? it defines an interface that lets you seamlessly chain sequence processing algorithms together β each one wrapped up all neat and tidy in its own module β while the end of the whole pipeline still speaks the regular Bio::SeqIO interface. the way that you never have to notice the chain is even there? obsessed.
and this is especially useful when you want an easily configurable processing pipeline built out of re-usable algorithms as little building blocks, instead of (hard-)coding the entire algorithm into one single script. modular? we love her. π
here's the tea: there are literally no restrictions on what an individual module can do with a sequence object it pulls from the source stream, before it hands it over through its own next_seq() method. it can:
- manipulate the sequence object while otherwise keeping it intact
- create any number of new sequence objects from it
- discard some of them
- or do literally any combination of the above
the only requirement is that its next_seq() method returns Bio::PrimarySeqI compliant objects. periodt.
and to play nice? if a processor does create new objects, it should try to use the same sequence factory that the source stream uses β but that's not strongly mandated, so it's more of a "please be a good citizen" situation, not a law. π«Ά
π FEEDBACK π
π¬ Mailing Lists
user feedback is an integral part of the evolution of this and other Bioperl modules β fr fr, they mean it. send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated, bestie. π
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π« Support
please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. this way, many experienced and reponsive experts will be able look at the problem and quickly address it. if at all possible, please include a thorough description of the problem along with code and data examples. the more context, the better the slay. π₯
π Reporting Bugs
report bugs to the Bioperl bug tracking system so they can keep track of the bugs and their resolution. bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
π AUTHOR - Hilmar Lapp π
Email hlapp at gmx.net
(iconic. giving credit where credit is due. π)
β¨ APPENDIX β¨
the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ (iykyk).
π source_stream
- Title:
source_stream - Usage:
$obj->source_stream($newval) - Function: Get/set the source sequence stream for this sequence processor.
an implementation is not required to allow set, but will usually do so.
- Example: (none given, bestie)
- Returns: A
Bio::Factory::SequenceStreamIcompliant object - Args: on set, new value (a
Bio::Factory::SequenceStreamIcompliant object)
π Bio::Factory::SequenceStreamI methods
the requirement to implement these methods is inherited from Bio::Factory::SequenceStreamI. an implementation may not necessarily have to implement all methods in a meaningful way. which methods will be necessary very much depends on the context in which an implementation of this interface is used.
e.g., if it's only used for post-processing sequences read from a SeqIO stream, write_seq() will not be used and hence does not need to be implemented in a meaningful way β it may in fact even throw an exception. π so like, don't panic if it does.
also, since an implementor will already receive built objects from a sequence stream, sequence_factory() may or may not be relevant, depending on whether the processing method does or does not involve creating new objects.
β next_seq
- Title:
next_seq - Usage:
$seq = stream->next_seq - Function: Reads the next sequence object from the stream and returns it.
in the case of a non-recoverable situation an exception will be thrown. do not assume that you can resume parsing the same stream after catching the exception β that's the big scary part, respect it. π note that you can always turn recoverable errors into exceptions by calling $stream->verbose(2).
- Returns: a
Bio::Seqsequence object - Args: none
See Bio::Root::RootI
π¦ write_seq
- Title:
write_seq - Usage:
$stream->write_seq($seq) - Function: writes the
$seqobject into the stream - Returns:
1for success and0for error - Args:
Bio::Seqobject
π§ sequence_factory
- Title:
sequence_factory - Usage:
$seqio->sequence_factory($seqfactory) - Function: Get the
Bio::Factory::SequenceFactoryI - Returns:
Bio::Factory::SequenceFactoryI - Args: none
and that's the whole page, bestie!! π this little legend was brought to you by perl v5.32.1, dated 2021-08-15, and filed under Bio::F...essorI(3pm) in the User Contributed Perl Documentation. go build a pipeline, you absolute icon. π
β¨π
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms