Workflows that do not follow the standard for $sample (@samples) have always been a bit of a pain. This was helped along some by iterators, but its still not great, especially if your iterator is not something very simple.
I added Template::Mustache as an optional template engine. It is the perl implementation of Mustache , a logicless templating system that is really good at iterating over loops.
Some preprocessing to get info into a datastructure (array of hashes in this case). This could also be done in the users language of choice and read into biox as a yaml or json configuration using the '.*_config' type.
- preprocess_dna:
local:
- override_process: 1
process: |
{
my $dna_list = [];
my @dna_files = glob($self->melt_dna_zips);
foreach my $dna (@dna_files) {
my $parse = fileparse($dna, '.zip');
my $dirname = dirname($dna);
my $dna_hash = {
file => $dna,
dirname => $dirname,
parse => $parse,
};
push(@{$dna_list}, $dna_hash);
}
$self->stash->{DNA} = $dna_list;
($SILENTLY);
}
Normally with nested loops what we would have would be this:
@nizardrou this should make you happy. ;-)
Workflows that do not follow the standard
for $sample (@samples)
have always been a bit of a pain. This was helped along some by iterators, but its still not great, especially if your iterator is not something very simple.I added Template::Mustache as an optional template engine. It is the perl implementation of Mustache , a logicless templating system that is really good at iterating over loops.
Some preprocessing to get info into a datastructure (array of hashes in this case). This could also be done in the users language of choice and read into biox as a yaml or json configuration using the '.*_config' type.
Normally with nested loops what we would have would be this:
But with the addition of the Mustache template it becomes this: