1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
#
# BioPerl module for Bio::Tools::AlignFactory
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Ewan Birney <birney@sanger.ac.uk>
#
# Copyright Ewan Birney
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::AlignFactory - Base object for alignment factories
=head1 SYNOPSIS
You won't be using this as an object, but using a dervied class
like Bio::Tools::pSW
=head1 DESCRIPTION
Holds common Alignment Factory attributes in place
=head1 CONTACT
http://bio.perl.org/ or birney@sanger.ac.uk
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::Tools::AlignFactory;
use strict;
use base qw(Bio::Root::Root);
BEGIN {
eval {
require Bio::Ext::Align;
};
if ( $@ ) {
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");
exit(1);
}
}
sub new {
my($class,@args) = @_;
my $self = $class->SUPER::new(@args);
$self->_initialize(@args);
# set up defaults
$self->{'kbyte'} = 20000;
$self->{'report'} = 0;
return $self;
}
=head2 kbyte
Title : kbyte()
Usage : set/gets the amount of memory able to be used
Function :
: $factory->kbyte(200);
:
Returns :
Argument : memory in kilobytes
=cut
sub kbyte {
my ($self,$value) = @_;
if( defined $value ) {
$self->{'kbyte'} = $value;
}
return $self->{'kbyte'};
}
=head2 report
Title : report()
Usage : set/gets the report boolean to issue reports or not
Function :
: $factory->report(1); # reporting goes on
:
Returns : n/a
Argument : 1 or 0
=cut
sub report {
my ($self,$value) = @_;
if( defined $value ) {
if( $value != 1 && $value != 0 ) {
$self->throw("Attempting to modify AlignFactory Report with no boolean value!");
}
$self->{'report'} = $value;
}
return $self->{'report'};
}
=head2 set_memory_and_report
Title : set_memory_and_report
Usage : Only used by subclasses.
Function:
Example :
Returns :
Args :
=cut
sub set_memory_and_report{
my ($self) = @_;
if( $self->{'kbyte'} < 5 ) {
$self->throw("You can suggest aligning things with less than 5kb");
}
&Bio::Ext::Align::change_max_BaseMatrix_kbytes($self->{'kbyte'});
if( $self->{'report'} == 0 ) {
&Bio::Ext::Align::error_off(16);
} else {
&Bio::Ext::Align::error_on(16);
}
}
1;
|