Bio::Tools::Run WrapperBase
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::Tools::Run::WrapperBase - A Base object for wrappers around executables
Package variables
No package variables defined.
Included modules
Bio::Root::IO
Bio::Root::RootI
Inherit
Bio::Root::RootI
Synopsis
  # do not use this object directly, it provides the following methods
# for its subclasses
my $errstr = $obj->error_string(); my $exe = $obj->executable(); $obj->save_tempfiles($booleanflag) my $outfile= $obj->outfile_name(); my $tempdir= $obj->tempdir(); # get a temporary dir for executing my $io = $obj->io; # Bio::Root::IO object my $cleanup= $obj->cleanup(); # remove tempfiles $obj->run({-arg1 => $value});
Description
This is a basic module from which to build executable wrapper modules.
It has some basic methods to help when implementing new modules.
Methods
cleanupDescriptionCode
error_stringDescriptionCode
executableDescriptionCode
ioDescriptionCode
no_param_checksDescriptionCode
outfile_nameDescriptionCode
program_dirDescriptionCode
program_nameDescriptionCode
program_pathDescriptionCode
runDescriptionCode
save_tempfilesDescriptionCode
tempdirDescriptionCode
versionDescriptionCode
Methods description
cleanupcode    nextTop
 Title   : cleanup
Usage : $wrapper->cleanup();
Function: Will cleanup the tempdir directory after a PAML run
Returns : none
Args : none
error_stringcodeprevnextTop
 Title   : error_string
Usage : $obj->error_string($newval)
Function: Where the output from the last analysus run is stored.
Returns : value of error_string
Args : newvalue (optional)
executablecodeprevnextTop
 Title   : executable
Usage : my $exe = $factory->executable();
Function: Finds the full path to the executable
Returns : string representing the full path to the exe
Args : [optional] name of executable to set path to
[optional] boolean flag whether or not warn when exe is not found
iocodeprevnextTop
 Title   : io
Usage : $obj->io($newval)
Function: Gets a Bio::Root::IO object
Returns : Bio::Root::IO object
Args : none
no_param_checkscodeprevnextTop
 Title   : no_param_checks
Usage : $obj->no_param_checks($newval)
Function: Boolean flag as to whether or not we should
trust the sanity checks for parameter values
Returns : value of no_param_checks
Args : newvalue (optional)
outfile_namecodeprevnextTop
 Title   : outfile_name
Usage : my $outfile = $wrapper->outfile_name();
Function: Get/Set the name of the output file for this run
(if you wanted to do something special)
Returns : string
Args : [optional] string to set value to
program_dircodeprevnextTop
 Title   : program_dir
Usage : my $dir = $factory->program_dir();
Function: Abstract get method for dir of program. To be implemented
by wrapper.
Returns : string representing program directory
Args : none
program_namecodeprevnextTop
 Title   : program_name
Usage : my $name = $factory->program_name();
Function: Abstract get method for name of program. To be implemented
by wrapper.
Returns : string representing program name
Args : none
program_pathcodeprevnextTop
 Title   : program_path
Usage : my $path = $factory->program_path();
Function: Builds path for executable
Returns : string representing the full path to the exe
Args : none
runcodeprevnextTop
 Title   : run
Usage : $wrapper->run({ARGS HERE});
Function: Support generic running with args passed in
as a hashref
Returns : Depends on the implementation, status OR data
Args : hashref of named arguments
save_tempfilescodeprevnextTop
 Title   : save_tempfiles
Usage : $obj->save_tempfiles($newval)
Function:
Returns : value of save_tempfiles
Args : newvalue (optional)
tempdircodeprevnextTop
 Title   : tempdir
Usage : my $tmpdir = $self->tempdir();
Function: Retrieve a temporary directory name (which is created)
Returns : string which is the name of the temporary directory
Args : none
versioncodeprevnextTop
 Title   : version
Usage : $version = $wrapper->version()
Function: Returns the program version (if available)
Returns : string representing version of the program
Args : [Optional] value to (re)set version string
Methods code
cleanupdescriptionprevnextTop
sub cleanup {
   my ($self) = @_;
   $self->io->_io_cleanup();
   if( defined $self->{'_tmpdir'} &&
       -d $self->{'_tmpdir'} ) {
       $self->io->rmtree($self->{'_tmpdir'});
   }
}
error_stringdescriptionprevnextTop
sub error_string {
   my ($self,$value) = @_;
   if( defined $value) {
      $self->{'_error_string'} = $value;
    }
    return $self->{'_error_string'} || '';
}
executabledescriptionprevnextTop
sub executable {
   my ($self, $exe,$warn) = @_;

   if( defined $exe ) {
     $self->{'_pathtoexe'} = $exe;
   }
   unless( defined $self->{'_pathtoexe'} ) {
       my $prog_path = $self->program_path;
       if( $prog_path && -e $prog_path && -x $prog_path ) {
           $self->{'_pathtoexe'} = $prog_path;
       } else {
           my $exe;
           if( ( $exe = $self->io->exists_exe($self->program_name) ) &&
               -x $exe ) {
               $self->{'_pathtoexe'} = $exe;
           } else {
               $self->warn("Cannot find executable for ".$self->program_name) if $warn;
               $self->{'_pathtoexe'} = undef;
           }
       }
   }
   $self->{'_pathtoexe'};
}
iodescriptionprevnextTop
sub io {
   my ($self) = @_;
   unless( defined $self->{'io'} ) {
       $self->{'io'} = new Bio::Root::IO(-verbose => $self->verbose());
   }
    return $self->{'io'};
}
no_param_checksdescriptionprevnextTop
sub no_param_checks {
   my ($self,$value) = @_;
   if( defined $value || ! defined $self->{'no_param_checks'} ) {
       $value = 0 unless defined $value;
      $self->{'no_param_checks'} = $value;
    }
    return $self->{'no_param_checks'};
}
outfile_namedescriptionprevnextTop
sub outfile_name {
   my ($self,$nm) = @_;
   if( defined $nm || ! defined $self->{'_outfilename'} ) { 
       $nm = 'mlc' unless defined $nm;
       $self->{'_outfilename'} = $nm;
   }
   return $self->{'_outfilename'};
}
program_dirdescriptionprevnextTop
sub program_dir {
    my ($self) = @_;
    $self->throw_not_implemented();
}
program_namedescriptionprevnextTop
sub program_name {
    my ($self) = @_;
    $self->throw_not_implemented();
}


1;
}
program_pathdescriptionprevnextTop
sub program_path {
    my ($self) = @_;
    my @path;
    push @path, $self->program_dir if $self->program_dir;
    push @path, $self->program_name.($^O =~ /mswin/i ?'.exe':'');

    return Bio::Root::IO->catfile(@path);
}
rundescriptionprevnextTop
sub run {
   my ($self,@args) = @_;
   $self->throw_not_implemented();
}
save_tempfilesdescriptionprevnextTop
sub save_tempfiles {
   my ($self,$value) = @_;
   if( defined $value) {
      $self->{'save_tempfiles'} = $value;
    }
    return $self->{'save_tempfiles'};
}
tempdirdescriptionprevnextTop
sub tempdir {
   my ($self) = @_;
   
   unless( $self->{'_tmpdir'} ) {
       $self->{'_tmpdir'} = $self->io->tempdir(CLEANUP => ! $self->save_tempfiles );
   }
   unless( -d $self->{'_tmpdir'} ) { 
       mkdir($self->{'_tmpdir'},0777);
   }
   $self->{'_tmpdir'};
}
versiondescriptionprevnextTop
sub version {
   my ($self,@args) = @_;
   return undef;
}
General documentation
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
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org              - General discussion
http://bioperl.org/MailList.shtml - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
email or the web:
  bioperl-bugs@bioperl.org
http://bioperl.org/bioperl-bugs/
AUTHOR - Jason StajichTop
Email jason@bioperl.org
Describe contact details here
CONTRIBUTORSTop
Additional contributors names and emails here
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _