line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Search::Result::ResultFactory |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Jason Stajich |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Jason Stajich |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::Search::Result::ResultFactory - A factory to create Bio::Search::Result::ResultI objects |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Bio::Search::Result::ResultFactory; |
21
|
|
|
|
|
|
|
my $factory = Bio::Search::Result::ResultFactory->new(); |
22
|
|
|
|
|
|
|
my $resultobj = $factory->create(@args); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This is a general way of hiding the object creation process so that we |
27
|
|
|
|
|
|
|
can dynamically change the objects that are created by the SearchIO |
28
|
|
|
|
|
|
|
parser depending on what format report we are parsing. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This object is for creating new Results. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 FEEDBACK |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 Mailing Lists |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
37
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
38
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
41
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Support |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
I |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
50
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
51
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
52
|
|
|
|
|
|
|
with code and data examples if at all possible. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 Reporting Bugs |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
57
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via the |
58
|
|
|
|
|
|
|
web: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR - Jason Stajich |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Email jason@bioperl.org |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 APPENDIX |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
69
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Let the code begin... |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
package Bio::Search::Result::ResultFactory; |
78
|
5
|
|
|
5
|
|
15
|
use vars qw($DEFAULT_TYPE); |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
162
|
|
79
|
5
|
|
|
5
|
|
18
|
use strict; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
88
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
5
|
|
|
5
|
|
13
|
use base qw(Bio::Root::Root Bio::Factory::ObjectFactoryI); |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
459
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
BEGIN { |
85
|
5
|
|
|
5
|
|
991
|
$DEFAULT_TYPE = 'Bio::Search::Result::GenericResult'; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 new |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Title : new |
91
|
|
|
|
|
|
|
Usage : my $obj = Bio::Search::Result::ResultFactory->new(); |
92
|
|
|
|
|
|
|
Function: Builds a new Bio::Search::Result::ResultFactory object |
93
|
|
|
|
|
|
|
Returns : Bio::Search::Result::ResultFactory |
94
|
|
|
|
|
|
|
Args : |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub new { |
100
|
16
|
|
|
16
|
1
|
38
|
my($class,@args) = @_; |
101
|
|
|
|
|
|
|
|
102
|
16
|
|
|
|
|
65
|
my $self = $class->SUPER::new(@args); |
103
|
16
|
|
|
|
|
76
|
my ($type) = $self->_rearrange([qw(TYPE)],@args); |
104
|
16
|
50
|
|
|
|
91
|
$self->type($type) if defined $type; |
105
|
16
|
|
|
|
|
51
|
return $self; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 create |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Title : create |
111
|
|
|
|
|
|
|
Usage : $factory->create(%args) |
112
|
|
|
|
|
|
|
Function: Create a new L object |
113
|
|
|
|
|
|
|
Returns : L |
114
|
|
|
|
|
|
|
Args : hash of initialization parameters |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub create{ |
120
|
16
|
|
|
16
|
1
|
46
|
my ($self,@args) = @_; |
121
|
16
|
|
|
|
|
44
|
my $type = $self->type; |
122
|
16
|
|
|
|
|
34
|
eval { $self->_load_module($type) }; |
|
16
|
|
|
|
|
58
|
|
123
|
16
|
50
|
|
|
|
51
|
if( $@ ) { $self->throw("Unable to load module $type: $@"); } |
|
0
|
|
|
|
|
0
|
|
124
|
16
|
|
|
|
|
100
|
return $type->new(@args); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 type |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Title : type |
131
|
|
|
|
|
|
|
Usage : $factory->type('Bio::Search::Result::GenericResult'); |
132
|
|
|
|
|
|
|
Function: Get/Set the Result creation type |
133
|
|
|
|
|
|
|
Returns : string |
134
|
|
|
|
|
|
|
Args : [optional] string to set |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub type{ |
140
|
32
|
|
|
32
|
1
|
46
|
my ($self,$type) = @_; |
141
|
32
|
100
|
|
|
|
67
|
if( defined $type ) { |
142
|
|
|
|
|
|
|
# redundancy with the create method which also calls _load_module |
143
|
|
|
|
|
|
|
# I know - but this is not a highly called object so I am going |
144
|
|
|
|
|
|
|
# to leave it in |
145
|
16
|
|
|
|
|
23
|
eval {$self->_load_module($type) }; |
|
16
|
|
|
|
|
69
|
|
146
|
16
|
50
|
|
|
|
41
|
if( $@ ){ $self->warn("Cannot find module $type, unable to set type"); } |
|
0
|
|
|
|
|
0
|
|
147
|
16
|
|
|
|
|
32
|
else { $self->{'_type'} = $type; } |
148
|
|
|
|
|
|
|
} |
149
|
32
|
|
33
|
|
|
97
|
return $self->{'_type'} || $DEFAULT_TYPE; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |