Commit 81f7bc36 authored by Leo Gordon's avatar Leo Gordon
Browse files

added an example of how to turn a csv into a list by param_substitute

parent f1df745e
......@@ -4,6 +4,7 @@ use strict;
use warnings;
use Bio::EnsEMBL::Hive::Params;
use Bio::EnsEMBL::Hive::Utils ('stringify');
my $params = Bio::EnsEMBL::Hive::Params->new();
......@@ -17,6 +18,9 @@ $params->param_init(1, {
'age' => { 'Alice' => 17, 'Bob' => 20, 'Chloe' => 21},
'age_prime' => '#expr( { %{#age#} } )expr#',
'csv' => '123,456,789',
'listref' => '#expr([eval #csv#])expr#',
});
print $params->param_substitute( "Substituting one scalar: #alpha# and another: #beta# and again one: #alpha# and the other: #beta# . Their product: #delta#\n" );
......@@ -32,3 +36,7 @@ print $params->param_substitute( 'joined gamma_prime: #expr( join(", ", @{#gamma
print $params->param_substitute( 'complex fold of age: #expr( join("\t", map { $ _.":".#age#->{$ _}} keys %{#age#}) )expr#' )."\n";
print $params->param_substitute( 'complex fold of age_prime: #expr( join("\t", map { $ _.":".#age_prime#->{$ _}} keys %{#age_prime#}) )expr#' )."\n";
print "\ncsv = '".$params->param('csv')."'\n";
my $listref = $params->param_substitute( '#listref#' );
print "list reference produced by evaluating csv: ".stringify($listref)."\n";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment