|
1 |
| -if (params.reference{{param_id}} != null) { |
2 |
| - process bandage_{{pid}} { |
3 |
| - {% include "post.txt" ignore missing %} |
4 |
| - |
5 |
| - tag { sample_id } |
6 |
| - publishDir "reports/assembly/bandage_{{pid}}/$sample_id" |
7 |
| - |
8 |
| - input: |
9 |
| - set sample_id, file(assembly) from {{input_channel}} |
10 |
| - file reference from Channel.fromPath(params.reference{{param_id}}) |
11 |
| - |
12 |
| - output: |
13 |
| - file "*.png" |
14 |
| - file "*.svg" |
15 |
| - {% with task_name="bandage" %} |
16 |
| - {%- include "compiler_channels.txt" ignore missing -%} |
17 |
| - {% endwith %} |
18 |
| - |
19 |
| - script: |
20 |
| - """ |
21 |
| - time Bandage image $assembly ${assembly}.png >>.command.log 2>&1 |
22 |
| - time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1 |
23 |
| - time Bandage image $assembly ${assembly}.ref.png --query $reference >>.command.log 2>&1 |
24 |
| - time Bandage image $assembly ${assembly}.ref.svg --query $reference >>.command.log 2>&1 |
25 |
| - """ |
26 |
| - } |
27 |
| -} else { |
28 |
| - process bandage_{{pid}} { |
29 |
| - {% include "post.txt" ignore missing %} |
30 |
| - |
31 |
| - tag { sample_id } |
32 |
| - publishDir "reports/assembly/bandage_{{pid}}/$sample_id" |
33 |
| - |
34 |
| - input: |
35 |
| - set sample_id, file(assembly) from {{input_channel}} |
36 |
| - |
37 |
| - output: |
38 |
| - file "*.png" |
39 |
| - file "*.svg" |
40 |
| - {% with task_name="bandage" %} |
41 |
| - {%- include "compiler_channels.txt" ignore missing -%} |
42 |
| - {% endwith %} |
43 |
| - |
44 |
| - script: |
| 1 | +// True when a GFA secondary channel is connected to this component. |
| 2 | +has_gfa1_{{pid}} = binding.hasVariable('gfa1_{{pid}}') |
| 3 | + |
| 4 | +process bandage_{{pid}} { |
| 5 | + {% include "post.txt" ignore missing %} |
| 6 | + |
| 7 | + tag { sample_id } |
| 8 | + publishDir "reports/assembly/bandage_{{pid}}/$sample_id" |
| 9 | + |
| 10 | + input: |
| 11 | + set sample_id, file(fasta) from {{input_channel}} |
| 12 | + file gfa1 from has_gfa1_{{pid}} ? gfa1_{{pid}} : Channel.value("NA") |
| 13 | + file reference from params.reference{{param_id}} ? |
| 14 | + Channel.fromPath(params.reference{{param_id}}) : |
| 15 | + Channel.value("NA") |
| 16 | + |
| 17 | + output: |
| 18 | + file "*.png" |
| 19 | + file "*.svg" |
| 20 | + {% with task_name="bandage" %} |
| 21 | + {%- include "compiler_channels.txt" ignore missing -%} |
| 22 | + {% endwith %} |
| 23 | + |
| 24 | + script: |
| 25 | + // Use the GFA assembly when available and FASTA otherwise. |
| 26 | + assembly = has_gfa1_{{pid}} ? gfa1 : fasta |
| 27 | + command = |
45 | 28 | """
|
46 | 29 | time Bandage image $assembly ${assembly}.png >>.command.log 2>&1
|
47 | 30 | time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1
|
48 | 31 | """
|
49 |
| - } |
| 32 | + if (params.reference{{param_id}}) |
| 33 | + command += |
| 34 | + """ |
| 35 | + time Bandage image $assembly ${assembly}.ref.png --query $reference >>.command.log 2>&1 |
| 36 | + time Bandage image $assembly ${assembly}.ref.svg --query $reference >>.command.log 2>&1 |
| 37 | + """ |
| 38 | + command |
50 | 39 | }
|
0 commit comments