|
| 1 | +if (params.reference{{param_id}} == null && params.genomeSizeBp{{param_id}} == null) |
| 2 | + exit 1, "Specify at least one of reference or genomeSizeBp" |
| 3 | +if (params.reference{{param_id}} != null && params.genomeSizeBp{{param_id}} != null) |
| 4 | + exit 1, "Specify only one of reference or genomeSizeBp" |
| 5 | + |
| 6 | +if (params.reference{{param_id}} != null) { |
| 7 | + process quast_{{pid}} { |
| 8 | + {% include "post.txt" ignore missing %} |
| 9 | + |
| 10 | + tag { sample_id } |
| 11 | + publishDir "results/assembly/quast_{{pid}}/$sample_id", pattern: "*.tsv" |
| 12 | + publishDir "reports/assembly/quast_{{pid}}/$sample_id" |
| 13 | + |
| 14 | + input: |
| 15 | + set sample_id, file(assembly) from {{input_channel}} |
| 16 | + file reference from Channel.fromPath(params.reference{{param_id}}) |
| 17 | + |
| 18 | + output: |
| 19 | + file "*" |
| 20 | + {% with task_name="quast" %} |
| 21 | + {%- include "compiler_channels.txt" ignore missing -%} |
| 22 | + {% endwith %} |
| 23 | + |
| 24 | + script: |
| 25 | + "/usr/bin/time -v quast -o . -r $reference -s $assembly -l $sample_id -t $task.cpus >> .command.log 2>&1" |
| 26 | + } |
| 27 | +} else if (params.genomeSizeBp{{param_id}} != null) { |
| 28 | + process quast_{{pid}} { |
| 29 | + {% include "post.txt" ignore missing %} |
| 30 | + |
| 31 | + tag { sample_id } |
| 32 | + publishDir "results/assembly/quast_{{pid}}/$sample_id", pattern: "*.tsv" |
| 33 | + publishDir "reports/assembly/quast_{{pid}}/$sample_id" |
| 34 | + |
| 35 | + input: |
| 36 | + set sample_id, file(assembly) from {{input_channel}} |
| 37 | + val genomeSizeBp from Channel.value(params.genomeSizeBp{{param_id}}) |
| 38 | + |
| 39 | + output: |
| 40 | + file "*" |
| 41 | + {% with task_name="quast" %} |
| 42 | + {%- include "compiler_channels.txt" ignore missing -%} |
| 43 | + {% endwith %} |
| 44 | + |
| 45 | + script: |
| 46 | + "/usr/bin/time -v quast -o . --est-ref-size=$genomeSizeBp -s $assembly -l $sample_id -t $task.cpus >> .command.log 2>&1" |
| 47 | + } |
| 48 | +} |
0 commit comments