.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "BP_PANALYSIS 1p"
.TH BP_PANALYSIS 1p 2024-12-01 "perl v5.40.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
panalysis.PLS \- An example/tutorial script how to access analysis tools
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 3
\& # run an analysis with your sequence in a local file
\&   ./panalysis.PLS \-n \*(Aqedit.seqret\*(Aq\-w \-r \e
\&                   sequence_direct_data=@/home/testdata/my.seq
\&
\& See more examples in the text below.
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
A client showing how to use \f(CW\*(C`Bio::Tools::Run::Analysis\*(C'\fR module, a module for
executing and controlling local or remote analysis tools.  It also
calls methods from the \f(CW\*(C`Bio::Tools::Run::AnalysisFactory\*(C'\fR module, a module
providing lists of available analyses.
.PP
Primarily, this client is meant as an example how to use analysis
modules, and also to test them. However, because it has a lot of
options in order to cover as many methods as possible, it can be also
used as a fully functional command-line client for accessing various
analysis tools.
.SS "Defining location and access method"
.IX Subsection "Defining location and access method"
\&\f(CW\*(C`panalysis.PLS\*(C'\fR is independent on the access method to the remote
analyses (the analyses running on a different machines). The method
used to communicate with the analyses is defined by the \f(CW\*(C`\-A\*(C'\fR option,
with the default value \fIsoap\fR. The other possible values (not yet
supported, but coming soon) are \fIcorba\fR and \fIlocal\fR.
.PP
Each access method may have different meaning for parameter \f(CW\*(C`\-l\*(C'\fR
defining a location of services giving access to the analysis
tools. For example, the \fIsoap\fR access expects a URL of a Web Service
in the \f(CW\*(C`\-l\*(C'\fR option, while the \fIcorba\fR access may find here a
stringified Interoperable Object Reference (IOR).
.PP
A default location for the \fIsoap\fR access is
\&\f(CW\*(C`http://www.ebi.ac.uk/soaplab/services\*(C'\fR which represents services
running at European Bioinformatics Institute on top of over hundred
EMBOSS analyses (and on top of few others).
.SS "Available analyses"
.IX Subsection "Available analyses"
\&\f(CW\*(C`panalysis.PLS\*(C'\fR can show a list of available analyses (from the given
location using given access method). The \f(CW\*(C`\-L\*(C'\fR option shows all
analyses, the \f(CW\*(C`\-c\*(C'\fR option lists all available categories (a category
is a group of analyses with similar functionality or processing
similar type of data), and finally the \f(CW\*(C`\-C\*(C'\fR option shows only
analyses available within the given category.
.PP
Note, that all these functions are provided by module
\&\f(CW\*(C`Bio::Tools::Run::AnalysisFactory\*(C'\fR (respectively, by one of its
access-dependent sub-classes). The module has also a \fIfactory\fR method
\&\f(CW\*(C`create_analysis\*(C'\fR which is not used by this script.
.SS Service
.IX Subsection "Service"
A \f(CW\*(C`service\*(C'\fR is a higher level of abstraction of an analysis tool. It
understands a well defined interface (module \f(CW\*(C`Bio::AnalysisI\*(C'\fR, a fact
which allows this script to be independent on the access protocol to
various services.
.PP
The service name must be given by the \f(CW\*(C`\-n\*(C'\fR option. This option can be
omitted only if you invoked just the \f(CW\*(C`factory\*(C'\fR methods (described
above).
.PP
Each service (representing an analysis tool, a program, or an
application) has its description, available by using options \f(CW\*(C`\-a\*(C'\fR
(analysis name, type, etc.), \f(CW\*(C`\-i\*(C'\fR, \f(CW\*(C`\-I\*(C'\fR (specification of analysis
input data, most important are their names), and \f(CW\*(C`\-o\*(C'\fR, \f(CW\*(C`\-O\*(C'\fR (result
names and their types). The option \f(CW\*(C`\-d\*(C'\fR gives the most detailed
description in the XML format.
.PP
The service description is nice but the most important is to use the
service for invoking an underlying analysis tool. For each invocation,
the service creates a \f(CW\*(C`job\*(C'\fR and feeds it with input data. There are
three stages: (a) create a job, (b) run the job, and (c) wait for its
completion. Correspondingly. there are three options: the \f(CW\*(C`\-b\*(C'\fR which
just creates (builds) a job, the \f(CW\*(C`\-x\*(C'\fR which creates a job and
executes it, and finally \f(CW\*(C`\-w\*(C'\fR which creates a job, runs it and blocks
the client until the job is finished. Always only one of these options
is used (so it does not make sense to use more of them, the
\&\f(CW\*(C`panalysis.PLS\*(C'\fR priorities them in the order \f(CW\*(C`\-x\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, and
\&\f(CW\*(C`\-b\*(C'\fR).
.PP
All of these options take input data from the command-line (see next
section about it) and all of them return (internally) an object
representing a job. There are many methods (options) dealing with the
job objects (see one after next section about them).
.PP
Last note in this section: the \f(CW\*(C`\-b\*(C'\fR option is actually optional \- a
job is created even without this option when there are some input data
found on the command-line. You \fIhave\fR to use it, however, if you do
not pass any data to an analysis tool (an example would be the famous
\&\f(CW\*(C`Classic::HelloWorld\*(C'\fR service).
.SS "Input data"
.IX Subsection "Input data"
Input data are given as name/value pairs, put on the command-line with
equal sign between name and value. If the \fIvalue\fR part starts with
an un-escaped character \f(CW\*(C`@\*(C'\fR, it is used as a local file name and the
\&\f(CW\*(C`panalysis.PLS\*(C'\fR reads the file and uses its contents instead. Examples:
.PP
.Vb 2
\&   panalysis.PLS \-n edit.seqret \-w \-r
\&                 sequence_direct_data=\*(Aqtatatctcccc\*(Aq osformat=embl
\&
\&   panalysis.PLS ...
\&               sequence_direct_data=@/my/data/my.seq
.Ve
.PP
The names of input data come from the \f(CW\*(C`input specification\*(C'\fR that can
be shown by the \f(CW\*(C`\-i\*(C'\fR or \f(CW\*(C`\-I\*(C'\fR options. The input specification (when
using option \f(CW\*(C`\-I\*(C'\fR) shows also \- for some inputs \- a list of allowed
values.  The specification, however, does not tell what input data are
mutually exclusive, or what other constrains apply. If there is a
conflict, an error message is produced later (before the job starts).
.PP
Input data are used when any of the options \f(CW\*(C`\-b\*(C'\fR, \f(CW\*(C`\-x\*(C'\fR, or \f(CW\*(C`\-w\*(C'\fR is
present, but option \f(CW\*(C`\-j\*(C'\fR is not present (see next section about this
job option).
.SS Job
.IX Subsection "Job"
Each service (defined by a name given in the \f(CW\*(C`\-n\*(C'\fR option) can be
executed one or more times, with the same, but usually with different
input data. Each execution creates a \fIjob object\fR. Actually, the job
is created even before execution (remember that option \f(CW\*(C`\-b\*(C'\fR builds a
job but does not execute it yet).
.PP
Any job, executed or not, is persistent and can be used again later
from another invocation of the \f(CW\*(C`panalysis.PLS\*(C'\fR script. Unless you
explicitly destroy the job using option \f(CW\*(C`\-z\*(C'\fR.
.PP
A job created by options \f(CW\*(C`\-b\*(C'\fR, \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-w\*(C'\fR (and by input data)
can be accessed in the same \f(CW\*(C`panalysis.PLS\*(C'\fR invocation using various
job-related options, the most important are \f(CW\*(C`\-r\*(C'\fR and \f(CW\*(C`\-R\*(C'\fR for
retrieving results from the finished job.
.PP
However, you can also re-create a job created by a previous
invocation. Assuming that you know the job ID (the \f(CW\*(C`panalysis.PLS\*(C'\fR
prints it always on the standard error when a new job is created), use
option \f(CW\*(C`\-j\*(C'\fR to re-create the job.
.PP
Example:
.PP
.Vb 2
\&   ./panalysis.PLS \-n \*(Aqedit.seqret\*(Aq
\&                 sequence_direct_data=@/home/testdata/my.seq
.Ve
.PP
It prints:
.PP
.Vb 1
\&   JOB ID: edit.seqret/bb494b:ef55e47c99:\-8000
.Ve
.PP
Next invocation (asking to run the job, to wait for its completion and
to show job status) can be:
.PP
.Vb 3
\&   ./panalysis.PLS \-n \*(Aqedit.seqret\*(Aq
\&                 \-j edit.seqret/bb494b:ef55e47c99:\-800
\&                 \-w \-s
.Ve
.PP
And again later another invocation can ask for results:
.PP
.Vb 3
\&   ./panalysis.PLS \-n \*(Aqedit.seqret\*(Aq
\&                 \-j edit.seqret/bb494b:ef55e47c99:\-800
\&                 \-r
.Ve
.PP
Here is a list of all job options (except for results, they are in the
next section):
.IP "Job execution and termination" 4
.IX Item "Job execution and termination"
There are the same options \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-w\*(C'\fR for executing a job and for
executing it and waiting for its completion, as they were described
above. But now, the options act on a job given by the \f(CW\*(C`\-j\*(C'\fR option,
now they do not use any input data from the command-line (the input
data had to be used when the job was created).
.Sp
Additionally, there is a \f(CW\*(C`\-k\*(C'\fR option to kill a running job.
.IP "Job characteristics" 4
.IX Item "Job characteristics"
Other options tell about the job status (\f(CW\*(C`\-s\*(C'\fR, about the job
execution times (\f(CW\*(C`\-t\*(C'\fR and \f(CW\*(C`\-T\*(C'\fR, and about the last available event
what happened with the job (\f(CW\*(C`\-e\*(C'\fR). Note that the event notification is
not yet fully implemented, so this option will change in the future to
reflect more notification capabilities.
.SS Results
.IX Subsection "Results"
Of course, the most important on the analysis tools are their
results. The results are named (in the similar way as the input data)
and they can be retrieved all in one go using option \f(CW\*(C`\-r\*(C'\fR (so you do
not need to know their names actually), or by specifying (all or some)
result names using the \f(CW\*(C`\-R\*(C'\fR option.
.PP
If a result does not exist (either not yet, or the name is wrong) an
undef value is returned (no error message produced).
.PP
Some results are better to save directly into files instead to show
them in the terminal window (this applies to the \fIbinary\fR results,
mostly containing images). The \f(CW\*(C`panalysis.PLS\*(C'\fR helps to deal with
binary results by saving them automatically to local files (actually
it is the module \f(CW\*(C`Bio::Tools::Run::Analysis\*(C'\fR and its submodules
who do help with the binary data).
.PP
So why not to use a traditional shell re-direction to a file? There are
two reasons. First, a job can produce more than one result, so they
would be mixed together. But mainly, because each result can consist
of several parts whose number is not known in advance and which cannot
be mixed together in one file. Again, this is typical for the binary
data returning images \- an invocation can produce many images.
.PP
The \f(CW\*(C`\-r\*(C'\fR option retrieves all available results and treat them as
described by the \f(CW\*(Aq?\*(Aq\fR format below.
.PP
The \f(CW\*(C`\-R\*(C'\fR option has a comma-separated list of result names, each of
the names can be either a simple name (as specified by the \f(CW\*(C`result
specification\*(C'\fR obtainable using the \f(CW\*(C`\-o\*(C'\fR or \f(CW\*(C`\-O\*(C'\fR options), or a
equal-sign-separated name/format construct suggesting what to do with
the result. The possibilities are:
.IP result-name 4
.IX Item "result-name"
It prints given result on the standard output.
.IP result\-name=filename 4
.IX Item "result-name=filename"
It saves the given result into given file.
.IP result\-name=@ 4
.IX Item "result-name=@"
It saves the given result into a file whose name is automatically
invented, and it guarantees that the same name will not be used in
the next invocation.
.IP result=name=@template 4
.IX Item "result=name=@template"
It saves the given result into a file whose name is given by the
\&\f(CW\*(C`template\*(C'\fR. The template can contain several strings which are
substituted before using it as the filename:
.RS 4
.IP "Any '*'" 4
.IX Item "Any '*'"
Will be replaced by a unique number
.ie n .IP "$ANALYSIS or ${ANALYSIS}" 4
.el .IP "\f(CW$ANALYSIS\fR or ${ANALYSIS}" 4
.IX Item "$ANALYSIS or ${ANALYSIS}"
Will be replaced by the current analysis name
.ie n .IP "$RESULT or ${RESULT}" 4
.el .IP "\f(CW$RESULT\fR or ${RESULT}" 4
.IX Item "$RESULT or ${RESULT}"
Will be replaced by the current result name
.Sp
How to tell what to do with results? Each result name
.RE
.RS 4
.Sp
Additionally, a template can be given as an environment variable
\&\f(CW\*(C`RESULT_FILENAME_TEMPLATE\*(C'\fR. Such variable is used for any result
having in its format a simple \f(CW\*(C`?\*(C'\fR or \f(CW\*(C`@\*(C'\fR character.
.RE
.IP result\-name=? 4
.IX Item "result-name=?"
It first decides whether the given result is binary or not. Then, the
binary results are saved into local files whose names are
automatically invented, the other results are sent to the standard
output.
.IP result\-name=?template 4
.IX Item "result-name=?template"
The same as above but the filenames for binary files are deduced from
the given template (using the same rules as described above).
.PP
Examples:
.PP
.Vb 5
\&   \-r
\&   \-R report
\&   \-R report,outseq
\&   \-R Graphics_in_PNG=@
\&   \-R Graphics_in_PNG=@$ANALYSIS\-*\-$RESULT
.Ve
.PP
Note that the result formatting will be enriched in the future by
using existing data type parsers in bioperl.
.SH FEEDBACK
.IX Header "FEEDBACK"
.SS "Mailing Lists"
.IX Subsection "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.
.PP
.Vb 2
\&  bioperl\-l@bioperl.org                  \- General discussion
\&  http://bioperl.org/wiki/Mailing_lists  \- About the mailing lists
.Ve
.SS "Reporting Bugs"
.IX Subsection "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:
.PP
.Vb 1
\&  http://redmine.open\-bio.org/projects/bioperl/
.Ve
.SH AUTHOR
.IX Header "AUTHOR"
Martin Senger (martin.senger@gmail.com)
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (c) 2003, Martin Senger and EMBL-EBI.
All Rights Reserved.
.PP
This script is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
.SH DISCLAIMER
.IX Header "DISCLAIMER"
This software is provided "as is" without warranty of any kind.
.SH "BUGS AND LIMITATIONS"
.IX Header "BUGS AND LIMITATIONS"
None known at the time of writing this.
