ensembl-hive  2.1
 All Classes Namespaces Files Functions Pages
Bio::EnsEMBL::Hive::Params Class Reference
+ Inheritance diagram for Bio::EnsEMBL::Hive::Params:

Public Member Functions

public new ()
 
public param_init ()
 
protected _param_possibly_overridden ()
 
protected _param_silent ()
 
public Any param_required ()
 
public Boolean param_exists ()
 
public Boolean param_is_defined ()
 
public Any param ()
 
public param_substitute ()
 
public mysql_conn ()
 
public mysql_dbname ()
 
public csvq ()
 
protected _subst_one_hashpair ()
 

Detailed Description

Synopsis

By inheriting from this module you make your module able to deal with parameters:
1) parsing of parameters in the order of precedence, starting with the lowest:
#
## general usage:
# $self->param_init( $lowest_precedence_hashref, $middle_precedence_hashref, $highest_precedence_hashref );
#
## typical usage:
# $job->param_init(
# $runObj->param_defaults(), # module-wide built-in defaults have the lowest precedence (will always be the same for this module)
# $self->db->get_PipelineWideParametersAdaptor->fetch_param_hash(), # then come the pipeline-wide parameters from the 'meta' table (define things common to all modules in this pipeline)
# $self->analysis->parameters(), # analysis-wide 'parameters' are even more specific (can be defined differently for several occurence of the same module)
# $job->input_id(), # job-specific 'input_id' parameters have the highest precedence
# );
2) reading a parameter's value
#
# my $source = $self->param('source'); )
3) dynamically setting a parameter's value
#
# $self->param('binpath', '/software/ensembl/compara');
#
Note: It proved to be a convenient mechanism to exchange params
between fetch_input(), run(), write_output() and other methods.

Description

    Most of Compara RunnableDB methods work under assumption
    that both analysis.parameters and job.input_id fields contain a Perl-style parameter hashref as a string.

    This module implements a generic param() method that allows to set parameters according to the following parameter precedence rules:

        (1) Job-Specific parameters defined in job.input_id hash, they have the highest priority and override everything else.

        (2) Analysis-Wide parameters defined in analysis.parameters hash. Can be overridden by (1).

        (3) Pipeline-Wide parameters defined in the 'meta' table. Can be overridden by (1) and (2).

        (4) Module_Defaults that are hard-coded into modules have the lowest precedence. Can be overridden by (1), (2) and (3).

Member Function Documentation

protected Bio::EnsEMBL::Hive::Params::_param_possibly_overridden ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Hive::Params::_param_silent ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::Hive::Params::_subst_one_hashpair ( )
    
    Description: this is a private method that performs one substitution. Called by param_substitute().
 
Code:
click to view
public Bio::EnsEMBL::Hive::Params::csvq ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Hive::Params::mysql_conn ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Hive::Params::mysql_dbname ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Hive::Params::new ( )
    Description: a trivial constructor, mostly for testing a Params object
 
Code:
click to view
public Any Bio::EnsEMBL::Hive::Params::param ( )
    Arg [1]    : string $param_name
    Arg [2]    : (optional) $param_value
    Description: A getter/setter method for a job's parameters that are initialized through 4 levels of precedence (see param_init() )
    Example 1  : my $source = $self->param('source'); # acting as a getter
    Example 2  : $self->param('binpath', '/software/ensembl/compara');  # acting as a setter
    Returntype : any Perl structure or object that you dared to store
 
Code:
click to view
public Boolean Bio::EnsEMBL::Hive::Params::param_exists ( )
    Arg [1]    : string $param_name
    Description: A predicate tester for whether the parameter has been initialized (even to undef)
    Example    :
if( $self->param_exists('source') ) { print "'source' exists\n"; } else { print "never heard of 'source'\n"; }
    Returntype : boolean
 
Code:
click to view
public Bio::EnsEMBL::Hive::Params::param_init ( )
    Description: First parses the parameters from all sources in the reverse precedence order (supply the lowest precedence hash first),
                 then preforms "total" parameter substitution.
                 Will fail on detecting a substitution loop.
 
Code:
click to view
public Boolean Bio::EnsEMBL::Hive::Params::param_is_defined ( )
    Arg [1]    : string $param_name
    Description: A predicate tester for definedness of a parameter
    Example    :
if( $self->param_is_defined('source') ) { print "defined, possibly zero"; } else { print "undefined"; }
    Returntype : boolean
 
Code:
click to view
public Any Bio::EnsEMBL::Hive::Params::param_required ( )
    Arg [1]    : string $param_name
    Description: A strict getter method for a job's parameter; will die if the parameter was not set or is undefined
    Example    :
my $source = $self->param_required('source');
    Returntype : any Perl structure or object that you dared to store
 
Code:
click to view
public Bio::EnsEMBL::Hive::Params::param_substitute ( )
    Arg [1]    : Perl structure $string_with_templates
    Description: Performs parameter substitution on strings that contain templates like " #param_name# followed by #another_param_name# " .
    Returntype : *another* Perl structure with matching topology (may be more complex as a result of substituting a substructure for a term)
 
Code:
click to view

The documentation for this class was generated from the following file: