NAME
Bio::Polloc::RuleI - Generic rules interface
DESCRIPTION
Use this interface to initialize the Bio::Polloc::Rule::* objects. Any rule inherits from this Interface. Usually, rules are initialized in sets (via the Bio::Polloc::RuleIO package).
AUTHOR - Luis M. Rodriguez-R
Email lmrodriguezr at gmail dot com
IMPLEMENTS OR EXTENDS
APPENDIX
Methods provided by the package
new
Attempts to initialize a Bio::Polloc::Rule::*
object
Arguments
- -type
-
The type of rule
- -value
-
The value of the rule (depends on the type of rule)
- -context
-
The context of the rule. See Bio::Polloc::RuleI-context()>.
Returns
The Bio::Polloc::Rule::*
object
Throws
Bio::Polloc::Polloc::Error if unable to initialize the proper object
type
Gets/sets the type of rule
Arguments
Value (str). Can be: pattern, profile, repeat, tandemrepeat, similarity, coding, boolean, composition, crispr. See the corresponding Bio::Polloc::Rule::*
objects for further details.
Some variations can be introduced, like case variations or short versions like patt or rep.
Return
Value (str). The type of the rule, or undef
if undefined. The value returned is undef or a string from the above list, regardless of the input variations.
Throws
Bio::Polloc::Polloc::Error if an unsupported type is received.
context
The context is a reference to an array of two elements (int or str), the first being: 1 => with respect to the start of the sequence 0 => somewhere within the sequence (ignores the second) -1 => with respect to the end of the sequence
And the second being the number of residues from the reference point. The second value can be positive, negative, or zero.
Purpose
Gets/sets the context of the rule
Arguments
Three integers, or one integer equal to zero. Please note that this function is extremely tolerant, and tries to guess the context regardless of the input.
Returns
A reference to the array described above.
value
Gets/sets the value of the rule
Arguments
Value (mix)
Returns
Value (mix)
Note
This function relies on _qualify_value()
Throws
Bio::Polloc::Polloc:Error if unsupported value is received
executable
Sets/gets the executable property. A rule can be executed even if this property is false, if the Bio::Polloc::RuleI::execute method is called directly ($rule-
execute>) or by other rule. This property is provided only for Bio::Polloc::RuleIO objects.
Arguments
Boolean (0 or 1; optional)
Returns
1 if expicilty executable, 0 otherwise
Note
It is advisable to have only few (ideally one) executable rules, handling all the others with the rule type operation
name
Sets/gets the name of the rule
Arguments
Name (str), the name to set
Returns
The name (str or undef)
id
Sets/gets the ID of the rule
Purpose
Provide a somewhat unique but human-readable identifier
Arguments
The supposedly unique ID of the rule (str), any dot (.) will be changed to _
Returns
The ID (str or undef)
restart_index
stringify
Purpose
To provide an easy method for the (str) description of any Bio::Polloc::RuleI object.
Returns
The stringified object (str, off course)
stringify_value
Dummy function to be overriten if non-string value like in Bio::Polloc::Rule::repeat
Returns
The value as string
ruleset
Gets/sets the parent ruleset of the rule
Arguments
The ruleset to set (a Bio::Polloc::RuleIO object).
Returns
A Bio::Polloc::RuleIO object or undef
execute
Purpose
To evaluate the rule in a given sequence.
Arguments
A Bio::Seq object
Returns
An array of Bio::Polloc::LocusI objects
Throws
A Bio::Polloc::Polloc::NotImplementedException if not implemented
safe_value
Sets/gets a parameter of arbitrary name and value
Purpose
To provide a safe interface for setting values from the parsed file
Arguments
Returns
The value of the parameter or undef
source
Sets/gets the source of the annotation
Arguments
The source (str)
Returns
The source (str or undef)
INTERNAL METHODS
Methods intended to be used only witin the scope of Bio::Polloc::*
_qualify_type
_parameters
Returns the supported parameters for value().
Returns
The supported value keys (arrayref
).
_qualify_value
Takes the different possible values and returns them the way they must be saved (usually a hashref). Bio::Polloc::Rule::* modules must reimplement either _qualify_value() or _parameters().
_qualify_value_default
_executable
Attempts to find the executable
Arguments
An alternative path to search at str.
_initialize
_search_value
Arguments
The key (str)
Returns
The value (mix) or undef
_next_child_id
Gets the ID for the next child.
Purpose
Provide support for children identification
Returns
The ID (str) or undef if the ID of the current Rule is not set.