| 1 | # | ||
| 2 | # BioPerl module for wrapping runtime parameters | ||
| 3 | # | ||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 5 | # | ||
| 6 | # Cared for by Chad Matsalla (bioinformatics1 at dieselwurks dot com) | ||
| 7 | # | ||
| 8 | # Copyright Chad Matsalla | ||
| 9 | # | ||
| 10 | # You may distribute this module under the same terms as perl itself | ||
| 11 | |||
| 12 | # POD documentation - main docs before the code | ||
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | FAST::Bio::Tools::Run::GenericParameters - An object for the parameters used to run programs | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | my $void = $obj->set_parameter("parameter_name","parameter_value"); | ||
| 21 | my $value = $obj->get_parameter("parameter_name"); | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | This is a basic container to hold the parameters used to run a | ||
| 26 | program. This module may get incorporated into the more generic | ||
| 27 | FAST::Bio::Tools::Run framework in bioperl-run distribution. | ||
| 28 | |||
| 29 | =head1 FEEDBACK | ||
| 30 | |||
| 31 | =head2 Mailing Lists | ||
| 32 | |||
| 33 | User feedback is an integral part of the evolution of this and other | ||
| 34 | Bioperl modules. Send your comments and suggestions preferably to | ||
| 35 | the Bioperl mailing list. Your participation is much appreciated. | ||
| 36 | |||
| 37 | bioperl-l@bioperl.org - General discussion | ||
| 38 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 39 | |||
| 40 | =head2 Support | ||
| 41 | |||
| 42 | Please direct usage questions or support issues to the mailing list: | ||
| 43 | |||
| 44 | I<bioperl-l@bioperl.org> | ||
| 45 | |||
| 46 | rather than to the module maintainer directly. Many experienced and | ||
| 47 | reponsive experts will be able look at the problem and quickly | ||
| 48 | address it. Please include a thorough description of the problem | ||
| 49 | with code and data examples if at all possible. | ||
| 50 | |||
| 51 | =head2 Reporting Bugs | ||
| 52 | |||
| 53 | Report bugs to the Bioperl bug tracking system to help us keep track | ||
| 54 | of the bugs and their resolution. Bug reports can be submitted via the | ||
| 55 | web: | ||
| 56 | |||
| 57 | https://redmine.open-bio.org/projects/bioperl/ | ||
| 58 | |||
| 59 | =head1 AUTHOR - Chad Matsalla | ||
| 60 | |||
| 61 | Email bioinformatics1 at dieselwurks dot com | ||
| 62 | |||
| 63 | =head1 CONTRIBUTORS | ||
| 64 | |||
| 65 | Sendu Bala, bix@sendu.me.uk | ||
| 66 | |||
| 67 | =head1 APPENDIX | ||
| 68 | |||
| 69 | The rest of the documentation details each of the object methods. | ||
| 70 | Internal methods are usually preceded with a _ | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | # Let the code begin... | ||
| 75 | |||
| 76 | package FAST::Bio::Tools::Run::GenericParameters; | ||
| 77 | use strict; | ||
| 78 | |||
| 79 | use base qw(FAST::Bio::Root::Root FAST::Bio::Tools::Run::ParametersI); | ||
| 80 | |||
| 81 | sub new { | ||
| 82 | my ($class, @args) = @_; | ||
| 83 | my $self = $class->SUPER::new(@args); | ||
| 84 | return $self; | ||
| 85 | } | ||
| 86 | |||
| 87 | =head2 get_parameter | ||
| 88 | |||
| 89 | Title : get_parameter | ||
| 90 | Usage : $parameter_object->get_parameter($param_name); | ||
| 91 | Function: Get the value of a parameter named $param_name | ||
| 92 | Returns : A scalar that should be a string | ||
| 93 | Args : A scalar that should be a string | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | sub get_parameter { | ||
| 98 | my ($self,$arg) = @_; | ||
| 99 | return $self->{params}->{$arg}; | ||
| 100 | } | ||
| 101 | |||
| 102 | =head2 set_parameter | ||
| 103 | |||
| 104 | Title : set_parameter | ||
| 105 | Usage : $parameter_object->set_parameter($param_name => $param_value); | ||
| 106 | Function: Set the value of a parameter named $param_name to $param_value | ||
| 107 | Returns : Void | ||
| 108 | Args : A hash containing name=>value pairs | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | sub set_parameter { | ||
| 113 | my ($self,$name,$value) = @_; | ||
| 114 | $self->{params}->{$name} = $value; | ||
| 115 | } | ||
| 116 | |||
| 117 | =head2 available_parameters | ||
| 118 | |||
| 119 | Title : available_parameters | ||
| 120 | Usage : my @paramnames = $parameter_object->available_parameters | ||
| 121 | Function: Returns the names of the available parameters | ||
| 122 | Returns : list of available parameter names | ||
| 123 | Args : none | ||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | sub available_parameters { | ||
| 128 | my $self = shift; | ||
| 129 | return keys %{$self->{params}}; | ||
| 130 | } | ||
| 131 | |||
| 132 | 1; |