0
|
1 #---------------------------------------------------------------
|
|
2 # $Id: AnalysisParserI.pm,v 1.7 2002/12/01 00:05:19 jason Exp $
|
|
3 #
|
|
4 # BioPerl module Bio::AnalysisParserI
|
|
5 #
|
|
6 # Cared for by Steve Chervitz <sac@bioperl.org>
|
|
7 #
|
|
8 # Derived from Bio::SeqAnalysisParserI by Jason Stajich, Hilmar Lapp.
|
|
9 #
|
|
10 # You may distribute this module under the same terms as perl itself
|
|
11 #---------------------------------------------------------------
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::AnalysisParserI - Generic analysis output parser interface
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 # get a AnalysisParserI somehow.
|
|
20 # Eventually, there may be an Bio::Factory::AnalysisParserFactory.
|
|
21 # For now a SearchIO object, an implementation of AnalysisParserI, can be created
|
|
22 # directly, as in the following:
|
|
23 my $parser = Bio::SearchIO->new(
|
|
24 '-file' => 'inputfile',
|
|
25 '-format' => 'blast');
|
|
26
|
|
27 while( my $result = $parser->next_result() ) {
|
|
28 print "Result: ", $result->analysis_method,
|
|
29 ", Query: ", $result->query_name, "\n";
|
|
30
|
|
31 while( my $feature = $result->next_feature() ) {
|
|
32 print "Feature from ", $feature->start, " to ",
|
|
33 $feature->end, "\n";
|
|
34 }
|
|
35 }
|
|
36
|
|
37 =head1 DESCRIPTION
|
|
38
|
|
39 AnalysisParserI is a interface for describing generic analysis
|
|
40 result parsers. This module makes no assumption about the nature of
|
|
41 analysis being parsed, only that zero or more result sets can be
|
|
42 obtained from the input source.
|
|
43
|
|
44 This module was derived from Bio::SeqAnalysisParserI, the differences being
|
|
45
|
|
46 =over 4
|
|
47
|
|
48 =item 1. next_feature() was replaced with next_result().
|
|
49
|
|
50 Instead of flattening a stream containing potentially multiple
|
|
51 analysis results into a single set of features, AnalysisParserI
|
|
52 segments the stream in terms of analysis result sets
|
|
53 (Bio::AnalysisResultI objects). Each AnalysisResultI can then be
|
|
54 queried for its features (if any) as well as other information
|
|
55 about the result
|
|
56
|
|
57 =item 2. AnalysisParserI is a pure interface.
|
|
58
|
|
59 It does not inherit from Bio::Root::RootI and does not provide a new()
|
|
60 method. Implementations are free to choose how to implement it.
|
|
61
|
|
62 =back
|
|
63
|
|
64 =head2 Rationale (copied from Bio::SeqAnalysisParserI)
|
|
65
|
|
66 The concept behind this interface is to have a generic interface in sequence
|
|
67 annotation pipelines (as used e.g. in high-throughput automated
|
|
68 sequence annotation). This interface enables plug-and-play for new analysis
|
|
69 methods and their corresponding parsers without the necessity for modifying
|
|
70 the core of the annotation pipeline. In this concept the annotation pipeline
|
|
71 has to rely on only a list of methods for which to process the results, and a
|
|
72 factory from which it can obtain the corresponding parser implementing this
|
|
73 interface.
|
|
74
|
|
75 =head2 TODO
|
|
76
|
|
77 Create Bio::Factory::AnalysisParserFactoryI and
|
|
78 Bio::Factory::AnalysisParserFactory for interface and an implementation.
|
|
79 Note that this factory could return Bio::SearchIO-derived objects.
|
|
80
|
|
81 =head1 FEEDBACK
|
|
82
|
|
83 =head2 Mailing Lists
|
|
84
|
|
85 User feedback is an integral part of the evolution of this
|
|
86 and other Bioperl modules. Send your comments and suggestions preferably
|
|
87 to one of the Bioperl mailing lists.
|
|
88 Your participation is much appreciated.
|
|
89
|
|
90 bioperl-l@bioperl.org - General discussion
|
|
91 http://bio.perl.org/MailList.html - About the mailing lists
|
|
92
|
|
93 =head2 Reporting Bugs
|
|
94
|
|
95 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
96 the bugs and their resolution.
|
|
97 Bug reports can be submitted via email or the web:
|
|
98
|
|
99 bioperl-bugs@bio.perl.org
|
|
100 http://bugzilla.bioperl.org/
|
|
101
|
|
102 =head1 AUTHOR - Steve Chervitz, Jason Stajich, Hilmar Lapp
|
|
103
|
|
104 Email sac@bioperl.org
|
|
105
|
|
106 Authors of Bio::SeqAnalysisParserI on which this module is based:
|
|
107 Email jason@bioperl.org
|
|
108 Email hlapp@gmx.net
|
|
109
|
|
110 =head1 COPYRIGHT
|
|
111
|
|
112 Copyright (c) 2001 Steve Chervitz. All Rights Reserved.
|
|
113
|
|
114 =head1 DISCLAIMER
|
|
115
|
|
116 This software is provided "as is" without warranty of any kind.
|
|
117
|
|
118 =head1 APPENDIX
|
|
119
|
|
120 The rest of the documentation details each of the object methods.
|
|
121 Internal methods are usually preceded with a _
|
|
122
|
|
123 =cut
|
|
124
|
|
125 package Bio::AnalysisParserI;
|
|
126 use strict;
|
|
127 use vars qw(@ISA);
|
|
128
|
|
129 use Bio::Root::RootI;
|
|
130
|
|
131 @ISA = qw(Bio::Root::RootI);
|
|
132
|
|
133 =head2 next_result
|
|
134
|
|
135 Title : next_result
|
|
136 Usage : $result = $obj->next_result();
|
|
137 Function: Returns the next result available from the input, or
|
|
138 undef if there are no more results.
|
|
139 Example :
|
|
140 Returns : A Bio::Search::Result::ResultI implementing object,
|
|
141 or undef if there are no more results.
|
|
142 Args : none
|
|
143
|
|
144 =cut
|
|
145
|
|
146 sub next_result {
|
|
147 my ($self);
|
|
148 $self->throw_not_implemented;
|
|
149 }
|
|
150
|
|
151
|
|
152
|
|
153 =head2 result_factory
|
|
154
|
|
155 Title : result_factory
|
|
156 Usage : $res_fact = $obj->result_factory; (get)
|
|
157 : $obj->result_factory( $factory ); (set)
|
|
158 Function: Sets/Gets a factory object to create result objects for this AnalysisParser.
|
|
159 Returns : Bio::Factory::ResultFactoryI object
|
|
160 Args : Bio::Factory::ResultFactoryI object (when setting)
|
|
161 Comments: A AnalysisParserI implementation should provide a default result factory.
|
|
162 obtainable by the default_result_factory_class() method.
|
|
163
|
|
164 =cut
|
|
165
|
|
166 sub result_factory {
|
|
167 my $self = shift;
|
|
168 $self->throw_not_implemented;
|
|
169 }
|
|
170
|
|
171 =head2 default_result_factory_class
|
|
172
|
|
173 Title : default_result_factory_class
|
|
174 Usage : $res_factory = $obj->default_result_factory_class()->new( @args )
|
|
175 Function: Returns the name of the default class to be used for creating
|
|
176 Bio::AnalysisResultI objects.
|
|
177 Example :
|
|
178 Returns : A string containing the name of a class that implements
|
|
179 the Bio::Factory::ResultFactoryI interface.
|
|
180 Args : none
|
|
181
|
|
182 =cut
|
|
183
|
|
184 sub default_result_factory_class {
|
|
185 my $self = shift;
|
|
186 # TODO: Uncomment this when Jason's SearchIO code conforms
|
|
187 # $self->throw_not_implemented;
|
|
188 }
|
|
189
|
|
190 1;
|
|
191 __END__
|
|
192
|
|
193 NOTE: My ten-month old son Russell added the following line.
|
|
194 It doesn't look like it will compile so I'm putting it here:
|
|
195 mt6 j7qa
|