Skip to content

Instantly share code, notes, and snippets.

@nazarov-yuriy
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazarov-yuriy/94f08e5eabfa9c5d87a5 to your computer and use it in GitHub Desktop.
Save nazarov-yuriy/94f08e5eabfa9c5d87a5 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use warnings;
use Template;
my $vars = {
GENOME_BUILD_NAME => 'GENOME_BUILD_NAME_val',
CHROMOSOME => 'CHROMOSOME_val',
SAMPLE_HASH => {
pairs => {
123 => {
sample_name => 'name123',
bigwig_URL => 'url123',
},
234 => {
sample_name => 'name234',
bigwig_URL => 'url234',
},
},
},
};
my $tt = Template->new();
$tt->process(\*DATA, $vars);
=sample output
track db=GENOME_BUILD_NAME_val position=CHROMOSOME_val type=bigWig name=name123 visibility=full bigDataUrl=url123
track db=GENOME_BUILD_NAME_val position=CHROMOSOME_val type=bigWig name=name234 visibility=full bigDataUrl=url234
=cut
__DATA__
[%- FOREACH library_pair IN SAMPLE_HASH.pairs %]
track db=[% GENOME_BUILD_NAME %] position=[% CHROMOSOME %] type=bigWig name=[% library_pair.value.sample_name %] visibility=full bigDataUrl=[% library_pair.value.bigwig_URL %]
[%- END %]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment