Bio::Tools::Run::PiseJob.3pm

Langue: en

Autres versions - même langue

Version: 2008-11-10 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Bio::Tools::Run::PiseJob - A class to manage Pise jobs.

SYNOPSIS

   use Bio::Tools::Run::AnalysisFactory::Pise;
 
   # Build a Pise factory       
   my $factory = new Bio::Tools::Run::AnalysisFactory::Pise();
 
   # Then create an application object (Pise::Run::Tools::PiseApplication):
   my $program = $factory->program('genscan');
 
   # Set parameters
   $program->seq($ARGV[0]);
 
   # Next, run the program
   # (notice that you can set some parameters at run time)
   my $job = $program->run(-parameter_file => "Arabidopsis.smat");
 
   my $job = $program->run(-seq => $ARGV[0]);
 
   # Test for submission errors:
   if ($job->error) {
      print "Job submission error (",$job->jobid,"):\n";
      print $job->error_message,"\n";
      exit;
   }
 
   # Get results
   print STDERR $job->content('genscan.out');
   # or:
   my $result_file = $job->save('genscan.out');
 
 

DESCRIPTION

Bio::Tools::Run::PiseJob class handles a specific job state and results. A Bio::Tools::Run::PiseJob instance should be created by a subclass of Bio::Tools::Run::PiseApplication class, e.g Bio::Tools::Run::PiseApplication::genscan or Bio::Tools::Run::PiseApplication::dnapars, ... (see Bio::Tools::Run::PiseApplication class) :
   my $job = Bio::Tools::Run::PiseJob->new($self, $self->{VERBOSE});
 
 

This class may also be used as a mean to get informations about a running job, or to get results after a long computation:

   my $job = Bio::Factory::Pise->job($url);
   print $job->content('infile.aln');
 
 

Once the job is created, you can get results:

   foreach my $result ($job->get_results) {
     print $job->content($result);
     $job->save($result, "myfile"); # $job->save($result) keeps the name
     print $job->stdout;            # print job standard output
     print $job->stderr;            # print job standard error
   }
 
 

You can feed a result file as a filehandle to a bioperl parser :

   my $parser = Bio::Tools:Genscan->new (-fh => $job->fh('genscan.out'));
   my $parser = Bio::Tools:BPlite->new (-fh => $job->fh('blast2.txt'));
 
 

... or to another pise job:

   my $neighbor = $factory->program ('neighbor',
                                     -infile => $job->fh('outfile'));
 
 

You can lookup up for a type of result that could be piped to another Pise program:

   my $matrix = $job->lookup_piped_file('phylip_dist');
 
 

returns the url of the just calculated Phylip distances matrix file, produced by e.g DNADIST or PROTDIST.

All the available pipe types may be obtained by:

     $job->lookup_piped_files;
 
 

FEEDBACK

Mailing Lists

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/wiki/Mailing_lists  - About the mailing lists
 
 

Reporting Bugs

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 the web:
   http://bugzilla.open-bio.org/
 
 

AUTHOR

Catherine Letondal (letondal@pasteur.fr) Copyright (C) 2003 Institut Pasteur & Catherine Letondal. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER

This software is provided ``as is'' without warranty of any kind.

SEE ALSO

Bio::Tools::Run::AnalysisFactory::Pise Bio::Tools::Run::PiseApplication

new

  Title   : new()
  Usage   : $job = Bio::Tools::Run::PiseJob->new($application, $verbose);
  Function: Creates a Bio::Tools::Run::PiseJob object. 
            This is normally called by an application object
            - i.e a subclass of the Bio::Tools::Run::PiseApplication class, 
            for submitting a job. 
            This method actually submit the job and parse results.
  Example :
  Returns : An instance of Bio::Tools::Run::PiseJob.
 
 

verbose

  Title   : verbose()
  Usage   : $program->verbose(1);
  Function: Ask the object to tells more.
  Example :
  Returns :
 
 

job

  Title   : job()
  Usage   : $job = Bio::Tools::Run::PiseJob->job(url);
  Function: Creates a Bio::Tools::Run::PiseJob object from an already 
            run job by giving the url of the job result page.
            May also be called through Bio::Factory::Pise->job(url);
  Example :
  Returns : An instance of Bio::Tools::Run::PiseJob.
 
 

jobid

  Title   : jobid()
  Usage   : $job->jobid();
  Function: Returns the url of the job result page.
  Example :
  Returns :
 
 

error

  Title   : error()
  Usage   : $job->error();
  Function: Tells if the job has been successfully run. This is the case 
            when the job has been submitted, but the Pise server has 
            detected user errors (missing mandatory parameter, unallowed 
            value,...). This also happen when the user provided an
            invalid url, or the http request could not be submitted.
            See method error_message().
 
  Example :
  Returns : TRUE/FALSE
 
 

