| 1 | package BioX::Workflow; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.008_005; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | our $VERSION = '0.17'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use File::Find::Rule; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use File::Path qw(make_path remove_tree); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Cwd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use List::Compare; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use YAML::XS 'LoadFile'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use String::CamelCase qw(camelize decamelize wordsplit); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Class::Load ':all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use IO::File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use Interpolation E => 'eval'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use Text::Template qw(fill_in_file fill_in_string); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use Data::Pairs; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Carp::Always; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 2 | extends 'BioX::Wrapper'; | |||||||||||||||||||||||||||
| 26 | 2 | with 'MooseX::Getopt::Usage'; | |||||||||||||||||||||||||||
| 27 | 2 | with 'MooseX::Getopt::Usage::Role::Man'; | |||||||||||||||||||||||||||
| 28 | 2 | with 'MooseX::SimpleConfig'; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 2 | with 'MooseX::Object::Pluggable'; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # For pretty man pages! | ||||||||||||||||||||||||||||
| 34 | 2 | $ENV{TERM}='xterm-256color'; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =encoding utf-7 | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 NAME | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | BioX::Workflow - A very opinionated template based workflow writer. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Most of the functionality can be accessed through the biox-workflow.pl script. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | biox-workflow.pl --workflow /path/to/workflow.yml | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | This module was written with Bioinformatics workflows in mind, but should be extensible to any sort of workflow or pipeline. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head1 Philosophy | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | Most bioinformatics workflows involve starting with a set of samples, and | ||||||||||||||||||||||||||||
| 53 | processing those samples in one or more steps. Also, most bioinformatics | ||||||||||||||||||||||||||||
| 54 | workflows are bash based, and no one wants to reinvent the wheel to rewrite | ||||||||||||||||||||||||||||
| 55 | their code in perl/python/whatever. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | For example with our samples test1.vcf and test2.vcf, we want to bgzip and | ||||||||||||||||||||||||||||
| 58 | annotate using snpeff, and then parse the output using vcf-to-table.pl | ||||||||||||||||||||||||||||
| 59 | (shameless plug for BioX::Wrapper::Annovar). | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | BioX::Workflow assumes your have a set of inputs, known as samples, | ||||||||||||||||||||||||||||
| 62 | and these inputs will carry on through your pipeline. There are some exceptions | ||||||||||||||||||||||||||||
| 63 | to this, which we will explore with the resample option. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | It also makes several assumptions about your output structure. It assumes you | ||||||||||||||||||||||||||||
| 66 | have each of your processes/rules outputting to a distinct directory. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | These directories will be created and automatically named based on your process | ||||||||||||||||||||||||||||
| 69 | name. You can disable this and make your own out directories by either | ||||||||||||||||||||||||||||
| 70 | specifiying auto_name: 0 in your global, in any of the local rules to disable | ||||||||||||||||||||||||||||
| 71 | it for that rule, or by specifying an outdirectory. | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head1 A Simple Example | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Here is a very simple example that searches a directory for *.csv files and creates an outdir /home/user/workflow/output if one doesn't exist. | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | Create the /home/user/workflow/workflow.yml | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | --- | ||||||||||||||||||||||||||||
| 80 | global: | ||||||||||||||||||||||||||||
| 81 | - indir: /home/guests/jir2004/workflow | ||||||||||||||||||||||||||||
| 82 | - outdir: /home/guests/jir2004/workflow/output | ||||||||||||||||||||||||||||
| 83 | - file_rule: (.csv)$ | ||||||||||||||||||||||||||||
| 84 | rules: | ||||||||||||||||||||||||||||
| 85 | - backup: | ||||||||||||||||||||||||||||
| 86 | process: cp {$self->indir}/{$sample}.csv {$self->outdir}/{$sample}.csv | ||||||||||||||||||||||||||||
| 87 | - grep_VARA: | ||||||||||||||||||||||||||||
| 88 | process: | | ||||||||||||||||||||||||||||
| 89 | echo "Working on {$self->{indir}}/{$sample.csv}" | ||||||||||||||||||||||||||||
| 90 | grep -i "VARA" {$self->indir}/{$sample}.csv >> {$self->outdir}/{$sample}.grep_VARA.csv | ||||||||||||||||||||||||||||
| 91 | - grep_VARB: | ||||||||||||||||||||||||||||
| 92 | process: | | ||||||||||||||||||||||||||||
| 93 | grep -i "VARB" {$self->indir}/{$sample}.grep_VARA.csv >> {$self->outdir}/{$sample}.grep_VARA.grep_VARB.csv | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | If we step through the whole process | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | cd /home/user/workflow | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | #Create test1.csv with some lines | ||||||||||||||||||||||||||||
| 100 | echo "This is VARA" >> test1.csv | ||||||||||||||||||||||||||||
| 101 | echo "This is VARB" >> test1.csv | ||||||||||||||||||||||||||||
| 102 | echo "This is VARC" >> test1.csv | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | #Create test2.csv with some lines | ||||||||||||||||||||||||||||
| 105 | echo "This is VARA" >> test2.csv | ||||||||||||||||||||||||||||
| 106 | echo "This is VARB" >> test2.csv | ||||||||||||||||||||||||||||
| 107 | echo "This is VARC" >> test2.csv | ||||||||||||||||||||||||||||
| 108 | echo "This is some data I don't want" >> test2.csv | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | Run the script to create out directory structure and workflow bash script | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | biox-workflow.pl --workflow workflow.yml > workflow.sh | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 Look at the directory structure | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | /home/user/workflow/ | ||||||||||||||||||||||||||||
| 117 | test1.csv | ||||||||||||||||||||||||||||
| 118 | test2.csv | ||||||||||||||||||||||||||||
| 119 | /output | ||||||||||||||||||||||||||||
| 120 | /backup | ||||||||||||||||||||||||||||
| 121 | /grep_vara | ||||||||||||||||||||||||||||
| 122 | /grep_varb | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =head2 Run the workflow | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | Assuming you saved your output to workflow.sh if you run ./workflow.sh you will get the following. | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | /home/user/workflow/ | ||||||||||||||||||||||||||||
| 129 | test1.csv | ||||||||||||||||||||||||||||
| 130 | test2.csv | ||||||||||||||||||||||||||||
| 131 | /output | ||||||||||||||||||||||||||||
| 132 | /backup | ||||||||||||||||||||||||||||
| 133 | test1.csv | ||||||||||||||||||||||||||||
| 134 | test2.csv | ||||||||||||||||||||||||||||
| 135 | /grep_vara | ||||||||||||||||||||||||||||
| 136 | test1.grep_VARA.csv | ||||||||||||||||||||||||||||
| 137 | test2.grep_VARA.csv | ||||||||||||||||||||||||||||
| 138 | /grep_varb | ||||||||||||||||||||||||||||
| 139 | test1.grep_VARA.grep_VARB.csv | ||||||||||||||||||||||||||||
| 140 | test2.grep_VARA.grep_VARB.csv | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =head2 A closer look at workflow.sh | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | This top part here is the metadata. It tells you the options used to run the script. | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | # | ||||||||||||||||||||||||||||
| 148 | # This file was generated with the following options | ||||||||||||||||||||||||||||
| 149 | # --workflow config.yml | ||||||||||||||||||||||||||||
| 150 | # | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | If --verbose is enabled, and it is by default, you'll see some variables printed out for your benefit | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | # | ||||||||||||||||||||||||||||
| 155 | # Variables | ||||||||||||||||||||||||||||
| 156 | # Indir: /home/user/workflow | ||||||||||||||||||||||||||||
| 157 | # Outdir: /home/user/workflow/output/backup | ||||||||||||||||||||||||||||
| 158 | # Samples: test1 test2 | ||||||||||||||||||||||||||||
| 159 | # | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | Here is out first rule, named backup. As you can see our $self->outdir is automatically named 'backup', relative to the globally defined outdir. | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | # | ||||||||||||||||||||||||||||
| 164 | # Starting backup | ||||||||||||||||||||||||||||
| 165 | # | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | cp /home/user/workflow/test1.csv /home/user/workflow/output/backup/test1.csv | ||||||||||||||||||||||||||||
| 168 | cp /home/user/workflow/test2.csv /home/user/workflow/output/backup/test2.csv | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | wait | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | # | ||||||||||||||||||||||||||||
| 173 | # Ending backup | ||||||||||||||||||||||||||||
| 174 | # | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | Notice the 'wait' command. If running your outputted workflow through any of the HPC::Runner scripts, the wait signals to wait until all previous processes have ended before beginning the next one. | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | For instance, if running this as | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | slurmrunner.pl --infile workflow.sh | ||||||||||||||||||||||||||||
| 181 | #OR | ||||||||||||||||||||||||||||
| 182 | mcerunner.pl --infile workflow.sh | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | The "cp blahblahblah" commands would run in parallel, and the next rule would not begin until those processes have finished. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | Here is some verbose output for the next rule. | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | # | ||||||||||||||||||||||||||||
| 189 | # Variables | ||||||||||||||||||||||||||||
| 190 | # Indir: /home/guests/jir2004/workflow/output | ||||||||||||||||||||||||||||
| 191 | # Outdir: /home/guests/jir2004/workflow/output/grep_vara | ||||||||||||||||||||||||||||
| 192 | # Samples: test1 test2 | ||||||||||||||||||||||||||||
| 193 | # | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | And here is the actual work. | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | # | ||||||||||||||||||||||||||||
| 198 | # Starting grep_VARA | ||||||||||||||||||||||||||||
| 199 | # | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | echo "Working on $self->indir/test1csv" | ||||||||||||||||||||||||||||
| 202 | grep -i "VARA" /home/guests/jir2004/workflow/output/test1.csv >> /home/guests/jir2004/workflow/output/grep_vara/test1.grep_VARA.csv | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | echo "Working on $self->indir/test2csv" | ||||||||||||||||||||||||||||
| 205 | grep -i "VARA" /home/guests/jir2004/workflow/output/test2.csv >> /home/guests/jir2004/workflow/output/grep_vara/test2.grep_VARA.csv | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | wait | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | # | ||||||||||||||||||||||||||||
| 210 | # Ending grep_VARA | ||||||||||||||||||||||||||||
| 211 | # | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | So on and so forth. | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | # | ||||||||||||||||||||||||||||
| 216 | # Variables | ||||||||||||||||||||||||||||
| 217 | # Indir: /home/guests/jir2004/workflow/output | ||||||||||||||||||||||||||||
| 218 | # Outdir: /home/guests/jir2004/workflow/output/grep_varb | ||||||||||||||||||||||||||||
| 219 | # Samples: test1 test2 | ||||||||||||||||||||||||||||
| 220 | # | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | # | ||||||||||||||||||||||||||||
| 224 | # Starting grep_VARB | ||||||||||||||||||||||||||||
| 225 | # | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | grep -i "VARB" /home/guests/jir2004/workflow/output/test1.csv >> /home/guests/jir2004/workflow/output/grep_varb/test1.grep_VARB.csv | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | grep -i "VARB" /home/guests/jir2004/workflow/output/test2.csv >> /home/guests/jir2004/workflow/output/grep_varb/test2.grep_VARB.csv | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | wait | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | # | ||||||||||||||||||||||||||||
| 234 | # Ending grep_VARB | ||||||||||||||||||||||||||||
| 235 | # | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | # | ||||||||||||||||||||||||||||
| 238 | # Workflow Finished | ||||||||||||||||||||||||||||
| 239 | # | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =head2 Finding your Samples | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | Finding samples is the most crucial step of the workflow. If no samples are found, nothing is done. | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | Normally, samples are files. | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | /path/to/indir | ||||||||||||||||||||||||||||
| 248 | sample1.vcf | ||||||||||||||||||||||||||||
| 249 | sample2.vcf | ||||||||||||||||||||||||||||
| 250 | sample3.vcf | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | But sometimes samples are directories. | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | /path/to/indir | ||||||||||||||||||||||||||||
| 255 | /sample1 | ||||||||||||||||||||||||||||
| 256 | billions_of_small_files | ||||||||||||||||||||||||||||
| 257 | from_the_Sequencer | ||||||||||||||||||||||||||||
| 258 | /sample2 | ||||||||||||||||||||||||||||
| 259 | billions_of_small_files | ||||||||||||||||||||||||||||
| 260 | from_the_Sequencer | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | If this is the case with your workflow, please specify find_by_dir=>1. | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | =head1 Customizing your output and special variables | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | BioX::Workflow uses a few conventions and special variables. As you | ||||||||||||||||||||||||||||
| 267 | probably noticed these are indir, outdir, infiles, and file_rule. In addition | ||||||||||||||||||||||||||||
| 268 | sample is the currently scoped sample. Infiles is not used by default, but is | ||||||||||||||||||||||||||||
| 269 | simply a store of all the original samples found when the script is first run, | ||||||||||||||||||||||||||||
| 270 | before any processes. In the above example the $self->infiles would evaluate as | ||||||||||||||||||||||||||||
| 271 | ['test1.csv', 'test2.csv']. | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | Variables are interpolated using L<Interpolation> and L<Text::Template>. All | ||||||||||||||||||||||||||||
| 274 | variables, unless explictly defined with "$my variable = "stuff"" in your | ||||||||||||||||||||||||||||
| 275 | process key, must be referenced with $self, and surrounded with brackets {}. | ||||||||||||||||||||||||||||
| 276 | Instead of $self->outdir, it should be {$self->outdir}. It is also possible to | ||||||||||||||||||||||||||||
| 277 | define variables with other variables in this way. Everything is referenced | ||||||||||||||||||||||||||||
| 278 | with $self in order to dynamically pass variables to Text::Template. The sample | ||||||||||||||||||||||||||||
| 279 | variable, $sample, is the exception because it is defined in the loop. In | ||||||||||||||||||||||||||||
| 280 | addition you can create an OUTPUT/OUTPUT variables to clean up your process | ||||||||||||||||||||||||||||
| 281 | code. These are special variables that are also used in Drake. Please see L<BioX::Workflow::Plugin::Drake> | ||||||||||||||||||||||||||||
| 282 | for more details. | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | --- | ||||||||||||||||||||||||||||
| 285 | global: | ||||||||||||||||||||||||||||
| 286 | - ROOT: /home/user/workflow | ||||||||||||||||||||||||||||
| 287 | - indir: {$self->ROOT} | ||||||||||||||||||||||||||||
| 288 | - outdir: {$self->indir}/output | ||||||||||||||||||||||||||||
| 289 | rules: | ||||||||||||||||||||||||||||
| 290 | - backup: | ||||||||||||||||||||||||||||
| 291 | local: | ||||||||||||||||||||||||||||
| 292 | - INPUT: {$self->indir}/{$sample}.in | ||||||||||||||||||||||||||||
| 293 | - OUTPUT: {$self->outdir}/{$sample}.out | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | Your variables must be defined in an appropriate order. | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | =head2 Local and Global Variables | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | Global variables will always be available, but can be overwritten by local | ||||||||||||||||||||||||||||
| 300 | variables contained in your rules. | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | --- | ||||||||||||||||||||||||||||
| 303 | global: | ||||||||||||||||||||||||||||
| 304 | - indir: /home/user/example-workflow | ||||||||||||||||||||||||||||
| 305 | - outdir: /home/user/example-workflow/gemini-wrapper | ||||||||||||||||||||||||||||
| 306 | - file_rule: (.vcf)$|(.vcf.gz)$ | ||||||||||||||||||||||||||||
| 307 | - some_variable: {$self->indir}/file_to_keep_handy | ||||||||||||||||||||||||||||
| 308 | rules: | ||||||||||||||||||||||||||||
| 309 | - backup: | ||||||||||||||||||||||||||||
| 310 | local: | ||||||||||||||||||||||||||||
| 311 | - ext: "backup" | ||||||||||||||||||||||||||||
| 312 | process: cp {$self->indir}/{$sample}.csv {$self->outdir}/{$sample}.{$self->ext}.csv | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | =head2 Rules | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | Rules are processed in the order they appear. | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | Before any rules are processed, first the samples are found. These are grepped using File::Basename, the indir, and the file_rule variable. The | ||||||||||||||||||||||||||||
| 319 | default is to get rid of the everything after the final '.' . | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =head2 Overriding Processes | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | By default your process is evaluated as | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | foreach my $sample (@{$self->samples}){ | ||||||||||||||||||||||||||||
| 326 | #Get the value from the process key. | ||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | If instead you would like to use the infiles, or some other random process that has nothing to do with your samples, you can override the process | ||||||||||||||||||||||||||||
| 330 | template. Make sure to use the previously defined $OUT. For more information see the L<Text::Template> man page. | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | rules: | ||||||||||||||||||||||||||||
| 333 | - backup: | ||||||||||||||||||||||||||||
| 334 | outdir: {$self->ROOT}/datafiles | ||||||||||||||||||||||||||||
| 335 | override_process: 1 | ||||||||||||||||||||||||||||
| 336 | process: | | ||||||||||||||||||||||||||||
| 337 | $OUT .= wget {$self->some_globally_defined_parameter} | ||||||||||||||||||||||||||||
| 338 | { | ||||||||||||||||||||||||||||
| 339 | foreach my $infile (@{$self->infiles}){ | ||||||||||||||||||||||||||||
| 340 | $OUT .= "dostuff $infile"; | ||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =head2 Directory Structure | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | BioX::Workflow will create a directory structure based on your rule name, and your globally defined outdir. | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | =head3 Default Structure | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | /path/to/outdir | ||||||||||||||||||||||||||||
| 353 | /rule1 | ||||||||||||||||||||||||||||
| 354 | /rule2 | ||||||||||||||||||||||||||||
| 355 | /rule3 | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | If you don't like this you can globally disable auto_name (auto_name: 0), or simply defined indir or outdir within your global variables. If using the | ||||||||||||||||||||||||||||
| 358 | second method it is probably a good idea to also defined a ROOT_DIR in your global variables. | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | =head3 By Sample Directory Structure | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | Alternately you can create a directory structure that separates your rules into sample directories with by_sample_outdir=1 | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | /path/to/outdir | ||||||||||||||||||||||||||||
| 365 | SAMPLE1/ | ||||||||||||||||||||||||||||
| 366 | /rule1 | ||||||||||||||||||||||||||||
| 367 | /rule2 | ||||||||||||||||||||||||||||
| 368 | /rule3 | ||||||||||||||||||||||||||||
| 369 | SAMPLE2/ | ||||||||||||||||||||||||||||
| 370 | /rule1 | ||||||||||||||||||||||||||||
| 371 | /rule2 | ||||||||||||||||||||||||||||
| 372 | /rule3 | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | =head2 Other variables | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | A quick overview of other samples | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | =head3 Resampling | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | I can only think of a few examples where one would want to perform a resample, since the files probably won't exist, but one example is if you want to | ||||||||||||||||||||||||||||
| 381 | check for uncompressed files, compress them, and then carry on with your life. | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | --- | ||||||||||||||||||||||||||||
| 384 | global: | ||||||||||||||||||||||||||||
| 385 | - indir: /home/user/gemini | ||||||||||||||||||||||||||||
| 386 | - outdir: /home/user/gemini/gemini-wrapper | ||||||||||||||||||||||||||||
| 387 | - file_rule: (.vcf)$|(.vcf.gz)$ | ||||||||||||||||||||||||||||
| 388 | - infile: | ||||||||||||||||||||||||||||
| 389 | rules: | ||||||||||||||||||||||||||||
| 390 | - bgzip: | ||||||||||||||||||||||||||||
| 391 | local: | ||||||||||||||||||||||||||||
| 392 | - file_rule: (.vcf)$ | ||||||||||||||||||||||||||||
| 393 | - resample: 1 | ||||||||||||||||||||||||||||
| 394 | before_meta: bgzip and tabix index uncompressed files | ||||||||||||||||||||||||||||
| 395 | after_meta: finished bgzip | ||||||||||||||||||||||||||||
| 396 | process: bgzip {$self->{indir}}/{$sample}.vcf && tabix {$self->{indir}}/{$sample}.vcf.gz | ||||||||||||||||||||||||||||
| 397 | - normalize_snpeff: | ||||||||||||||||||||||||||||
| 398 | local: | ||||||||||||||||||||||||||||
| 399 | - indir: /home/user | ||||||||||||||||||||||||||||
| 400 | - file_rule: (.vcf.gz)$ | ||||||||||||||||||||||||||||
| 401 | - resample: 1 | ||||||||||||||||||||||||||||
| 402 | process: | | ||||||||||||||||||||||||||||
| 403 | bcftools view {$self->indir}/{$sample}.vcf.gz | sed 's/ID=AD,Number=./ID=AD,Number=R/' \ | ||||||||||||||||||||||||||||
| 404 | | vt decompose -s - \ | ||||||||||||||||||||||||||||
| 405 | | vt normalize -r $REFGENOME - \ | ||||||||||||||||||||||||||||
| 406 | | java -Xmx4G -jar $SNPEFF/snpEff.jar -c \$SNPEFF/snpEff.config -formatEff -classic GRCh37.75 \ | ||||||||||||||||||||||||||||
| 407 | | bgzip -c > \ | ||||||||||||||||||||||||||||
| 408 | {$self->{outdir}}/{$sample}.norm.snpeff.gz && tabix {$self->{outdir}}/{$sample}.norm.snpeff.gz | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | The bgzip rule would first run a resample looking for only files ending in .vcf, and compress them. The following rule, normalize_snpeff, looks again | ||||||||||||||||||||||||||||
| 411 | in the indir (which we set here otherwise it would have been the previous rules outdir), and resamples based on the .vcf.gz extension. | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | =head2 Plugins | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | As of 0.10 there is a plugin system using L<MooseX::Object::Pluggable> | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | --- | ||||||||||||||||||||||||||||
| 418 | plugins: | ||||||||||||||||||||||||||||
| 419 | - FileDetails | ||||||||||||||||||||||||||||
| 420 | global: | ||||||||||||||||||||||||||||
| 421 | - indir: /home/user/gemini | ||||||||||||||||||||||||||||
| 422 | - outdir: /home/user/gemini/gemini-wrapper | ||||||||||||||||||||||||||||
| 423 | - file_rule: (.vcf)$|(.vcf.gz)$ | ||||||||||||||||||||||||||||
| 424 | - infile: | ||||||||||||||||||||||||||||
| 425 | #So On and So Forth | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | BioX::Workflow::Drake has been moved to BioX::Workflow::Plugin Drake. Instead of using | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | biox-workflow-drake.pl --THINGS | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | Instead add 'Drake' to your plugins list in your workflow file. | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | =head3 Drake Plugin | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | Drake is a 'make for data.' More information about it can be found here: | ||||||||||||||||||||||||||||
| 436 | L<https://github.com/Factual/drake> and the module can be found at L<BioX::Workflow::Plugin::Drake>. | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | =head3 FileDetails Plugin | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | BioX::Workflow will optionally put some commands at the end of your workflow to check files for | ||||||||||||||||||||||||||||
| 441 | metadata: MD5, DateTime created, last accessed, last modified, size, and human readable size. | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | It creates a structure {$self->outdir}/meta/file.meta. The output structure will probably be changed in the future. | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | For more information please see L<BioX::Workflow::Plugin::FileDetails> | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | =head1 In Code Documenation | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | You shouldn't really need to look here unless you have some reason to do some serious hacking. | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | =head2 Attributes | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | Moose attributes. Technically any of these can be changed, but may break everything. | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | =head3 resample | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | Boolean value get new samples based on indir/file_rule or no | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | Samples are found at the beginning of the workflow, based on the global indir variable and the file_find. | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | Chances are you don't want to set resample to try, because these files probably won't exist outside of the indirectory until the pipeline is run. | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | One example of doing so, shown in the gemini.yml in the examples directory, is looking for uncompressed files, .vcf extension, compressing them, and | ||||||||||||||||||||||||||||
| 464 | then resampling based on the .vcf.gz extension. | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | =cut | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | 2 | has 'resample' => ( | |||||||||||||||||||||||||||
| 469 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 470 | is => 'rw', | ||||||||||||||||||||||||||||
| 471 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 472 | default => 0, | ||||||||||||||||||||||||||||
| 473 | predicate => 'has_resample', | ||||||||||||||||||||||||||||
| 474 | clearer => 'clear_resample', | ||||||||||||||||||||||||||||
| 475 | ); | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =head2 find_by_dir | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | Use this option when you sample names are by directory | ||||||||||||||||||||||||||||
| 480 | The default is to find samples by filename | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | /SAMPLE1 | ||||||||||||||||||||||||||||
| 483 | SAMPLE1_r1.fastq.gz | ||||||||||||||||||||||||||||
| 484 | SAMPLE1_r2.fastq.gz | ||||||||||||||||||||||||||||
| 485 | /SAMPLE2 | ||||||||||||||||||||||||||||
| 486 | SAMPLE2_r1.fastq.gz | ||||||||||||||||||||||||||||
| 487 | SAMPLE2_r2.fastq.gz | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | =cut | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | 2 | has 'find_by_dir' => ( | |||||||||||||||||||||||||||
| 492 | is => 'rw', | ||||||||||||||||||||||||||||
| 493 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 494 | default => 0, | ||||||||||||||||||||||||||||
| 495 | documentation => q{Use this option when you sample names are directories}, | ||||||||||||||||||||||||||||
| 496 | predicate => 'has_find_by_dir', | ||||||||||||||||||||||||||||
| 497 | clearer => 'clear_find_by_dir', | ||||||||||||||||||||||||||||
| 498 | ); | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | =head2 by_sample_outdir | ||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | outdir/ | ||||||||||||||||||||||||||||
| 503 | /outdir/SAMPLE1 | ||||||||||||||||||||||||||||
| 504 | /rule1 | ||||||||||||||||||||||||||||
| 505 | /rule2 | ||||||||||||||||||||||||||||
| 506 | /rule3 | ||||||||||||||||||||||||||||
| 507 | /outdir/SAMPLE2 | ||||||||||||||||||||||||||||
| 508 | /rule1 | ||||||||||||||||||||||||||||
| 509 | /rule2 | ||||||||||||||||||||||||||||
| 510 | /rule3 | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | Instead of | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | /outdir | ||||||||||||||||||||||||||||
| 515 | /rule1 | ||||||||||||||||||||||||||||
| 516 | /rule2 | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | This feature is not particularly well supported, and may break when mixed with other methods, particularly --resample | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | 2 | has 'by_sample_outdir' => ( | |||||||||||||||||||||||||||
| 523 | is => 'rw', | ||||||||||||||||||||||||||||
| 524 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 525 | default => 0, | ||||||||||||||||||||||||||||
| 526 | documentation => q{When you want your output by sample}, | ||||||||||||||||||||||||||||
| 527 | clearer => 'clear_by_sample_outdir', | ||||||||||||||||||||||||||||
| 528 | predicate => 'has_by_sample_outdir', | ||||||||||||||||||||||||||||
| 529 | ); | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | =head3 auto_name | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | Auto_name - Create outdirectory based on rulename | ||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | global: | ||||||||||||||||||||||||||||
| 536 | - outdir: /home/user/workflow/processed | ||||||||||||||||||||||||||||
| 537 | rule: | ||||||||||||||||||||||||||||
| 538 | normalize: | ||||||||||||||||||||||||||||
| 539 | process: | ||||||||||||||||||||||||||||
| 540 | dostuff {$self->indir}/{$sample}.in >> {$self->outdir}/$sample.out | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | Would create your directory structure /home/user/workflow/processed/normalize (if it doesn't exist) | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | =cut | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | 2 | has 'auto_name' => ( | |||||||||||||||||||||||||||
| 547 | traits => ['Bool'], | ||||||||||||||||||||||||||||
| 548 | is => 'rw', | ||||||||||||||||||||||||||||
| 549 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 550 | default => 1, | ||||||||||||||||||||||||||||
| 551 | #clearer => 'clear_auto_name', | ||||||||||||||||||||||||||||
| 552 | predicate => 'has_auto_name', | ||||||||||||||||||||||||||||
| 553 | handles =>{ | ||||||||||||||||||||||||||||
| 554 | enforce_struct => 'set', | ||||||||||||||||||||||||||||
| 555 | clear_enforce_struct => 'unset', | ||||||||||||||||||||||||||||
| 556 | clear_auto_name => 'unset', | ||||||||||||||||||||||||||||
| 557 | }, | ||||||||||||||||||||||||||||
| 558 | ); | ||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | =head3 auto_input | ||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||
| 562 | This is similar to the auto_name function in the BioX::Workflow. | ||||||||||||||||||||||||||||
| 563 | Instead this says each input should be the previous output. | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | =cut | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | 2 | has 'auto_input' => ( | |||||||||||||||||||||||||||
| 568 | is => 'rw', | ||||||||||||||||||||||||||||
| 569 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 570 | default => 1, | ||||||||||||||||||||||||||||
| 571 | clearer => 'clear_auto_input', | ||||||||||||||||||||||||||||
| 572 | predicate => 'has_auto_input', | ||||||||||||||||||||||||||||
| 573 | ); | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | # Getting rid of this - its the same as auto_name | ||||||||||||||||||||||||||||
| 576 | # Put it in auto_name for compatibility | ||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||
| 578 | #has 'enforce_struct' => ( | ||||||||||||||||||||||||||||
| 579 | #is => 'rw', | ||||||||||||||||||||||||||||
| 580 | #isa => 'Bool', | ||||||||||||||||||||||||||||
| 581 | #default => 1, | ||||||||||||||||||||||||||||
| 582 | #clearer => 'clear_enforce_struct', | ||||||||||||||||||||||||||||
| 583 | #predicate => 'has_enforce_struct', | ||||||||||||||||||||||||||||
| 584 | #); | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | =head3 verbose | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | Output some more things | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | =cut | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | 2 | has 'verbose' => ( | |||||||||||||||||||||||||||
| 593 | is => 'rw', | ||||||||||||||||||||||||||||
| 594 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 595 | default => 1, | ||||||||||||||||||||||||||||
| 596 | clearer => 'clear_verbose', | ||||||||||||||||||||||||||||
| 597 | predicate => 'has_verbose', | ||||||||||||||||||||||||||||
| 598 | ); | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | =head3 wait | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | Print "wait" at the end of each rule | ||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | =cut | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | 2 | has 'wait' => ( | |||||||||||||||||||||||||||
| 607 | is => 'rw', | ||||||||||||||||||||||||||||
| 608 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 609 | default => 1, | ||||||||||||||||||||||||||||
| 610 | documentation => q(Print 'wait' at the end of each rule. If you are running as a plain bash script you probably don't need this.), | ||||||||||||||||||||||||||||
| 611 | clearer => 'clear_wait', | ||||||||||||||||||||||||||||
| 612 | predicate => 'has_wait', | ||||||||||||||||||||||||||||
| 613 | ); | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | =head3 override_process | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | local: | ||||||||||||||||||||||||||||
| 619 | - override_process: 1 | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | =cut | ||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | 2 | has 'override_process' => ( | |||||||||||||||||||||||||||
| 624 | traits => ['Bool'], | ||||||||||||||||||||||||||||
| 625 | is => 'rw', | ||||||||||||||||||||||||||||
| 626 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 627 | default => 0, | ||||||||||||||||||||||||||||
| 628 | predicate => 'has_override_process', | ||||||||||||||||||||||||||||
| 629 | documentation => q(Instead of for my $sample (@sample){ DO STUFF } just DOSTUFF), | ||||||||||||||||||||||||||||
| 630 | handles => { | ||||||||||||||||||||||||||||
| 631 | set_override_process => 'set', | ||||||||||||||||||||||||||||
| 632 | clear_override_process => 'unset', | ||||||||||||||||||||||||||||
| 633 | }, | ||||||||||||||||||||||||||||
| 634 | ); | ||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | =head3 indir outdir | ||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||
| 638 | =cut | ||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | has 'indir' => ( | ||||||||||||||||||||||||||||
| 641 | is => 'rw', | ||||||||||||||||||||||||||||
| 642 | isa => 'Str', | ||||||||||||||||||||||||||||
| 643 | 0 | ▶ | default => sub {getcwd();}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 644 | 2 | predicate => 'has_indir', | |||||||||||||||||||||||||||
| 645 | clearer => 'clear_indir', | ||||||||||||||||||||||||||||
| 646 | documentation => q(Directory to look for samples), | ||||||||||||||||||||||||||||
| 647 | ); | ||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||
| 649 | has 'outdir' => ( | ||||||||||||||||||||||||||||
| 650 | is => 'rw', | ||||||||||||||||||||||||||||
| 651 | isa => 'Str', | ||||||||||||||||||||||||||||
| 652 | 0 | ▶ | default => sub {getcwd();}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 653 | 2 | predicate => 'has_outdir', | |||||||||||||||||||||||||||
| 654 | clearer => 'clear_outdir', | ||||||||||||||||||||||||||||
| 655 | documentation => q(Output directories for rules and processes), | ||||||||||||||||||||||||||||
| 656 | ); | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | =head3 create_outdir | ||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||
| 660 | =cut | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | 2 | has 'create_outdir' => ( | |||||||||||||||||||||||||||
| 663 | is => 'rw', | ||||||||||||||||||||||||||||
| 664 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 665 | predicate => 'has_create_outdir', | ||||||||||||||||||||||||||||
| 666 | clearer => 'clear_create_outdir', | ||||||||||||||||||||||||||||
| 667 | documentation => q(Create the outdir. You may want to turn this off if doing a rule that doesn't write anything, such as checking if files exist), | ||||||||||||||||||||||||||||
| 668 | default => 1, | ||||||||||||||||||||||||||||
| 669 | ); | ||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||
| 671 | =head3 INPUT OUTPUT | ||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | Special variables that can have input/output | ||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||
| 675 | These variables are also used in L<BioX::Workflow::Plugin::Drake> | ||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | =cut | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | 2 | has 'OUTPUT' =>( | |||||||||||||||||||||||||||
| 680 | is => 'rw', | ||||||||||||||||||||||||||||
| 681 | isa => 'Str|Undef', | ||||||||||||||||||||||||||||
| 682 | predicate => 'has_OUTPUT', | ||||||||||||||||||||||||||||
| 683 | clearer => 'clear_OUTPUT', | ||||||||||||||||||||||||||||
| 684 | documentation => q(Maybe clean up your code some. At the end of each process the OUTPUT becomes | ||||||||||||||||||||||||||||
| 685 | the INPUT. Best when putting a single file through a stream of processes.) | ||||||||||||||||||||||||||||
| 686 | ); | ||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||
| 688 | 2 | has 'INPUT' =>( | |||||||||||||||||||||||||||
| 689 | is => 'rw', | ||||||||||||||||||||||||||||
| 690 | isa => 'Str|Undef', | ||||||||||||||||||||||||||||
| 691 | predicate => 'has_INPUT', | ||||||||||||||||||||||||||||
| 692 | clearer => 'clear_INPUT', | ||||||||||||||||||||||||||||
| 693 | documentation => q(See $OUTPUT) | ||||||||||||||||||||||||||||
| 694 | ); | ||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||
| 696 | =head3 file_rule | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | Rule to find files | ||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||
| 700 | =cut | ||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | has 'file_rule' =>( | ||||||||||||||||||||||||||||
| 703 | is => 'rw', | ||||||||||||||||||||||||||||
| 704 | isa => 'Str', | ||||||||||||||||||||||||||||
| 705 | 0 | ▶ | default => sub { return "\\.[^.]*"; }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 706 | 2 | clearer => 'clear_file_rule', | |||||||||||||||||||||||||||
| 707 | predicate => 'has_file_rule', | ||||||||||||||||||||||||||||
| 708 | ); | ||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||
| 710 | =head3 No GetOpt Here | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | =cut | ||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||
| 714 | 2 | has 'yaml' => ( | |||||||||||||||||||||||||||
| 715 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 716 | is => 'rw', | ||||||||||||||||||||||||||||
| 717 | ); | ||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||
| 719 | =head3 attr | ||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||
| 721 | attributes read in from runtime | ||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||
| 723 | =cut | ||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||
| 725 | 2 | has 'attr' => ( | |||||||||||||||||||||||||||
| 726 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 727 | is => 'rw', | ||||||||||||||||||||||||||||
| 728 | isa => 'Data::Pairs', | ||||||||||||||||||||||||||||
| 729 | ); | ||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | =head3 global_attr | ||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||
| 733 | Attributes defined in the global section of the yaml file | ||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||
| 735 | =cut | ||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||
| 737 | 2 | has 'global_attr' => ( | |||||||||||||||||||||||||||
| 738 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 739 | is => 'rw', | ||||||||||||||||||||||||||||
| 740 | isa => 'Data::Pairs', | ||||||||||||||||||||||||||||
| 741 | ); | ||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | =head3 local_attr | ||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||
| 745 | Attributes defined in the rules->rulename->local section of the yaml file | ||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||
| 747 | =cut | ||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||
| 749 | 2 | has 'local_attr' => ( | |||||||||||||||||||||||||||
| 750 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 751 | is => 'rw', | ||||||||||||||||||||||||||||
| 752 | isa => 'Data::Pairs', | ||||||||||||||||||||||||||||
| 753 | ); | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | =head3 local_rule | ||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | =cut | ||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||
| 759 | 2 | has 'local_rule' => ( | |||||||||||||||||||||||||||
| 760 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 761 | is => 'rw', | ||||||||||||||||||||||||||||
| 762 | isa => 'HashRef' | ||||||||||||||||||||||||||||
| 763 | ); | ||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||
| 765 | =head3 infiles | ||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||
| 767 | Infiles to be processed | ||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | =cut | ||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||
| 771 | 2 | has 'infiles' => ( | |||||||||||||||||||||||||||
| 772 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 773 | is => 'rw', | ||||||||||||||||||||||||||||
| 774 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 775 | ); | ||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||
| 777 | =head3 samples | ||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||
| 779 | =cut | ||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||
| 781 | 2 | has 'samples' => ( | |||||||||||||||||||||||||||
| 782 | is => 'rw', | ||||||||||||||||||||||||||||
| 783 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 784 | ); | ||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||
| 786 | =head3 process | ||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||
| 788 | Do stuff | ||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||
| 790 | =cut | ||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||
| 792 | 2 | has 'process' => ( | |||||||||||||||||||||||||||
| 793 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 794 | is => 'rw', | ||||||||||||||||||||||||||||
| 795 | isa => 'Str', | ||||||||||||||||||||||||||||
| 796 | ); | ||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||
| 798 | =head3 key | ||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||
| 800 | Do stuff | ||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||
| 804 | 2 | has 'key' => ( | |||||||||||||||||||||||||||
| 805 | traits => [ 'NoGetopt' ], | ||||||||||||||||||||||||||||
| 806 | is => 'rw', | ||||||||||||||||||||||||||||
| 807 | isa => 'Str', | ||||||||||||||||||||||||||||
| 808 | ); | ||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||
| 810 | =head3 workflow | ||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||
| 812 | Path to workflow workflow. This must be a YAML file. | ||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||
| 814 | =cut | ||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||
| 816 | 2 | has 'workflow' => ( | |||||||||||||||||||||||||||
| 817 | is => 'rw', | ||||||||||||||||||||||||||||
| 818 | isa => 'Str', | ||||||||||||||||||||||||||||
| 819 | required => 1, | ||||||||||||||||||||||||||||
| 820 | ); | ||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||
| 822 | =head3 rule_based | ||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||
| 824 | This is the default. The outer loop are the rules, not the samples | ||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||
| 826 | =cut | ||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | 2 | has 'rule_based' => ( | |||||||||||||||||||||||||||
| 829 | is => 'rw', | ||||||||||||||||||||||||||||
| 830 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 831 | default => 1, | ||||||||||||||||||||||||||||
| 832 | ); | ||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | =head3 sample_based | ||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||
| 836 | Default Value. The outer loop is samples, not rules. Must be set in your global values or on the command line --sample_based 1 | ||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||
| 838 | If you ever have resample: 1 in your config you should NOT set this value to true! | ||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||
| 840 | =cut | ||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||
| 842 | 2 | has 'sample_based' => ( | |||||||||||||||||||||||||||
| 843 | is => 'rw', | ||||||||||||||||||||||||||||
| 844 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 845 | default => 0, | ||||||||||||||||||||||||||||
| 846 | ); | ||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||
| 848 | =head2 stash | ||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||
| 850 | This isn't ever used in the code. Its just there incase you want to do some things with override_process | ||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||
| 852 | It uses Moose::Meta::Attribute::Native::Trait::Hash and supports all the methods. | ||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||
| 854 | set_stash => 'set', | ||||||||||||||||||||||||||||
| 855 | get_stash => 'get', | ||||||||||||||||||||||||||||
| 856 | has_no_stash => 'is_empty', | ||||||||||||||||||||||||||||
| 857 | num_stashs => 'count', | ||||||||||||||||||||||||||||
| 858 | delete_stash => 'delete', | ||||||||||||||||||||||||||||
| 859 | stash_pairs => 'kv', | ||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||
| 861 | =cut | ||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||
| 863 | has 'stash' => ( | ||||||||||||||||||||||||||||
| 864 | is => 'rw', | ||||||||||||||||||||||||||||
| 865 | isa => 'HashRef', | ||||||||||||||||||||||||||||
| 866 | traits => ['Hash'], | ||||||||||||||||||||||||||||
| 867 | 0 | ▶ | default => sub { {} }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 868 | 2 | handles => { | |||||||||||||||||||||||||||
| 869 | set_stash => 'set', | ||||||||||||||||||||||||||||
| 870 | get_stash => 'get', | ||||||||||||||||||||||||||||
| 871 | has_no_stash => 'is_empty', | ||||||||||||||||||||||||||||
| 872 | num_stashs => 'count', | ||||||||||||||||||||||||||||
| 873 | delete_stash => 'delete', | ||||||||||||||||||||||||||||
| 874 | stash_pairs => 'kv', | ||||||||||||||||||||||||||||
| 875 | }, | ||||||||||||||||||||||||||||
| 876 | ); | ||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | =head2 Subroutines | ||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||
| 880 | Subroutines can also be overriden and/or extended in the usual Moose fashion. | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | =head3 run | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | Starting point. | ||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | =cut | ||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||
| 888 | sub run { | ||||||||||||||||||||||||||||
| 889 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||
| 891 | 0 | print "#!/bin/bash\n\n"; | |||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||
| 893 | 0 | $self->print_opts; | |||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||
| 895 | 0 | $self->init_things; | |||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||
| 897 | 0 | $self->write_workflow_meta('start'); | |||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||
| 899 | 0 | $self->write_pipeline; | |||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | 0 | $self->write_workflow_meta('end'); | |||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||
| 904 | sub write_workflow_meta{ | ||||||||||||||||||||||||||||
| 905 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
write_workflow_meta: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 906 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | 0 | ▶ | return unless $self->verbose; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||
| 910 | 0 | ▶ | if($type eq "start"){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 911 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 912 | 0 | print "$self->{comment_char} Starting Workflow\n"; | |||||||||||||||||||||||||||
| 913 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 914 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 915 | 0 | print "$self->{comment_char} Global Variables:\n"; | |||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | 0 | my @keys = $self->global_attr->get_keys(); | |||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||
| 919 | 0 | foreach my $k (@keys){ | |||||||||||||||||||||||||||
| 920 | 0 | ▶ | next unless $k; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 921 | 0 | my($v) = $self->global_attr->get_values($k); | |||||||||||||||||||||||||||
| 922 | 0 | print "$self->{comment_char}\t$k: ".$v."\n"; | |||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||
| 924 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||
| 926 | elsif($type eq "end"){ | ||||||||||||||||||||||||||||
| 927 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 928 | 0 | print "$self->{comment_char} Ending Workflow\n"; | |||||||||||||||||||||||||||
| 929 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||
| 932 | sub init_things { | ||||||||||||||||||||||||||||
| 933 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_things: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||
| 935 | 0 | my $array = LoadFile($self->workflow); | |||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||
| 937 | 0 | $self->yaml($array); | |||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||
| 939 | 0 | $self->class_load; | |||||||||||||||||||||||||||
| 940 | 0 | $self->plugin_load; | |||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||
| 942 | #Darn you data pairs and you're shallow copies! | ||||||||||||||||||||||||||||
| 943 | 0 | $self->global_attr(Data::Pairs->new(dclone($self->yaml->{global}))); | |||||||||||||||||||||||||||
| 944 | 0 | $self->attr(dclone($self->global_attr)); | |||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||
| 946 | 0 | $self->create_attr; | |||||||||||||||||||||||||||
| 947 | 0 | $self->eval_attr; | |||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||
| 949 | 0 | $self->make_outdir; | |||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||
| 951 | 0 | $self->get_samples; | |||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||
| 954 | =head3 make_outdir | ||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||
| 956 | Set initial indir and outdir | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | =cut | ||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||
| 960 | sub make_outdir { | ||||||||||||||||||||||||||||
| 961 | 0 | ▶ | my($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_outdir: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||
| 963 | 0 | ▶ | return unless $self->create_outdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||
| 965 | 0 | ▶ | make_path($self->outdir) if ! -d $self->outdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||
| 968 | =head3 get_samples | ||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||
| 970 | Get basename of the files. Can add optional rules. | ||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||
| 972 | sample.vcf.gz and sample.vcf would be sample if the file_rule is (.vcf)$|(.vcf.gz)$ | ||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | Also gets the full path to infiles | ||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||
| 976 | Instead of doing | ||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||
| 978 | foreach my $sample (@$self->samples){ | ||||||||||||||||||||||||||||
| 979 | dostuff | ||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||
| 982 | Could have | ||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||
| 984 | foreach my $infile (@$self->infiles){ | ||||||||||||||||||||||||||||
| 985 | dostuff | ||||||||||||||||||||||||||||
| 986 | } | ||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||
| 988 | =cut | ||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||
| 990 | sub get_samples{ | ||||||||||||||||||||||||||||
| 991 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
get_samples: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 992 | 0 | my(@whole, @basename, $text); | |||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||
| 994 | 0 | ▶ | return if $self->attr->exists('samples'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||
| 996 | 0 | $text = $self->file_rule; | |||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | 0 | ▶ | if($self->find_by_dir){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 999 | 0 | @whole = find(directory => name => qr/$text/, maxdepth => 1, in => $self->indir); | |||||||||||||||||||||||||||
| 1000 | 0 | @basename = map { basename($_) } @whole ; | |||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||
| 1002 | else{ | ||||||||||||||||||||||||||||
| 1003 | #$DB::single=2; | ||||||||||||||||||||||||||||
| 1004 | 0 | @whole = find(file => name => qr/$text/, maxdepth => 1, in => $self->indir); | |||||||||||||||||||||||||||
| 1005 | 0 | @basename = map { my @tmp = fileparse($_, qr/$text/); $tmp[0] } @whole ; | |||||||||||||||||||||||||||
| 1006 | } | ||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||
| 1008 | 0 | $self->samples(\@basename); | |||||||||||||||||||||||||||
| 1009 | 0 | $self->infiles(\@whole); | |||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||
| 1011 | 0 | ▶ | if($self->verbose){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1012 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 1013 | 0 | print "$self->{comment_char} Samples: ",join(", ", @{$self->samples})."\n"; | |||||||||||||||||||||||||||
| 1014 | 0 | print "$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||
| 1019 | =head3 plugin_load | ||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||
| 1021 | Load plugins defined in yaml with MooseX::Object::Pluggable | ||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||
| 1023 | =cut | ||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||
| 1025 | sub plugin_load { | ||||||||||||||||||||||||||||
| 1026 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
plugin_load: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||
| 1028 | 0 | ▶ | return unless $self->yaml->{plugins}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||
| 1030 | 0 | my $modules = $self->yaml->{plugins}; | |||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||
| 1032 | 0 | foreach my $m (@$modules){ | |||||||||||||||||||||||||||
| 1033 | 0 | $self->load_plugin($m); | |||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||
| 1035 | } | ||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||
| 1037 | =head3 class_load | ||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||
| 1039 | Load classes defined in yaml with Class::Load | ||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||
| 1041 | =cut | ||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||
| 1043 | sub class_load { | ||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
class_load: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||
| 1046 | 0 | ▶ | return unless $self->yaml->{use}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||
| 1048 | 0 | my $modules = $self->yaml->{use}; | |||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||
| 1050 | 0 | foreach my $m (@$modules){ | |||||||||||||||||||||||||||
| 1051 | 0 | load_class($m); | |||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||
| 1055 | =head3 make_template | ||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||
| 1057 | Make the template for interpolating strings | ||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||
| 1059 | =cut | ||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||
| 1061 | sub make_template{ | ||||||||||||||||||||||||||||
| 1062 | 0 | ▶ | my($self, $input) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_template: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||
| 1064 | 0 | my $template = Text::Template->new( TYPE => 'STRING', | |||||||||||||||||||||||||||
| 1065 | SOURCE => "$E{$input}", | ||||||||||||||||||||||||||||
| 1066 | ); | ||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||
| 1068 | 0 | return $template; | |||||||||||||||||||||||||||
| 1069 | } | ||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||
| 1071 | =head3 create_attr | ||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||
| 1073 | make attributes | ||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | =cut | ||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||
| 1077 | sub create_attr{ | ||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
create_attr: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||
| 1080 | 0 | my $meta = __PACKAGE__->meta; | |||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||
| 1082 | 0 | $meta->make_mutable; | |||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||
| 1084 | 0 | my %seen = (); | |||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||
| 1086 | 0 | for my $attr ( $meta->get_all_attributes ) { | |||||||||||||||||||||||||||
| 1087 | 0 | $seen{$attr->name} = 1; | |||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||
| 1090 | # Data Pairs is so much prettier | ||||||||||||||||||||||||||||
| 1091 | 0 | my @keys = $self->attr->get_keys(); | |||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||
| 1093 | 0 | foreach my $k (@keys){ | |||||||||||||||||||||||||||
| 1094 | 0 | my($v) = $self->attr->get_values($k); | |||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | if(! exists $seen{$k}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1097 | 0 | $meta->add_attribute($k => (is => 'rw', predicate => "has_$k", clearer => "clear_$k")); | |||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||
| 1099 | 0 | ▶ | $self->$k($v) if $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||
| 1102 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1103 | 0 | $meta->make_immutable; | |||||||||||||||||||||||||||
| 1104 | } | ||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||
| 1106 | sub eval_attr { | ||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
eval_attr: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1108 | 0 | my $sample = shift; | |||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||
| 1110 | #$DB::single=2; | ||||||||||||||||||||||||||||
| 1111 | 0 | my @keys = $self->attr->get_keys(); | |||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||
| 1113 | 0 | foreach my $k (@keys){ | |||||||||||||||||||||||||||
| 1114 | 0 | my($v) = $self->attr->get_values($k); | |||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||
| 1116 | 0 | ▶ | next unless $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||
| 1118 | 0 | my $template = $self->make_template($v); | |||||||||||||||||||||||||||
| 1119 | 0 | my $text; | |||||||||||||||||||||||||||
| 1120 | 0 | ▶ | if($sample){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1121 | 0 | $text = $template->fill_in(HASH => {self => \$self, sample => $sample}); | |||||||||||||||||||||||||||
| 1122 | } | ||||||||||||||||||||||||||||
| 1123 | else{ | ||||||||||||||||||||||||||||
| 1124 | 0 | $text = $template->fill_in(HASH => {self => \$self}); | |||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||
| 1127 | #$DB::single=2; | ||||||||||||||||||||||||||||
| 1128 | 0 | $self->$k($text); | |||||||||||||||||||||||||||
| 1129 | } | ||||||||||||||||||||||||||||
| 1130 | #$self->make_outdir if $self->attr->exists('OUTPUT'); | ||||||||||||||||||||||||||||
| 1131 | 0 | ▶ | $self->make_outdir if $self->create_outdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||
| 1134 | sub clear_attr { | ||||||||||||||||||||||||||||
| 1135 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
clear_attr: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||
| 1137 | 0 | my @keys = $self->attr->get_keys(); | |||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||
| 1139 | 0 | foreach my $k (@keys){ | |||||||||||||||||||||||||||
| 1140 | 0 | my($v) = $self->attr->get_values($k); | |||||||||||||||||||||||||||
| 1141 | 0 | ▶ | next unless $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||
| 1143 | 0 | my $clear = "clear_$k"; | |||||||||||||||||||||||||||
| 1144 | 0 | $self->$clear; | |||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||
| 1148 | sub write_pipeline{ | ||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
write_pipeline: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||
| 1151 | 0 | my $process = $self->yaml->{rules}; | |||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||
| 1153 | 0 | ▶ | die print "Where are the rules?\n" unless $process; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||
| 1155 | # This is untested with resampling! | ||||||||||||||||||||||||||||
| 1156 | 0 | ▶ | if($self->sample_based){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 1157 | #Store the samples | ||||||||||||||||||||||||||||
| 1158 | 0 | my $sample_store = $self->samples; | |||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||
| 1160 | 0 | foreach my $sample (@$sample_store){ | |||||||||||||||||||||||||||
| 1161 | 0 | $self->samples([$sample]); | |||||||||||||||||||||||||||
| 1162 | 0 | foreach my $p (@{$process}){ | |||||||||||||||||||||||||||
| 1163 | 0 | ▶ | next unless $p; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1164 | 0 | $self->local_rule($p); | |||||||||||||||||||||||||||
| 1165 | 0 | $self->dothings; | |||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||
| 1167 | } | ||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||
| 1169 | elsif($self->rule_based){ | ||||||||||||||||||||||||||||
| 1170 | 0 | foreach my $p (@{$process}){ | |||||||||||||||||||||||||||
| 1171 | 0 | ▶ | next unless $p; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1172 | 0 | $self->local_rule($p); | |||||||||||||||||||||||||||
| 1173 | 0 | $self->dothings; | |||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||
| 1175 | } | ||||||||||||||||||||||||||||
| 1176 | else{ | ||||||||||||||||||||||||||||
| 1177 | 0 | die print "Workflow must be rule based or sample based!\n"; | |||||||||||||||||||||||||||
| 1178 | } | ||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||
| 1181 | sub dothings { | ||||||||||||||||||||||||||||
| 1182 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
dothings: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||
| 1184 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||
| 1186 | 0 | $self->check_keys; | |||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||
| 1188 | 0 | $self->init_process_vars; | |||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||
| 1190 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||
| 1192 | 0 | $self->process($self->local_rule->{$self->key}->{process}); | |||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||
| 1194 | 0 | $self->write_rule_meta('before_meta'); | |||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||
| 1196 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||
| 1198 | 0 | $self->write_process(); | |||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||
| 1200 | 0 | $self->write_rule_meta('after_meta'); | |||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||
| 1202 | 0 | $self->clear_process_vars; | |||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | $self->indir($self->outdir."/".$self->pkey) if $self->auto_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1205 | } | ||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||
| 1207 | =head2 check_keys | ||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||
| 1209 | There should be one key and one key only! | ||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||
| 1211 | =cut | ||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||
| 1213 | sub check_keys{ | ||||||||||||||||||||||||||||
| 1214 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
check_keys: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 1215 | 0 | my @keys = keys %{$self->local_rule}; | |||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||
| 1217 | 0 | ▶ | if($#keys > 0){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 1218 | 0 | die print "We have a problem! There should only be one key. Please see the documentation!\n"; | |||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||
| 1220 | elsif(! @keys){ | ||||||||||||||||||||||||||||
| 1221 | 0 | die print "There are no rules. Please see the documenation.\n"; | |||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||
| 1223 | else{ | ||||||||||||||||||||||||||||
| 1224 | 0 | $self->key($keys[0]); | |||||||||||||||||||||||||||
| 1225 | } | ||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||
| 1227 | 0 | ▶ | if(! exists $self->local_rule->{$self->key}->{process}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1228 | 0 | die print "There is no process key! Dying...\n"; | |||||||||||||||||||||||||||
| 1229 | } | ||||||||||||||||||||||||||||
| 1230 | } | ||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||
| 1232 | =head2 clear_process_vars | ||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||
| 1234 | Clear the process vars | ||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||
| 1236 | =cut | ||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||
| 1238 | sub clear_process_vars { | ||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
clear_process_vars: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||
| 1241 | #Set bools back to false and reinitialize global vars | ||||||||||||||||||||||||||||
| 1242 | 0 | $self->resample(0); | |||||||||||||||||||||||||||
| 1243 | 0 | $self->override_process(0); | |||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||
| 1245 | 0 | $self->attr->clear; | |||||||||||||||||||||||||||
| 1246 | 0 | $self->local_attr->clear; | |||||||||||||||||||||||||||
| 1247 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||
| 1249 | 0 | $self->add_attr('global_attr'); | |||||||||||||||||||||||||||
| 1250 | 0 | $self->eval_attr; | |||||||||||||||||||||||||||
| 1251 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1252 | } | ||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||
| 1254 | =head2 init_process_vars | ||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||
| 1256 | Initialize the process vars | ||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||
| 1258 | =cut | ||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||
| 1260 | sub init_process_vars { | ||||||||||||||||||||||||||||
| 1261 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_process_vars: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||
| 1263 | 0 | ▶ | if($self->auto_name){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1264 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1265 | 0 | $self->outdir($self->outdir."/".$self->key); | |||||||||||||||||||||||||||
| 1266 | 0 | ▶ | $self->make_outdir() unless $self->by_sample_outdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1267 | } | ||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||
| 1269 | #TODO move this over to local | ||||||||||||||||||||||||||||
| 1270 | 0 | ▶ | if (exists $self->local_rule->{$self->key}->{override_process} && $self->local_rule->{$self->key}->{override_process} == 1){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->local_rule->{$self->key}{"override_process"} and $self->local_rule->{$self->key}{"override_process"} == 1
MC/DC0%0/2
exists $self->local_rule->{$self->key}{"override_process"} and $self->local_rule->{$self->key}{"override_process"} == 1
exists $self->local_rule->{$self->key}{"override_process"}
$self->local_rule->{$self->key}{"override_process"} == 1
Truth table0%0/3
A and B
A= exists $self->local_rule->{$self->key}{"override_process"}B= $self->local_rule->{$self->key}{"override_process"} == 1
| |||||||||||||||||||||||||||||
| 1271 | 0 | $self->override_process(1); | |||||||||||||||||||||||||||
| 1272 | } | ||||||||||||||||||||||||||||
| 1273 | else{ | ||||||||||||||||||||||||||||
| 1274 | 0 | $self->override_process(0); | |||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||
| 1277 | 0 | $self->local_attr(Data::Pairs->new([])); | |||||||||||||||||||||||||||
| 1278 | 0 | ▶ | if(exists $self->local_rule->{$self->key}->{local}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1279 | #$DB::single=2; | ||||||||||||||||||||||||||||
| 1280 | 0 | $self->local_attr(Data::Pairs->new(dclone($self->local_rule->{$self->key}->{local}))); | |||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||
| 1282 | #Make sure these aren't reset to global | ||||||||||||||||||||||||||||
| 1283 | ##YAY FOR TESTS | ||||||||||||||||||||||||||||
| 1284 | 0 | ▶ | $self->local_attr->set('outdir' => $self->outdir) unless $self->local_attr->exists('outdir'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1285 | 0 | ▶ | $self->local_attr->set('indir' => $self->indir) unless $self->local_attr->exists('indir'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||
| 1287 | 0 | $self->add_attr('local_attr'); | |||||||||||||||||||||||||||
| 1288 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1289 | 0 | $self->create_attr; | |||||||||||||||||||||||||||
| 1290 | 0 | ▶ | $self->get_samples if $self->resample; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||
| 1293 | =head2 add_attr | ||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||
| 1295 | Add the local attr onto the global attr | ||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||
| 1297 | =cut | ||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||
| 1299 | sub add_attr{ | ||||||||||||||||||||||||||||
| 1300 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
add_attr: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 1301 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||
| 1303 | 0 | my @keys = $self->$type->get_keys(); | |||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||
| 1305 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1306 | 0 | foreach my $key (@keys){ | |||||||||||||||||||||||||||
| 1307 | 0 | my($v) = $self->$type->get_values($key); | |||||||||||||||||||||||||||
| 1308 | 0 | $self->attr->set($key => $v); | |||||||||||||||||||||||||||
| 1309 | } | ||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||
| 1311 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1312 | } | ||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||
| 1314 | =head2 write_rule_meta | ||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||
| 1316 | =cut | ||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||
| 1318 | sub write_rule_meta{ | ||||||||||||||||||||||||||||
| 1319 | 0 | ▶ | my($self, $meta) = @_; | ||||||||||||||||||||||||||
|
Subroutine
write_rule_meta: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||
| 1321 | #Get rid of this, all meta should be in local: | ||||||||||||||||||||||||||||
| 1322 | #print "META IS $meta\n"; | ||||||||||||||||||||||||||||
| 1323 | #if(exists $self->local_rule->{$self->{key}}->{$meta}){ | ||||||||||||||||||||||||||||
| 1324 | ##$DB::single=2; | ||||||||||||||||||||||||||||
| 1325 | #print "\n$self->{comment_char}\n"; | ||||||||||||||||||||||||||||
| 1326 | #print "$self->{comment_char} ".$self->local_rule->{$self->key}->{$meta}."\n"; | ||||||||||||||||||||||||||||
| 1327 | #print "$self->{comment_char}\n\n"; | ||||||||||||||||||||||||||||
| 1328 | #} | ||||||||||||||||||||||||||||
| 1329 | #else{ | ||||||||||||||||||||||||||||
| 1330 | 0 | print "\n$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 1331 | #if($meta eq "before_meta"){ | ||||||||||||||||||||||||||||
| 1332 | #} | ||||||||||||||||||||||||||||
| 1333 | 0 | ▶ | if($meta eq "after_meta"){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1334 | 0 | print "$self->{comment_char} Ending $self->{key}\n"; | |||||||||||||||||||||||||||
| 1335 | } | ||||||||||||||||||||||||||||
| 1336 | 0 | print "$self->{comment_char}\n\n"; | |||||||||||||||||||||||||||
| 1337 | #} | ||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||
| 1339 | 0 | ▶ | return unless $meta eq "before_meta"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1340 | 0 | print "$self->{comment_char} Starting $self->{key}\n"; | |||||||||||||||||||||||||||
| 1341 | 0 | print "$self->{comment_char}\n\n"; | |||||||||||||||||||||||||||
| 1342 | 0 | ▶ | if($self->verbose){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1343 | 0 | print "\n\n$self->{comment_char}\n"; | |||||||||||||||||||||||||||
| 1344 | 0 | print "$self->{comment_char} Variables \n"; | |||||||||||||||||||||||||||
| 1345 | 0 | print "$self->{comment_char} Indir: ".$self->indir."\n"; | |||||||||||||||||||||||||||
| 1346 | 0 | print "$self->{comment_char} Outdir: ".$self->outdir."\n"; | |||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||
| 1348 | 0 | ▶ | if(exists $self->local_rule->{$self->key}->{local}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||
| 1350 | 0 | print "$self->{comment_char} Local Variables:\n"; | |||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||
| 1352 | 0 | ▶ | if($self->auto_input ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1353 | 0 | ▶ | $self->local_attr->set('OUTPUT' => $self->OUTPUT) if $self->has_OUTPUT; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1354 | 0 | ▶ | $self->local_attr->set('INPUT' => $self->global_attr->get_values('INPUT')) if $self->global_attr->exists('INPUT'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1355 | } | ||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||
| 1357 | 0 | my @keys = $self->local_attr->get_keys(); | |||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||
| 1359 | 0 | foreach my $k (@keys){ | |||||||||||||||||||||||||||
| 1360 | 0 | my($v) = $self->local_attr->get_values($k); | |||||||||||||||||||||||||||
| 1361 | 0 | print "$self->{comment_char}\t$k: ".$v."\n"; | |||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||
| 1365 | 0 | ▶ | if($self->resample){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1366 | 0 | print "$self->{comment_char} Resampling Samples: ",join(", ", @{$self->samples})."\n"; | |||||||||||||||||||||||||||
| 1367 | } | ||||||||||||||||||||||||||||
| 1368 | 0 | print "$self->{comment_char}\n\n"; | |||||||||||||||||||||||||||
| 1369 | } | ||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||
| 1371 | } | ||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||
| 1373 | =head3 write_process | ||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||
| 1375 | Fill in the template with the process | ||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||
| 1377 | =cut | ||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||
| 1379 | 2 | has 'pkey' => ( | |||||||||||||||||||||||||||
| 1380 | is => 'rw', | ||||||||||||||||||||||||||||
| 1381 | isa => 'Str|Undef', | ||||||||||||||||||||||||||||
| 1382 | predicate => 'has_pkey' | ||||||||||||||||||||||||||||
| 1383 | ); | ||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||
| 1385 | sub write_process{ | ||||||||||||||||||||||||||||
| 1386 | 0 | ▶ | my($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
write_process: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||
| 1388 | 0 | my($template, $tmp, $newprocess, $sample, $origout, $origin); | |||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||
| 1390 | 0 | $origout = $self->outdir; | |||||||||||||||||||||||||||
| 1391 | 0 | $origin = $self->indir; | |||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||
| 1393 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||
| 1395 | 0 | ▶ | if(!$self->override_process){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1396 | 0 | foreach my $sample (@{$self->samples}){ | |||||||||||||||||||||||||||
| 1397 | 0 | ▶ | $self->process_by_sample_outdir($sample) if $self->by_sample_outdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1398 | 0 | $self->eval_attr($sample); | |||||||||||||||||||||||||||
| 1399 | 0 | my $data = {self => \$self, sample => $sample}; | |||||||||||||||||||||||||||
| 1400 | 0 | $self->process_template($data); | |||||||||||||||||||||||||||
| 1401 | 0 | $self->outdir($origout); | |||||||||||||||||||||||||||
| 1402 | 0 | $self->indir($origin); | |||||||||||||||||||||||||||
| 1403 | } | ||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||
| 1405 | else{ | ||||||||||||||||||||||||||||
| 1406 | 0 | $self->eval_attr; | |||||||||||||||||||||||||||
| 1407 | 0 | my $data = {self => \$self}; | |||||||||||||||||||||||||||
| 1408 | 0 | $self->process_template($data); | |||||||||||||||||||||||||||
| 1409 | } | ||||||||||||||||||||||||||||
| 1410 | 0 | $DB::single = 2; | |||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||
| 1412 | 0 | ▶ | if($self->wait){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1413 | 0 | print "\nwait\n"; | |||||||||||||||||||||||||||
| 1414 | } | ||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||
| 1416 | 0 | $self->OUTPUT_to_INPUT; | |||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||
| 1418 | 0 | $self->pkey($self->key); | |||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||
| 1420 | #$self->outdir($origout); | ||||||||||||||||||||||||||||
| 1421 | #$self->indir($origin); | ||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||
| 1424 | =head3 process_by_sample_outdir | ||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||
| 1426 | Make sure indir/outdirs are named appropriated for samples when using by | ||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||
| 1428 | =cut | ||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||
| 1430 | sub process_by_sample_outdir { | ||||||||||||||||||||||||||||
| 1431 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
process_by_sample_outdir: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 1432 | 0 | my $sample = shift; | |||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||
| 1434 | 0 | my($tt, $key); | |||||||||||||||||||||||||||
| 1435 | 0 | $tt = $self->outdir; | |||||||||||||||||||||||||||
| 1436 | 0 | $key = $self->key; | |||||||||||||||||||||||||||
| 1437 | 0 | $tt =~ s/$key/$sample\/$key/; | |||||||||||||||||||||||||||
| 1438 | 0 | $self->outdir($tt); | |||||||||||||||||||||||||||
| 1439 | 0 | $self->make_outdir; | |||||||||||||||||||||||||||
| 1440 | 0 | $self->attr->set('outdir' => $self->outdir); | |||||||||||||||||||||||||||
| 1441 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||
| 1443 | 0 | $tt = $self->indir; | |||||||||||||||||||||||||||
| 1444 | 0 | ▶ | if($tt =~ m/\{\$self/){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 1445 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1446 | 0 | $tt = "$tt/{\$sample}"; | |||||||||||||||||||||||||||
| 1447 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||
| 1448 | } | ||||||||||||||||||||||||||||
| 1449 | elsif($self->has_pkey){ | ||||||||||||||||||||||||||||
| 1450 | 0 | $key = $self->pkey; | |||||||||||||||||||||||||||
| 1451 | 0 | $tt =~ s/$key/$sample\/$key/; | |||||||||||||||||||||||||||
| 1452 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||
| 1453 | } | ||||||||||||||||||||||||||||
| 1454 | else{ | ||||||||||||||||||||||||||||
| 1455 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1456 | 0 | $tt = "$tt/$sample"; | |||||||||||||||||||||||||||
| 1457 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||
| 1459 | 0 | $self->attr->set('indir' => $self->indir); | |||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||
| 1463 | =head3 OUTPUT_to_INPUT | ||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||
| 1465 | If we are using auto_input chain INPUT/OUTPUT | ||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||
| 1467 | =cut | ||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||
| 1469 | sub OUTPUT_to_INPUT { | ||||||||||||||||||||||||||||
| 1470 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
OUTPUT_to_INPUT: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 1471 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1472 | #Change the output to input | ||||||||||||||||||||||||||||
| 1473 | 0 | ▶ | if($self->auto_input && $self->local_attr->exists('OUTPUT')){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->auto_input and $self->local_attr->exists("OUTPUT")
MC/DC0%0/2
$self->auto_input and $self->local_attr->exists("OUTPUT")
$self->auto_input
$self->local_attr->exists("OUTPUT")
Truth table0%0/3
A and B
A= $self->auto_inputB= $self->local_attr->exists("OUTPUT")
| |||||||||||||||||||||||||||||
| 1474 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1475 | 0 | my($tmp, $indir, $outdir) = ($self->local_attr->get_values('OUTPUT'), $self->indir, $self->outdir); | |||||||||||||||||||||||||||
| 1476 | 0 | $tmp =~ s/{\$self->outdir}/{\$self->indir}/g; | |||||||||||||||||||||||||||
| 1477 | 0 | $self->INPUT($tmp); | |||||||||||||||||||||||||||
| 1478 | #This is not the best way of doing this.... | ||||||||||||||||||||||||||||
| 1479 | 0 | $self->global_attr->set(INPUT => $self->INPUT); | |||||||||||||||||||||||||||
| 1480 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1481 | } | ||||||||||||||||||||||||||||
| 1482 | else{ | ||||||||||||||||||||||||||||
| 1483 | 0 | $self->clear_OUTPUT(); | |||||||||||||||||||||||||||
| 1484 | } | ||||||||||||||||||||||||||||
| 1485 | } | ||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||
| 1487 | sub process_template{ | ||||||||||||||||||||||||||||
| 1488 | 0 | ▶ | my($self, $data) = @_; | ||||||||||||||||||||||||||
|
Subroutine
process_template: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||
| 1490 | 0 | my($tmp, $template); | |||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||
| 1492 | 0 | $template = $self->make_template($self->process); | |||||||||||||||||||||||||||
| 1493 | 0 | $DB::single=2; | |||||||||||||||||||||||||||
| 1494 | 0 | $template->fill_in(HASH => $data, OUTPUT => \*STDOUT); | |||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||
| 1496 | 0 | ▶ | $self->INPUT($self->local_attr->get_values('INPUT')) if $self->local_attr->exists('INPUT'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1497 | 0 | ▶ | $self->OUTPUT($self->local_attr->get_values('OUTPUT')) if $self->local_attr->exists('OUTPUT'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||
| 1499 | 0 | print "\n\n"; | |||||||||||||||||||||||||||
| 1500 | } | ||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||
| 1503 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||
| 1505 | 2 | 1; | |||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||
| 1507 | __END__ | ||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||
| 1510 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 1511 | |||||||||||||||||||||||||||||
| 1512 | BioX::Workflow - A very opinionated template based workflow writer. | ||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||
| 1514 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||
| 1516 | Jillian Rowe E<lt>jillian.e.rowe@gmail.comE<gt> | ||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||
| 1518 | =head1 Acknowledgements | ||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||
| 1520 | Before version 0.03 | ||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||
| 1522 | This module was originally developed at and for Weill Cornell Medical | ||||||||||||||||||||||||||||
| 1523 | College in Qatar within ITS Advanced Computing Team. With approval from | ||||||||||||||||||||||||||||
| 1524 | WCMC-Q, this information was generalized and put on github, for which | ||||||||||||||||||||||||||||
| 1525 | the authors would like to express their gratitude. | ||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||
| 1527 | As of version 0.03: | ||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||
| 1529 | This modules continuing development is supported by NYU Abu Dhabi in the Center for Genomics and Systems Biology. | ||||||||||||||||||||||||||||
| 1530 | With approval from NYUAD, this information was generalized and put on bitbucket, for which | ||||||||||||||||||||||||||||
| 1531 | the authors would like to express their gratitude. | ||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||
| 1533 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||
| 1535 | Copyright 2015- Weill Cornell Medical College in Qatar | ||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||
| 1537 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||
| 1539 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 1540 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||
| 1542 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||
| 1544 | =cut | ||||||||||||||||||||||||||||