Find file
Fetching contributors…
Cannot retrieve contributors at this time
236 lines (177 sloc) 5.44 KB
# BioPerl module for Bio::Pipeline::Argument
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
use Bio::Pipeline::Argument;
my $arg = new Bio::Pipeline::Argument(-dbID => $argument_id,
-rank => $rank,
-value=> $value,
-tag => $tag,
-type => $type);
An encapsulation of the arguments to be passed to each datahandler
method using a tag value system.
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated. - General discussion - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
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.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via email
or the web:
=head1 AUTHOR
The rest of the documentation details each of the object
methods. Internal metho ds are usually preceded with a _
package Bio::Pipeline::Argument;
use vars qw(@ISA);
use strict;
use Bio::Root::Root;
@ISA = qw(Bio::Root::Root);
=head2 new
Title : new
Usage : my $io = Bio::Pipeline::Argument->new($dbid,$tag,$value,$rank,$dhid,$type)
Function: this constructor should only be used in the Input object IO_adaptor or IO objects
generates a new Bio::Pipeline::Argument. It may represent static arguments that
are found in the argument table (tied to datahandlers) or dynamic ones found in the
dynamic_argument table (tied to Inputs)
Returns : L<Bio::Pipeline::Argument>
Args : dbID: the dbID of the argument (optional)
tag : the tag of the argument(optional)
value: the value of the argument(required)
type : the type of the argument(SCALAR(DEFAULT) or ARRAY)
rank : the order of the argument in the method call,
eg. fetch(1,"swissprot");
Argument 1 would have rank 1,
Argument swissprot would have rank 2.
If tag-value is used e.g. fetch(-id=>1, -db=>"swissprot")
rank is probably not needed.
sub new {
my($class,@args) = @_;
my $self = $class->SUPER::new(@args);
my ($dbID,$tag,$value,$rank,$dhID,$type)=$self->_rearrange([qw(DBID
defined $value || $self->throw("Argument needs a value tag.");
$type = $type || 'SCALAR';
$rank = $rank || 1;
$dbID && $self->dbID($dbID);
$tag && $self->tag($tag);
$dhID && $self->dhID($dhID);
return $self;
=head1 Member variable access
These methods let you get at and set the member variables
=head2 dbID
Title : dbID
Function : returns dbID
Example : $data_adaptor->dbID();
Returns : dbid of the data adaptor
Args :
sub dbID {
my ($self,$dbID) = @_;
$self->{'_dbID'} = $dbID;
return $self->{'_dbID'};
=head2 dhID
Title : dhID
Function : returns dhID
Example : $data_adaptor->dhID();
Returns : data handler for dynamic argument
Args :
sub dhID {
my ($self,$dhID) = @_;
$self->{'_dhID'} = $dhID;
return $self->{'_dhID'};
=head2 value
Title : value
Function : returns value
Example : $Argument->value();
Returns : value of the Argument
Args :
sub value{
my ($self,$value) = @_;
$self->{'_value'} = $value;
return $self->{'_value'};
=head2 tag
Title : tag
Function : returns tag
Example : $arg->tag ();
Returns : tag of the Argument
Args :
sub tag {
my ($self,$tag) = @_;
$self->{'_tag'} = $tag;
return $self->{'_tag'};
=head2 type
Title : type
Function : returns type
Example : $arg->type ();
Returns : type of the Argument ('SCALAR' or 'ARRAY')
Args :
sub type{
my ($self,$type) = @_;
$self->throw("Invalid argument type") unless (($type =~/SCALAR/m) || ($type=~/ARRAY/m));
$self->{'_type'} = $type;
return $self->{'_type'};
=head2 rank
Title : rank
Function : returns rank
Example : $argument->rank();
Returns : rank the Argument
Args :
sub rank{
my ($self,$rank) = @_;
if($rank) {
$self->{'_rank'} = $rank;
return $self->{'_rank'};