mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2025-01-18 02:46:13 -05:00
make use of dependent on input array size
This commit is contained in:
parent
a6e7ecb3a3
commit
413980e93a
1 changed files with 12 additions and 9 deletions
|
@ -9,7 +9,6 @@ process BAMTOOLS_SPLIT {
|
||||||
|
|
||||||
input:
|
input:
|
||||||
tuple val(meta), path(bam)
|
tuple val(meta), path(bam)
|
||||||
path(bam_list)
|
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.bam"), emit: bam
|
tuple val(meta), path("*.bam"), emit: bam
|
||||||
|
@ -21,18 +20,22 @@ process BAMTOOLS_SPLIT {
|
||||||
script:
|
script:
|
||||||
def args = task.ext.args ?: ''
|
def args = task.ext.args ?: ''
|
||||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||||
|
|
||||||
def input_list = bam.collect{"-in $it"}.join(' ')
|
def input_list = bam.collect{"-in $it"}.join(' ')
|
||||||
if (bam_list) {
|
def stub_cmd = !args.contains("-stub") : " -stub ${prefix}" : ""
|
||||||
input_list += " -list $bam_list"
|
|
||||||
}
|
if (size(bam) > 1){
|
||||||
if (!args.contains("-stub")) {
|
def bamtools_merge_cmd = "bamtools merge ${input_list} |"
|
||||||
args += " -stub ${prefix}"
|
} else {
|
||||||
|
def split_input = input_list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
bamtools merge \\
|
${bamtools_merge_cmd} \\
|
||||||
${input_list} \\
|
bamtools split \\
|
||||||
| bamtools split \\
|
$split_input \\
|
||||||
|
$stub_cmd \\
|
||||||
$args
|
$args
|
||||||
|
|
||||||
cat <<-END_VERSIONS > versions.yml
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
|
Loading…
Add table
Reference in a new issue