Bio::Tools::Analysis SimpleAnalysisBase
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::Tools::Analysis::SimpleAnalysisBase - abstact superclass for
SimpleAnalysis implementations
Package variables
Privates (from "my" definitions)
$FLOAT = '[+-]?\d*\.\d*'
%STATUS = map { $_ => 1 } qw(CREATED COMPLETED TERMINATED_BY_ERROR)
Included modules
Bio::SimpleAnalysisI
Bio::WebAgent
Data::Dumper
Inherit
Bio::SimpleAnalysisI Bio::WebAgent
Synopsis
  # no to be run directly
Description
This class is a generic implementation of SimpleAnalysisI and should
be used as a base class for specific implementations.
SimpleAnalysis implementing modules just need to provide a specific _run()
result() and _init() methods, plus any get/set methods for parameter
to the analysis program.
Methods
newDescriptionCode
seqDescriptionCode
analysis_nameDescriptionCode
analysis_specDescriptionCode
clearDescriptionCode
input_specDescriptionCode
result_specDescriptionCode
run
No description
Code
wait_for
No description
Code
status
No description
Code
_process_arguments
No description
Code
_run
No description
Code
Methods description
newcode    nextTop
 Usage   : $job->new(...)
 Returns : a new analysis object, 
 Args    : none (but an implementation may choose
           to add arguments representing parameters for the analysis
           program. Each key value of must have a method implemented
           for it in a subclass. A seq () method is provided here as
           this will probably be needed by all sequence analysis programs
seqcodeprevnextTop
 Usage   : $job->seq()
 Returns : a Bio::PrimarySeqI implementing sequence object, or void
 Args    : None, or a Bio::PrimarySeqI implementing object
analysis_namecodeprevnextTop
    Useage   :  $analysis->analysis_name();
    Returns  :  The analysis name
    Arguments:  none
analysis_speccodeprevnextTop
    Useage   :  $analysis->analysis_spec();
    Returns  :  a hash reference to  a hash of analysis parameters. See
                Bio::SimpleAnalysisI for a list of recommended key values.
    Arguments:  none
clearcodeprevnextTop
    Usage     :$analysis->clear();
    Returns   :true value on success
    Arguments :none
    Purpose   :to remove raw results from a previous analysis so that
               an analysis can be repeated with different parameters.
input_speccodeprevnextTop
    Useage   :  $analysis->input_spec();
    Returns  :  a  reference to  an array of  hashes of analysis parameters. See
                Bio::SimpleAnalysisI for a list of recommended key values.
    Arguments:  none
result_speccodeprevnextTop
    Useage   :  $analysis->result_spec();
    Returns  :  a  reference to  a   hashes of resultformats. See
                Bio::SimpleAnalysisI for a list of recommended key values. The key
                values can be used as parameters to the result() method, the values
                provide descriptions.
    Arguments:  none
Methods code
newdescriptionprevnextTop
sub new {
    my $class = shift;

    my $self = $class->SUPER::new(); #WebAGent new
$self->_init; #this line has to be before the attributes are filled in
while ( @_ ) { my $key = lc shift; $key =~ s/^-//; $self->$key(shift); } return $self;
}
seqdescriptionprevnextTop
sub seq {
    my ($self,$value) = @_;
    if ( defined $value) {
        $self->throw("I need a Bio::PrimarySeqI, not  [". $value. "]")
            unless $value->isa('Bio::PrimarySeqI');
		$self->throw(" I need a PrimarySeq object, not a BioSeq object ")
			if $value->isa('Bio::SeqI');

        my $mol_type = $self->analysis_spec->{'type'};
        $self->throw("I need a [" . $mol_type . "]  seq, not a  [". $value->alphabet. "]")
            unless $value->alphabet =~/$mol_type/i;
        $self->{'_seq'} = $value;
        return $self;
    }
    return $self->{'_seq'} ;
}
analysis_namedescriptionprevnextTop
sub analysis_name {
    my $self = shift;
    return $self->{'_ANALYSIS_NAME'};
}
analysis_specdescriptionprevnextTop
sub analysis_spec {
    my $self = shift;
    return $self->{'_ANALYSIS_SPEC'};
}
cleardescriptionprevnextTop
sub clear {
	my $self= shift;
	if (defined($self->{'_result'})) {
		delete $self->{'_result'};
		}
	if (defined ($self->{'_parsed'})) {
		delete $self->{'_parsed'};
		}
	return 1;
}
input_specdescriptionprevnextTop
sub input_spec {
    my $self = shift;
    return $self->{'_INPUT_SPEC'};
}
result_specdescriptionprevnextTop
sub result_spec {
    my $self = shift;
    return $self->{'_RESULT_SPEC'};
}
rundescriptionprevnextTop
sub run {
    my ($self, $args) = @_;
    $self->_process_arguments ($args) if $args;

    # check input
$self->throw("Need a sequence object as an input") unless $self->seq; $self->debug(Data::Dumper->Dump([$self],[$self])); # internal run()
$self->_run; return $self;
}
wait_fordescriptionprevnextTop
sub wait_for {
    my ($self, $args) = @_;
    $self->run($args);
}
statusdescriptionprevnextTop
sub status {
    my ($self,$value) = @_;

    if( defined $value) {
        no strict 'refs';
        my $class = ref($self);
        $self->throw("Not a valid status value [$value]\n".
                     "Valid values are ". join(", ", keys %STATUS ))
            unless defined $STATUS{$value};
        $self->{'_status'} = $value;
        use strict;
    }
    return $self->{'_status'} || 'CREATED' ;
}
_process_argumentsdescriptionprevnextTop
sub _process_arguments {
    my ($self, $args) = @_;

    my %spec;
    map {$spec{ $_->{'name'} } = $_ } @{$self->input_spec};

    $self->debug(Data::Dumper->Dump([\%spec, $args],[\%spec, $args]));
    foreach my $key (keys %$args) {
        my $value = $args->{$key};

        $self->throw("Unknown argument [$key]")
            unless $spec{$key};
        $self->$key($value);
    }

    foreach my $key (keys %spec) {
        $self->throw("Mandatory argument [$key] is not set")
            if $spec{$key}{'mandatory'} eq 'true' and not defined $self->$key;
    }
}
_rundescriptionprevnextTop
sub _run {
 shift->throw_not_implemented();
}
General documentation
SEE ALSOTop
Bio::SimpleAnalysisI,
Bio::WebAgent
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
  bioperl-l@bioperl.org                       - General discussion
  http://bio.perl.org/MailList.html           - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via email
or the web:
  bioperl-bugs@bio.perl.org
  http://bugzilla.bioperl.org/
AUTHORSTop
Richard Adams, Richard.Adams@ed.ac.uk,
Heikki Lehvaslaiho, heikki@ebi.ac.uk
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _