Bio::T...nalysis(3pm)

๐Ÿ“ฆ
version 1.7.8 ยท 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

๐Ÿ’– Bio::Tools::Run::Analysis(3pm) ๐Ÿ’–

User Contributed Perl Documentation โ€” bestie, we're about to decode this whole module. It's giving "universal remote for analysis tools" energy, and we're obsessed. ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

Bio::Tools::Run::Analysis โ€” Module representing any (remote or local) analysis tool. โœจ

โœจ SYNOPSIS โœจ

Okay bestie, here's the whole vibe. No cap, this is how you run analysis tools.

         # run analysis 'seqret' using a default location and a default
         # access method (which means using a Web Service at EBI)
         use Bio::Tools::Run::Analysis;
         print new Bio::Tools::Run::Analysis (-name => 'edit::seqret')
              ->wait_for ({ sequence_direct_data => 'tatatacgtatacga',
                            osformat => 'embl'
                            })
              ->result ('outseq');

Then run a longer job without waiting for its completion:

         # run a longer job without waiting for its completion
         use Bio::Tools::Run::Analysis;
         my $job = Bio::Tools::Run::Analysis->new(-name => 'edit::seqret')
                        ->run ({ sequence_direct_data => 'tatatacgtatacga',
                                 osformat => 'embl'
                                 });
         # ...and after a while
         $job->result ('outseq');

Get all results in the same invocation (as a hash reference with result names as keys) - let the module decide which results are binary (images in this examples) and save those in file (or files); it also shows how to tell that the module should read input data from a local file first:

         # get all results in the same invocation (as a hash reference
         # with result names as keys) - let the module decide which
         # results are binary (images in this examples) and save those
         # in file (or files); it also shows how to tell that the module
         # should read input data from a local file first
         use Bio::Tools::Run::Analysis;
         my $results =
           Bio::Tools::Run::Analysis->new(-name => 'alignment_multiple::prettyplot')
              ->wait_for ( { msf_direct_data => '@/home/testdata/my.seq' } )
              ->results ('?');
         use Data::Dumper;
         print Dumper ($results);

Get names, types of all inputs and results, get short and detailed (in XML) service description:

         # get names, types of all inputs and results,
         # get short and detailed (in XML) service description
         use Bio::Tools::Run::Analysis;
         my $service = Bio::Tools::Run::Analysis->new(-name => 'edit::seqret');
         my $hash1 = $service->input_spec;
         my $hash2 = $service->result_spec;
         my $hash3 = $service->analysis_spec;
         my $xml = $service->describe;

Get current job status:

         # get current job status
         use Bio::Tools::Run::Analysis;
         print new Bio::Tools::Run::Analysis (-name => 'edit::seqret')
           ->run ( { #...input data...
                   } )
           ->status;

Run a job and print its job ID, keep the job un-destroyed:

         # run a job and print its job ID, keep the job un-destroyed
         use Bio::Tools::Run::Analysis;
         my $job =
           Bio::Tools::Run::Analysis->new(-name => 'edit::seqret',
                                          -destroy_on_exit => 0)
           ->run ( { sequence_direct_data => '@/home/testdata/mzef.seq' } );
         print $job->id . "\n";
         # ...it prints (for example):
         #    edit::seqret/c8ef56:ef535489ac:-7ff4

In another time, on another planet, you may say:

         # ...in another time, on another planet, you may say
         use Bio::Tools::Run::Analysis;
         my $job =
           Bio::Tools::Run::Analysis::Job->new(-name => 'edit::seqret',
                                               -id => 'edit::seqret/c8ef56:ef535489ac:-7ff4');
         print join ("\n",
                   $job->status,
                   'Finished: ' . $job->ended (1),   # (1) means 'formatted'
                   'Elapsed time: ' . $job->elapsed,
                   $job->last_event,
                   $job->result ('outseq')
                   );

Or you may achieve the same keeping module Bio::Tools::Run::Analysis::Job invisible:

         # ...or you may achieve the same keeping module
         # Bio::Tools::Run::Analysis::Job invisible
         use Bio::Tools::Run::Analysis;
         my $job =
           Bio::Tools::Run::Analysis->new(-name => 'edit::seqret')
               ->create_job ('edit::seqret/c8ef56:ef535489ac:-7ff4');
         print join ("\n",
                   $job->status,
                   # ...
                   );

And later you may free this job resources:

         # ...and later you may free this job resources
         $job->remove;

         #
         # --- See DESCRIPTION for using generator 'applmaker.pl':
         #

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

The module represents an access to the local and/or remote analysis tools in a unified way that allows adding new access methods (protocols) seamlessly. It's literally the plug-and-play adapter of your dreams. ๐Ÿ’…

At the moment of writing, there is available a SOAP access to almost all EMBOSS applications, running at the European Bioinformatics Institute. Slay.

The documentation of all "public" methods are to be found in Bio::AnalysisI. A tutorial (and examples how to call almost all public methods) is in the script panalysis.PLS (go to the scripts directory and type perldoc panalysis.PLS). Iconic.

The module Bio::Tools::Run::Analysis uses general approach allowing to set arbitrary input data and to retrieve results by naming them. However, sometimes is more convenient to use a specific module, representing one analysis tool, that already knows about available input and result names. Such analyses-specific Perl modules can be generated by papplmaker.PLS generator. Its features and usage are documented in the generator (go to the scripts directory and type perldoc papplmaker.PLS).

         # this will generate module Seqret.pm
         perl papplmaker.PLS -n edit.seqret -m Seqret

         # ...which can be used with data-specific methods
         use Seqret;
         my $outseq = new Seqret
           ->sequence_direct_data ('@/home/testdata/my.seq')
           ->osformat ('embl')
           ->wait_for
           ->outseq
           ;
         print $outseq;

๐Ÿ—ฃ๏ธ 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

๐Ÿ›Ÿ Support ๐Ÿ›Ÿ

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

๐Ÿ› 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://redmine.open-bio.org/projects/bioperl/

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Martin Senger (martin.senger@gmail.com)

Copyright (c) 2003, Martin Senger and EMBL-EBI. 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 ๐Ÿ”—

๐Ÿ“š APPENDIX ๐Ÿ“š

Here is the rest of the object methods. Internal methods are preceded with an underscore _.

