[Bioperl-guts-l] [14459] bioperl-live/trunk/Bio/DB/EUtilities.pm: Add simple method to retrieve parameter settings

Christopher John Fields cjfields at dev.open-bio.org
Wed Jan 30 14:54:39 EST 2008


Revision: 14459
Author:   cjfields
Date:     2008-01-30 14:54:38 -0500 (Wed, 30 Jan 2008)

Log Message:
-----------
Add simple method to retrieve parameter settings

Modified Paths:
--------------
    bioperl-live/trunk/Bio/DB/EUtilities.pm

Modified: bioperl-live/trunk/Bio/DB/EUtilities.pm
===================================================================
--- bioperl-live/trunk/Bio/DB/EUtilities.pm	2008-01-25 22:00:06 UTC (rev 14458)
+++ bioperl-live/trunk/Bio/DB/EUtilities.pm	2008-01-30 19:54:38 UTC (rev 14459)
@@ -302,9 +302,32 @@
 
 sub get_parameters {
     my ($self, @args) = @_;
-    return $self->parameter_base->available_parameters(@args);
+    return $self->parameter_base->get_parameters(@args);
 }
 
+=head2 get_parameter_values
+
+ Title   : get_parameter_values
+ Usage   : @vals = $factory->get_parameter_value('id'); # always get array
+ Function: Returns the specific parameter values.
+ Returns : For consistency returns a list of values for this parameter.  If only
+           one is expected, use:
+           
+           ($val) = $factory->get_parameter_value('id');
+           
+ Args    : parameter expected
+
+=cut
+
+sub get_parameter_values {
+    my ($self, $p) = @_;
+    my %params = $self->parameter_base->get_parameters(-list => [$p]);
+    if (exists $params{$p}) {
+        return ref $params{$p} eq 'ARRAY' ? @{$params{$p}} : $params{$p};
+    }
+    return;
+}
+
 =head1 Bio::Tools::EUtilities-delegating methods
 
 =cut




More information about the Bioperl-guts-l mailing list