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