๐Ÿ†• new ๐Ÿ†•

         Usage   : my $tool =
                     Bio::Tools::Run::Analysis->new(-access => 'soap',
                                                    -name => 'edit.seqret',
                                                    ...
                                                    );
         Returns : a new Bio::Tools::Run::Analysis object representing the given tool
         Args    : There may be additional arguments which are specific
                   to the access method (see methods 'new' or '_initialize'
                   of the access-specific implementations (such as module
                   Bio::Tools::Run::Analysis::soap for a SOAP-based access).

                   The recognised and used arguments are:
                     -access
                     -location
                     -name
                     -httpproxy
                     -timeout

It builds, populates and returns a new Bio::Tools::Run::Analysis object. This is how it is seen from the outside. But in fact, it builds, populates and returns a more specific lower-level object, for example Bio::Tools::Run::Analysis::soap object - which one it depends on the -access parameter.

  • -access โ€” It indicates what lower-level module to load. Default is 'soap'. Other (but future) possibilities may be:
-access => 'novella'
-access => 'local'
  • -location โ€” A location of the service. The contents is access-specific (see details in the lower-level implementation modules).

Default is http://www.ebi.ac.uk/soaplab/services ( services running at European Bioinformatics Institute on top of most of EMBOSS analyses, and on few others).

  • -name โ€” A name of an analysis tool, or a name of its higher-level abstraction, possibly including a category where the analysis belong to. There is no default value (which usually means that this parameter is mandatory unless your -location parameter includes also the name (but it is then access-dependent).
  • -destroy_on_exit => '0' โ€” Default value is '1' which means that all Bio::Tools::Run::Analysis::Job objects - when being finalised - will send a request to the remote site to forget the results of these jobs.

If you change it to '0' make sure that you know the job identification - otherwise you will not be able to re-established connection with it (later, when you use your program again). This can be done by calling method id on the job object (such object is returned by any of these methods: create_job, run, wait_for).

  • -httpproxy โ€” In addition to the location parameter, you may need to specify also a location/URL of an HTTP proxy server (if your site requires one). The expected format is http://server:port. There is no default value. It is also an access-specific parameter which may not be used by all access methods.
  • -timeout โ€” For long(er) running jobs the HTTP connection may be time-outed. In order to avoid it (or, vice-versa, to call timeout sooner) you may specify timeout with the number of seconds the connection will be kept alive. Zero means to keep it alive forever. The default value is two minutes.

๐Ÿ”ข VERSION and Revision ๐Ÿ”ข

         Usage   : print $Bio::Tools::Run::Analysis::VERSION;
                   print $Bio::Tools::Run::Analysis::Revision;

๐ŸŒŸ Module Bio::Tools::Run::Analysis::Job

Okay so this one? It's literally the whole ~concept~ of a job โ€” like, one single execution of an analysis tool. A whole little baby run, doing its thing. ๐Ÿ’ซ

Bestie, here's the tea: normally you do not instantiate these objects yourself. They just... appear. They get handed to you by the create_job, run, and wait_for methods of a Bio::Tools::Run::Analysis object. Like a gift. ๐ŸŽ

But โ€” if you ever wanna re-create a job, you're gonna need to know its ID (the id method gives it to you, no gatekeeping ๐Ÿ’…). You can pass that ID straight into the new method, OR you can use create_job on a Bio::Tools::Run::Analysis object with the ID as a parameter. Check SYNOPSIS up above for a whole example, iykyk.

โœจ Reminder bestie: every public method of this module is described in detail in the interface module Bio::AnalysisI and in the tutorial inside the analysis.pl script. Go read those, they ate.

new ๐Ÿ‘‘

Usage   : my $job = Bio::Tools::Run::Analysis::Job->new
                      (-access => 'soap',
                       -name => 'edit.seqret',
                       -id => 'xxxyyy111222333'
                       );
Returns : a re-created object representing a job
Args    : The same arguments as for Bio::Tools::Run::Analysis object:
            -access
            -location
            -name
            -httpproxy
            -timeout
            (and perhaps others)
          Additionally and specifically for this object:
            -id
            -analysis
  • -id โ€” a job ID that you made at some point in the past, and now you're using it to re-create that exact same job. The whole point? Getting access back to that job's results, for example. It's giving "found my old save file" energy. ๐ŸŽฎ
  • -analysis โ€” a Bio::Tools::Run::Analysis object, and its properties (like -access and -location) get used to re-create this job object. Recycling! Sustainable queen. โ™ป๏ธ

๐ŸŒˆ Module Bio::Tools::Run::Analysis::Utils

This one's a lil grab-bag of general utilities. Important distinction tho: these are functions, not methods. So you call them like, for example:

&Bio::Tools::Run::Analysis::Utils::format_time (...);

Yes the ampersand. Yes it's a vibe. Moving on. ๐Ÿ’–


format_time โฐ

Usage   : Bio::Tools::Run::Analysis::Utils::format_time ($time);
Returns : Slightly formatted $time
Args    : $time is number of seconds from the beginning of Epoch

So it returns exactly what localtime returns โ€” which means the return value is different in array context vs scalar context (go peek at localtime if you need the lore).

Now the special cases, listen up ๐Ÿซถ:

  • If $time is -1, it returns 'n/a' in scalar context, or an empty array in array context.
  • If $time is too small to represent the distance from the beginning of the Epoch, it returns it unchanged (same in any context) โ€” which lowkey makes total sense when $time is representing an elapsed time.

And why does this exist? It's used to format times coming back from the various job time methods. That's it. That's the job. ๐Ÿ’…


_load_access_module ๐Ÿ”ง

Usage   : $class->_load_access_module ($access)
Returns : 1 on success, undef on failure
Args    : 'access' should contain the last part of the
          name of a module who does the real implementation

At run-time it does a similar thing to:

require Bio::Tools::Run::Analysis::$access
โš ๏ธ Heads up: it prints an error on STDERR if it can't find and load the module โ€” for example, because of compilation errors in that module. So if you see mystery STDERR noise, that's probably why, bestie. ๐Ÿ˜ญ

_guess_access ๐Ÿ”ฎ

Usage   : Bio::Tools::Run::Analysis::Utils::guess_access ($rh_params)
Returns : string with a guessed access protocol (e.g. 'soap'),
          or undef if the guessing failed
Args    : 'rh_params' is a hash reference containing parameters given
          to the 'new' method.

It makes an expert guess at what kind of access/transport protocol should be used to reach the underlying analysis. The guess is based on the parameters in rh_params. โœจ

But wait โ€” plot twist: remember this method only ever gets called if there was no -access parameter hanging around telling it directly what access method to use. No -access? Then we guess. Detective mode activated. ๐Ÿ•ต๏ธโ™€๏ธ


and that's the whole page bestie, you made it, I'm so proud of you ๐Ÿฅน

This was pulled from the User Contributed Perl Documentation, from perl v5.32.1, dated 2021-08-15. Go forth and run some analyses, you absolute icon. ๐Ÿ‘‘ ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from