| Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
| WebCvs |
use Bio::Tools::Run::Analysis;
my $tool = Bio::Tools::Run::Analysis->new(-access => 'soap',
-name => 'seqret');
| BEGIN | Code | |
| _initialize | Description | Code |
| _prepare_inputs | No description | Code |
| analysis_name | No description | Code |
| analysis_spec | No description | Code |
| describe | No description | Code |
| input_spec | No description | Code |
| result_spec | No description | Code |
| create_job | No description | Code |
| run | No description | Code |
| wait_for | No description | Code |
| _process_results | No description | Code |
| is_binary | Description | Code |
| _clean_msg | No description | Code |
| _initialize | code | next | Top |
Usage : my $tool = Bio::Tools::Run::Analysis->new(-access => 'soap',It populates calling object with the given arguments, and then - for some attributes and only if they are not yet populated - it assigns some default values. This is an actual new() method (except for the real object creation and its blessing which is done in the parent class Bio::Root::Root in method _create_object). Note that this method is called always as an object method (never as a class method) - and that the object who calls this method may already be partly initiated (from Bio::Tools::Run::Analysis::new method); so if you need to do some tricks with the 'class invocation' you need to change Bio::Analysis new method, not this one. -location A URL (also called an endpoint) defining where is located a Web Servicerepresenting this analysis tool. Default is http://www.ebi.ac.uk/soaplab/services (services running at European Bioinformatics Institute on top of most of EMBOSS analyses, and few others). For example, if you run your own Web Service using Java(TM) Apache Axis toolkit, the location might be something like http://localhost:8080/axis/services. -name A name of a Web Service (also called a urn or a namespace).There is no default value (which usually means that this parameter is mandatory unless your -location parameter includes also a Web Service name). -destroy_on_exit => '0' Default value is '1' which means that all Bio::Tools::Run::Analysis::Jobobjects - when being finalised - will send a request to the remote Web Service 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 script 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 needto 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. -timeout For long(er) running jobs the HTTP connection may be time-outed. Inorder 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. |
| is_binary | code | prev | next | Top |
Usage : if ($service->is_binary ('graph_result')) { ... } |
| BEGIN | Top |
$Revision = q[$Id$]; # where to go}
$DEFAULT_LOCATION = 'http://www.ebi.ac.uk/soaplab/services';
| _initialize | description | prev | next | Top |
my ($self, @args) = @_; # make a hashtable from @args}
my %param = @args; @param { map { lc $_ } keys %param } = values %param; # lowercase keys
# copy all @args into this object (overwriting what may already be
# there) - changing '-key' into '_key'
my $new_key; foreach my $key (keys %param) { ($new_key = $key) =~ s/^-/_/; $self->{ $new_key } = $param { $key }; } # finally add default values for those keys who have default value
# and who are not yet in the object
$self->{'_location'} = $DEFAULT_LOCATION unless $self->{'_location'}; # create a SOAP::Lite object, the main worker
if (defined $self->{'_httpproxy'}) { $self->{'_soap'} = SOAP::Lite -> proxy ($self->{'_location'}, timeout => (defined $self->{'_timeout'} ? $self->{'_timeout'} : 120), proxy => ['http' => $self->{'_httpproxy'}]); } else { $self->{'_soap'} = SOAP::Lite -> proxy ($self->{'_location'}, timeout => (defined $self->{'_timeout'} ? $self->{'_timeout'} : 120), ); } $self->{'_soap'}->uri ($self->{'_name'}) if $self->{'_name'}; # forget cached things which should not be cloned into new
# instances (because they may represent a completely different
# analysis
delete $self->{'_analysis_spec'}; delete $self->{'_input_spec'}; delete $self->{'_result_spec'}; } #
# Create a hash with named inputs, all extracted
# from the given data.
#
# The main job is done in the SUPER class - here we do
# only the SOAP-specific stuff.
#
| _prepare_inputs | description | prev | next | Top |
my $self = shift; my $rh_inputs = $self->SUPER::_prepare_inputs (@_); foreach my $name (keys %{$rh_inputs}) { my $value = $$rh_inputs{$name}; # value of type ref ARRAY is send as byte[][]}
if (ref $value eq 'ARRAY') { my @bytes = map { SOAP::Data->new (type => 'base64', value => $_) } @$value; $$rh_inputs{$name} =\@ bytes; next; } } return $rh_inputs; } # ---------------------------------------------------------------------
#
# Here are the methods implementing Bio::AnalysisI interface
# (documentation is in Bio::AnalysisI)
#
# ---------------------------------------------------------------------
| analysis_name | description | prev | next | Top |
my $self = shift; ${ $self->analysis_spec }{'name'}; } # Map getAnalysisType()}
| analysis_spec | description | prev | next | Top |
my ($self) = @_; return $self->{'_analysis_spec'} if $self->{'_analysis_spec'}; my $soap = $self->{'_soap'}; $self->{'_analysis_spec'} = $soap->getAnalysisType->result; } # String describe()}
| describe | description | prev | next | Top |
my ($self) = @_; my $soap = $self->{'_soap'}; $soap->describe->result; } # Map[] getInputSpec()}
| input_spec | description | prev | next | Top |
my ($self) = @_; return $self->{'_input_spec'} if $self->{'_input_spec'}; my $soap = $self->{'_soap'}; $self->{'_input_spec'} = $soap->getInputSpec->result; } # Map[] getResultSpec()}
| result_spec | description | prev | next | Top |
my ($self) = @_; return $self->{'_result_spec'} if $self->{'_result_spec'}; my $soap = $self->{'_soap'}; $self->{'_result_spec'} = $soap->getResultSpec->result; } # String createJob (Map inputs)}
# String createJob (String id)
# String createJob ()
| create_job | description | prev | next | Top |
my ($self, $params) = @_; my $job_id; my $force_to_live; # if $params is a reference then it contains *all* input data}
# (see details in '_prepare_inputs' how they can be coded) -
# send it to the server to get a unique job ID
if (ref $params) { my $rh_inputs = $self->_prepare_inputs ($params); my $soap = $self->{'_soap'}; $job_id = $soap->createJob (SOAP::Data->type (map => $rh_inputs))->result; # if $params is a defined scalar it represents a job ID obtained in
# some previous invocation - such job already exists on the server
# side, just re-create it here using the same job ID
# (in this case, such job will *not* be implicitly destroyed on exit)
} elsif (defined $params) { $job_id = $params; $force_to_live = 1; # finally, if $params is undef, ask server to create an empty job
# (and give me its unique job ID), the input data may be added
# later using 'set_data' method(s) - see scripts/applmaker.pl
} else { my $soap = $self->{'_soap'}; $job_id = $soap->createEmptyJob->result; # this method may not exist on server (TBD)
} if ($force_to_live) { return new Bio::Tools::Run::Analysis::Job (-analysis => $self, -id => $job_id, -destroy_on_exit => 0, ); } elsif (defined $self->{'_destroy_on_exit'}) { return new Bio::Tools::Run::Analysis::Job (-analysis => $self, -id => $job_id, -destroy_on_exit => $self->{'_destroy_on_exit'}, ); } else { return new Bio::Tools::Run::Analysis::Job (-analysis => $self, -id => $job_id, ); } } # String createAndRun (Map inputs)
| run | description | prev | next | Top |
my $self = shift; return $self->create_job (@_)->run; } # Map runAndWaitFor (Map inputs)}
| wait_for | description | prev | next | Top |
my $self = shift; return $self->run (@_)->wait_for; } # ---------------------------------------------------------------------}
#
# Here are internal methods fo Bio::Tools::Run::Analysis::soap...
#
# ---------------------------------------------------------------------
# Do something (or nothing) with $rh_resuls (coming from the server)
# depending on rules defined in $rh_rules.
#
# $rh_results: keys are result names, values are results themselves
# (either scalars or array references - if one result is split into
# more parts).
#
# $rh_rules: keys are result names, values say what to do with
# results: undef ... do nothing, return unchanged result
# - ... send it to STDOUT, return nothing
# @[template] ... put it into file (invent its name,
# perhaps based on template), return filename
# ?[template] ... ask server for result type, then decide:
# put a binary result into file (invent its name)
# and return the filename, for other result type
# do nothing and return result unchanged
# Special cases: if $rh_rules is scalar '@[template]', do with ALL results
# as described above for @[template], or
# if $rh_rules is scalar '?[template]', do with ALL results
# as described above for ?[template].
| _process_results | description | prev | next | Top |
my ($self, $rh_results, $rh_rules) = @_; my $default_rule = $rh_rules if defined $rh_rules && $rh_rules =~ /^[\?@]/; foreach my $name (keys %$rh_results) { my $rule = $default_rule ? $default_rule : $$rh_rules{$name}; next unless $rule; next if $rule =~ /^\?/ && ! $self->is_binary ($name); my ($prefix, $template) = $rule =~ /^([\?@])(.*)/; $template = $ENV{'RESULT_FILENAME_TEMPLATE'} unless $template; my $filename = $rule unless $template || $prefix; my $stdout = ($rule eq '-'); if (ref $$rh_results{$name}) { # --- result value is an array reference}
my $seq = 1; foreach my $part (@{ $$rh_results{$name} }) { print STDOUT $part && next if $stdout; $part = $self->_save_result (-value => $part, -name => $name, -filename => $filename, -template => $template, -seq => $seq++); } } else { # --- result value is a scalar
print STDOUT $$rh_results{$name} && next if $stdout; $$rh_results{$name} = $self->_save_result (-value => $$rh_results{$name}, -name => $name, -filename => $filename, -template => $template); } delete $$rh_results{$name} if $stdout; } $rh_results; } # ---------------------------------------------------------------------
#
# is the given result $name binary?
#
| is_binary | description | prev | next | Top |
my ($self, $name) = @_; foreach my $result (@{ $self->result_spec }) { if ($result->{'name'} eq $name) { return ($result->{'type'} =~ /^byte\[/); } } return 0; } # ---------------------------------------------------------------------}
#
# Here are internal subroutines (NOT methods)
# for Bio::Tools::Run::Analysis::soap
#
# ---------------------------------------------------------------------
| _clean_msg | description | prev | next | Top |
my ($msg) = @_; $msg =~ s/^org\.embl\.ebi\.SoaplabShare\.SoaplabException\:\s*//; $msg; } # ---------------------------------------------------------------------}
#
# Here is the rest of Bio::Analysis::soap
#
# ---------------------------------------------------------------------
| FEEDBACK | Top |
| Mailing Lists | Top |
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
| Support | Top |
| Reporting Bugs | Top |
http://redmine.open-bio.org/projects/bioperl/
| AUTHOR | Top |
| COPYRIGHT | Top |
| DISCLAIMER | Top |
| SEE ALSO | Top |
| BUGS AND LIMITATIONS | Top |
| APPENDIX | Top |
| VERSION and Revision | Top |
Usage : print $Bio::Tools::Run::Analysis::soap::VERSION;
print $Bio::Tools::Run::Analysis::soap::Revision;
| Defaults | Top |
Usage : print $Bio::Tools::Run::Analysis::soap::DEFAULT_LOCATION;