0
|
1
|
|
2 #
|
|
3 # BioPerl module for Bio::Search::Processor
|
|
4 #
|
|
5 # Cared for by Aaron Mackey <amackey@virginia.edu>
|
|
6 #
|
|
7 # Copyright Aaron Mackey
|
|
8 #
|
|
9 # You may distribute this module under the same terms as perl itself
|
|
10
|
|
11 # POD documentation - main docs before the code
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::Search::Processor - DESCRIPTION of Object
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 Give standard usage here
|
|
20
|
|
21 =head1 DESCRIPTION
|
|
22
|
|
23 Describe the object here
|
|
24
|
|
25 =head1 FEEDBACK
|
|
26
|
|
27 =head2 Mailing Lists
|
|
28
|
|
29 User feedback is an integral part of the evolution of this and other
|
|
30 Bioperl modules. Send your comments and suggestions preferably to one
|
|
31 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
32
|
|
33 bioperl-l@bioperl.org - General discussion
|
|
34 http://bio.perl.org/MailList.html - About the mailing lists
|
|
35
|
|
36 =head2 Reporting Bugs
|
|
37
|
|
38 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
39 the bugs and their resolution. Bug reports can be submitted via email
|
|
40 or the web:
|
|
41
|
|
42 bioperl-bugs@bio.perl.org
|
|
43 http://bugzilla.bioperl.org/
|
|
44
|
|
45 =head1 AUTHOR - Aaron Mackey
|
|
46
|
|
47 Email amackey@virginia.edu
|
|
48
|
|
49 Describe contact details here
|
|
50
|
|
51 =head1 APPENDIX
|
|
52
|
|
53 The rest of the documentation details each of the object
|
|
54 methods. Internal methods are usually preceded with a _
|
|
55
|
|
56 =cut
|
|
57
|
|
58 # Let the code begin...
|
|
59
|
|
60 package Bio::Search::Processor;
|
|
61
|
|
62 use strict;
|
|
63 use vars qw(@ISA);
|
|
64
|
|
65 =head2 new
|
|
66
|
|
67 Title : new
|
|
68 Usage : $proc = new Bio::Search::Processor -file => $filename,
|
|
69 -algorithm => 'Algorithm' ;
|
|
70 Function: Used to specify and initialize a data processor of search
|
|
71 algorithm results.
|
|
72 Returns : A processor specific to the algorithm type, if it exists.
|
|
73 Args : -file => filename
|
|
74 -algorithm => algorithm specifier
|
|
75 -fh => filehandle to attach to (file or fh required)
|
|
76
|
|
77 =cut
|
|
78
|
|
79 sub new {
|
|
80
|
|
81 my $type = shift;
|
|
82 my $proc;
|
|
83 my ($module, $load, $algorithm);
|
|
84
|
|
85 my %args = @_;
|
|
86
|
|
87 exists $args{'-algorithm'} or do {
|
|
88 print STDERR "Must supply an algorithm!";
|
|
89 return undef;
|
|
90 };
|
|
91
|
|
92 $algorithm = $args{'-algorithm'} || $args{'-ALGORITHM'};
|
|
93
|
|
94 $module = "_<Bio/Search/Processor/$algorithm.pm";
|
|
95 $load = "Bio/Search/Processor/$algorithm.pm";
|
|
96
|
|
97 unless ( $main::{$module} ) {
|
|
98 eval { require $load; };
|
|
99 if ( $@ ) {
|
|
100 print STDERR <<"EOF";
|
|
101 $load: $algorithm cannot be found
|
|
102 Exception $@
|
|
103 For more information about the Search/Processor system please see the
|
|
104 Processor docs. This includes ways of checking for processors at
|
|
105 compile time, not run time
|
|
106 EOF
|
|
107 return undef;
|
|
108 }
|
|
109 }
|
|
110
|
|
111 $proc = "Bio::Search::Processor::$algorithm"->new(@_);
|
|
112 return $proc;
|
|
113 }
|
|
114
|
|
115 1;
|