Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yumisims authored Sep 26, 2024
2 parents b35388a + a90a886 commit 396a427
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 128 deletions.
16 changes: 10 additions & 6 deletions modules/nf-core/bcftools/concat/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ process BCFTOOLS_CONCAT {
tuple val(meta), path(vcfs), path(tbi)

output:
tuple val(meta), path("*.gz") , emit: vcf
tuple val(meta), path("*.tbi"), emit: tbi, optional: true
tuple val(meta), path("*.csi"), emit: csi, optional: true
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf
tuple val(meta), path("${prefix}.vcf.gz.tbi"), emit: tbi, optional: true
tuple val(meta), path("${prefix}.vcf.gz.csi"), emit: csi, optional: true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"
def tbi_names = tbi.findAll { file -> !(file instanceof List) }.collect { file -> file.name }
def create_input_index = vcfs.collect { vcf -> tbi_names.contains(vcf.name + ".tbi") ? "" : "tabix ${vcf}" }.join("\n ")
"""
${create_input_index}
bcftools concat \\
--output ${prefix}.vcf.gz \\
$args \\
Expand All @@ -37,7 +41,7 @@ process BCFTOOLS_CONCAT {

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"
def index = args.contains("--write-index=tbi") || args.contains("-W=tbi") ? "tbi" :
args.contains("--write-index=csi") || args.contains("-W=csi") ? "csi" :
args.contains("--write-index") || args.contains("-W") ? "csi" :
Expand Down
27 changes: 18 additions & 9 deletions modules/nf-core/bcftools/concat/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,38 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.gz":
type: file
description: VCF concatenated output file
pattern: "*.{vcf.gz}"
- ${prefix}.vcf.gz:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "*.{vcf.gz}"
- tbi:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.tbi":
type: file
description: Alternative VCF file index
pattern: "*.tbi"
- ${prefix}.vcf.gz.tbi:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "*.tbi"
- csi:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.csi":
type: file
description: Default VCF file index
pattern: "*.csi"
- ${prefix}.vcf.gz.csi:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "*.csi"
- versions:
- versions.yml:
Expand Down
18 changes: 9 additions & 9 deletions modules/nf-core/bcftools/concat/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ nextflow_process {
tag "bcftools/concat"


test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]]") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]]") {

config "./nextflow.config"

Expand Down Expand Up @@ -41,7 +41,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index") {

config "./vcf_gz_index.config"

Expand Down Expand Up @@ -78,7 +78,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_csi") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_csi") {

config "./vcf_gz_index_csi.config"

Expand Down Expand Up @@ -115,7 +115,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_tbi") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_tbi") {

config "./vcf_gz_index_tbi.config"

Expand Down Expand Up @@ -153,7 +153,7 @@ nextflow_process {
}


test("sarscov2 - [[vcf1, vcf2], []]") {
test("homo_sapiens - [[vcf1, vcf2], []]") {

config "./nextflow.config"

Expand Down Expand Up @@ -181,7 +181,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - stub") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - stub") {

config "./nextflow.config"
options "-stub"
Expand Down Expand Up @@ -213,7 +213,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index - stub") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index - stub") {

config "./vcf_gz_index.config"
options "-stub"
Expand Down Expand Up @@ -246,7 +246,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_csi - stub") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_csi - stub") {

config "./vcf_gz_index_csi.config"
options "-stub"
Expand Down Expand Up @@ -279,7 +279,7 @@ nextflow_process {

}

test("sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_tbi - stub") {
test("homo_sapiens - [[vcf1, vcf2], [tbi1, tbi2]] - vcf_gz_index_tbi - stub") {

config "./vcf_gz_index_tbi.config"
options "-stub"
Expand Down
Loading

0 comments on commit 396a427

Please sign in to comment.