3 # BioPerl module for Bio::Tools::AlignFactory
5 # Cared for by Ewan Birney <birney@sanger.ac.uk>
7 # Copyright Ewan Birney
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Tools::AlignFactory - Base object for alignment factories
19 You wont be using this as an object, but using a dervied class
24 Holds common Alignment Factory attributes in place
28 http://bio.perl.org/ or birney@sanger.ac.uk
32 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
37 # Let the code begin...
40 package Bio
::Tools
::AlignFactory
;
41 use vars
qw($AUTOLOAD @ISA);
44 # Object preamble - inheriets from Bio::Root::Object
46 use Bio::Root::Object;
50 require Bio::Ext::Align;
53 print STDERR ("\nThe C-compiled engine for Smith Waterman alignments (Bio::Ext::Align) has not been installed.\n Please install the bioperl-ext package\n\n");
59 @ISA = qw(Bio::Root::Object Exporter);
60 # new() is inherited from Bio::Root::Object
62 # _initialize is where the heavy stuff will happen when new is called
66 my $make = $self->SUPER::_initialize
(@p);
70 $self->{'kbyte'} = 20000;
71 $self->{'report'} = 0;
72 # set stuff in self from @args
73 return $make; # success - we hope!
80 Usage : set/gets the amount of memory able to be used
82 : $factory->kbyte(200);
85 Argument : memory in kilobytes
90 my ($self,$value) = @_;
92 if( defined $value ) {
93 $self->{'kbyte'} = $value;
96 return $self->{'kbyte'};
103 Usage : set/gets the report boolean to issue reports or not
105 : $factory->report(1); # reporting goes on
113 my ($self,$value) = @_;
116 if( defined $value ) {
117 if( $value != 1 && $value != 0 ) {
118 $self->throw("Attempting to modify AlignFactory Report with no boolean value!");
120 $self->{'report'} = $value;
123 return $self->{'report'};
126 =head2 set_memory_and_report
128 Title : set_memory_and_report
129 Usage : Only used by subclasses.
138 sub set_memory_and_report
{
141 if( $self->{'kbyte'} < 5 ) {
142 $self->throw("You can suggest aligning things with less than 5kb");
145 &Bio
::Ext
::Align
::change_max_BaseMatrix_kbytes
($self->{'kbyte'});
147 if( $self->{'report'} == 0 ) {
148 &bp_sw
::error_off
(16);
150 &bp_sw
::error_on
(16);