Skip to content

Commit

Permalink
Merge branch 'master' into nf-test/legsta
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp authored Sep 5, 2024
2 parents 711a42c + c1b71e1 commit 718fded
Show file tree
Hide file tree
Showing 108 changed files with 4,235 additions and 1,412 deletions.
11 changes: 3 additions & 8 deletions modules/environment-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
},
"channels": {
"type": "array",
"items": [
{
"enum": ["conda-forge"]
},
{
"enum": ["bioconda"]
}
],
"items": {
"enum": ["bioconda", "conda-forge"]
},
"minItems": 2
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion modules/nf-core/bcftools/merge/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ name: bcftools_merge
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::bcftools=1.20
23 changes: 16 additions & 7 deletions modules/nf-core/bcftools/merge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ process BCFTOOLS_MERGE {
tuple val(meta), path(vcfs), path(tbis)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)
path(bed)
tuple val(meta4), path(bed)

output:
tuple val(meta), path("*.{bcf,vcf}{,.gz}"), emit: merged_variants
tuple val(meta), path("*.{bcf,vcf}{,.gz}"), emit: vcf
tuple val(meta), path("*.{csi,tbi}") , emit: index, 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}"

def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def input = vcfs.sort{ it.name }
def regions = bed ? "--regions-file $bed" : ""
def extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" :
args.contains("--output-type u") || args.contains("-Ou") ? "bcf" :
Expand All @@ -37,7 +38,7 @@ process BCFTOOLS_MERGE {
$regions \\
--threads $task.cpus \\
--output ${prefix}.${extension} \\
$vcfs
$input
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -53,8 +54,16 @@ process BCFTOOLS_MERGE {
args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" :
args.contains("--output-type v") || args.contains("-Ov") ? "vcf" :
"vcf"
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" :
""
def create_cmd = extension.endsWith(".gz") ? "echo '' | gzip >" : "touch"
def create_index = extension.endsWith(".gz") && index.matches("csi|tbi") ? "touch ${prefix}.${extension}.${index}" : ""

"""
touch ${prefix}.${extension}
${create_cmd} ${prefix}.${extension}
${create_index}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
23 changes: 10 additions & 13 deletions modules/nf-core/bcftools/merge/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ input:
type: file
description: "(Optional) The fasta reference file index (only necessary for the `--gvcf FILE` parameter)"
pattern: "*.fai"
- meta4:
type: map
description: |
Groovy Map containing bed information
e.g. [ id:'genome' ]
- bed:
type: file
description: "(Optional) The bed regions to merge on"
Expand All @@ -56,22 +61,14 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf_gz:
type: file
description: VCF merged output file (bgzipped) => when `--output-type z` is used
pattern: "*.vcf.gz"
- vcf:
type: file
description: VCF merged output file => when `--output-type v` is used
pattern: "*.vcf"
- bcf_gz:
type: file
description: BCF merged output file (bgzipped) => when `--output-type b` is used
pattern: "*.bcf.gz"
- bcf:
description: merged output file
pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}"
- index:
type: file
description: BCF merged output file => when `--output-type u` is used
pattern: "*.bcf"
description: index of merged output
pattern: "*.{csi,tbi}"
- versions:
type: file
description: File containing software versions
Expand Down
3 changes: 3 additions & 0 deletions modules/nf-core/bcftools/merge/tests/bcf.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
process {
ext.args = '--output-type u --no-version'
}
3 changes: 3 additions & 0 deletions modules/nf-core/bcftools/merge/tests/bcf_gz.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
process {
ext.args = '--output-type b --no-version'
}
Loading

0 comments on commit 718fded

Please sign in to comment.