error_message

  Title   : error_message()
  Usage   : $job->error_message();
  Function: Returns the error message.
  Example :
  Returns : A string.
 
 

get_results

  Title   : get_results()
  Usage   : $job->get_results();
  Function: Provides the urls of the result files.
  Example :
  Returns : A list of urls.
 
 

get_pipes

  Title   : get_pipes()
  Usage   : $job->get_pipes($result);
  Function: Provides the names of the programs that can use this type of
            result. $result is an url, that can be provided through the
            get_results method.
  Example :
  Returns : A list of program names.
 
 

piped_file_type

  Title   : piped_file_type()
  Usage   : $job->piped_file_type($result);
  Function: Provides the Pise type of $result. $result is an url, 
            that can be provided through the get_results method.
  Example :
  Returns : A Pise pipetype name.
 
 

lookup_piped_files

  Title   : lookup_piped_files()
  Usage   : $pipe_types = $job->lookup_piped_files();
  Function: Returns the pipe types produced by the job
            (e.g:  phylip_tree, seqsfile, readseq_ok_alig, ...). 
            You have to call lookup_piped_file($type) to get the actual
            correponding result file.
  Example :
  Returns : A string.
 
 

lookup_piped_file

  Title   : lookup_piped_file(type)
  Usage   : $result = $job->lookup_piped_file($type);
  Function: Returns the name of the result file of pipe type $type 
            (e.g:  phylip_tree, seqsfile, readseq_ok_alig, ...). $result 
            is an url.
  Example :
  Returns : A string (an url).
 
 

terminated

  Title   : terminated()
  Usage   : $job->terminated();
  Function: Tells whether the job has terminated.
  Example :
  Returns : TRUE/FALSE.
 
 

save

  Title   : save()
  Usage   : $filename = $job->save($result);
            $filename = $job->save($result, $name);
  Function: Save the result in a file. $result is an url, 
            that can be provided through the get_results method. You can
            provide your own filename. By default, the file name will be
            the same as the result name.
  Example :
  Returns : A file name.
 
 

content

  Title   : content()
  Usage   : $s = $job->content($result);
  Function: Provides the content of $result. $result is an url, 
            that can be provided through the get_results method. 
            By default, $result is the standard output.
  Example :
  Returns : A string.
 
 

stdout

  Title   : stdout()
  Usage   : print $job->stdout();
  Function: Provides the content of the job standard output. 
  Example :
  Returns : A string.
 
 

stderr

  Title   : stderr()
  Usage   : print $job->stderr();
  Function: Provides the content of the job standard error. 
  Example :
  Returns : A string.
 
 

fh

  Title   : fh()
  Usage   : $fh = $job->fh($result);
  Function: Provides a filhandle for a result.
            $result is an url, that can be provided through the 
            get_results method. 
 
            Be aware that you must re-ask for it for a subsequent use. For
            instance, if you first use it for an input parameter:
              my $program = Pise::program->new ( ...,
                                               file => $previous_job->fh('..'),
                                               );
              my $job = $program->run;
 
            A subsequent run of the same object: will need a re-initialization:
              $program->file($previous_job->fh('..'));
              my $job2 = $program->run;
 
  Example :
  Returns : A filehandle.
 
 

results_type

  Title   : results_type()
  Usage   : $job->results_type($type);
  Function: Enables to change result delivery from one email per file
            to url notification or attached files. $type is either: url, 
            attachment, email. 
  Example :
  Returns : 1 if success, 0 if job already terminated.
 
 

value

  Title   : value(param)
  Usage   : $job->value(param);
  Function: 
  Example :
  Returns : value of parameter param, if available.
 
 

_init

  Title   : _init()
  Usage   : $self->_init;
  Function: Internal. Initializes parameters. Called by new.
  Example :
  Returns :
 
 

_submit

  Title   : _submit()
  Usage   : $self->_submit();
  Function: Internal. Sends the http request on a Pise server. Called by new.
  Example :
  Returns : -1 if an error has occured
            jobid else
  Exceptions: when the job has already been submitted.
 
 

_parse

  Title   : _parse()
  Usage   : $self->_parse();
  Function: Internal. Parses Pise XHTML results page and fills data structures.
            Called by frmoUrl or by _submit.
  Example :
  Returns :
 
 

READLINE

  Title   : READLINE()
  Usage   : 
  Function: Internal - see perltie.
  Example :
  Returns : A string.
 
 

TIEHANDLE

  Title   : TIEHANDLE()
  Usage   : 
  Function: Internal - see perltie.
  Example :
  Returns :
 
 

CLOSE()

  Title   : CLOSE()
  Usage   : 
  Function: Internal - see perltie.
  Example :
  Returns :
 
 

_clean_content

  Title   : _clean_content()
  Usage   : my $content = $self->_clean_content($content);
  Function: Internal. Useful to call before XML parsing.
  Example :
  Returns :