Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/local/fastqvalidator/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
# TODO nf-core: List required Conda package(s).
# Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
# For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
- "YOUR-TOOL-HERE"
55 changes: 55 additions & 0 deletions modules/local/fastqvalidator/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
process FASTQ_VALIDATOR {
tag "${sampleName}"
// tag "$meta.id"
label 'process_medium'

input:
tuple val(sampleName), path(sampleRead)
val ready


// tuple val(meta), path(sampleRead)



output:
path("*.fastq_report.csv") , emit: fastq_report
tuple val(sampleName), path(sampleRead) , emit: reads

// tuple val(meta), path("*.bam") , emit: bam
// 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}"

"""
fastqvalidator \\
$args \\
-@ $task.cpus \\
-o ${prefix}.bam \\
$bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
fastqvalidator: \$(fastqvalidator --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${sampleRead.simpleName}.check.csv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
fastqvalidator: \$(fastqvalidator --version)
END_VERSIONS
"""
}
68 changes: 68 additions & 0 deletions modules/local/fastqvalidator/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "fastqvalidator"
## TODO nf-core: Add a description of the module and list keywords
description: write your description here
keywords:
- sort
- example
- genomics
tools:
- "fastqvalidator":
## TODO nf-core: Add a description and other details for the software below
description: ""
homepage: ""
documentation: ""
tool_dev_url: ""
doi: ""
licence:
identifier: biotools:fastqvalidator

## TODO nf-core: Add a description of all of the variables used as input
input:
# Only when we have meta
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`

## TODO nf-core: Delete / customise this example input
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
ontologies:
- edam: "http://edamontology.org/format_2572" # BAM
- edam: "http://edamontology.org/format_2573" # CRAM
- edam: "http://edamontology.org/format_3462" # SAM

## TODO nf-core: Add a description of all of the variables used as output
output:
- bam:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
## TODO nf-core: Delete / customise this example output
- "*.bam":
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
ontologies:
- edam: "http://edamontology.org/format_2572" # BAM
- edam: "http://edamontology.org/format_2573" # CRAM
- edam: "http://edamontology.org/format_3462" # SAM

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@abhi18av"
maintainers:
- "@abhi18av"
73 changes: 73 additions & 0 deletions modules/local/fastqvalidator/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test fastqvalidator
nextflow_process {

name "Test Process FASTQVALIDATOR"
script "../main.nf"
process "FASTQVALIDATOR"

tag "modules"
tag "modules_"
tag "fastqvalidator"

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used
test("sarscov2 - bam") {

// TODO nf-core: If you are created a test for a chained module
// (the module requires running more than one process to generate the required output)
// add the 'setup' method here.
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).

when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:

input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
// See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples.
)
}

}

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix.
test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:

input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
)
}

}

}
7 changes: 7 additions & 0 deletions modules/nf-core/bcftools/merge/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::bcftools=1.21
74 changes: 74 additions & 0 deletions modules/nf-core/bcftools/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
process BCFTOOLS_MERGE {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5a/5acacb55c52bec97c61fd34ffa8721fce82ce823005793592e2a80bf71632cd0/data':
'community.wave.seqera.io/library/bcftools:1.21--4335bec1d7b44d11' }"

input:
tuple val(meta), path(vcfs), path(tbis)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)
tuple val(meta4), path(bed)

output:
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 input = (vcfs.collect().size() > 1) ? vcfs.sort{ it.name } : vcfs
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" :
args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" :
args.contains("--output-type v") || args.contains("-Ov") ? "vcf" :
"vcf"

"""
bcftools merge \\
$args \\
$regions \\
--threads $task.cpus \\
--output ${prefix}.${extension} \\
$input

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" :
args.contains("--output-type u") || args.contains("-Ou") ? "bcf" :
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}" : ""

"""
${create_cmd} ${prefix}.${extension}
${create_index}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}
96 changes: 96 additions & 0 deletions modules/nf-core/bcftools/merge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: bcftools_merge
description: Merge VCF files
keywords:
- variant calling
- merge
- VCF
tools:
- merge:
description: |
Merge VCF files.
homepage: http://samtools.github.io/bcftools/bcftools.html
documentation: http://www.htslib.org/doc/bcftools.html
doi: 10.1093/bioinformatics/btp352
licence: ["MIT"]
identifier: biotools:bcftools
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcfs:
type: file
description: |
List containing 2 or more vcf files
e.g. [ 'file1.vcf', 'file2.vcf' ]
- tbis:
type: file
description: |
List containing the tbi index files corresponding to the vcfs input files
e.g. [ 'file1.vcf.tbi', 'file2.vcf.tbi' ]
- - meta2:
type: map
description: |
Groovy Map containing reference information
e.g. [ id:'genome' ]
- fasta:
type: file
description: "(Optional) The fasta reference file (only necessary for the `--gvcf
FILE` parameter)"
pattern: "*.{fasta,fa}"
- - meta3:
type: map
description: |
Groovy Map containing reference information
e.g. [ id:'genome' ]
- fai:
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"
pattern: "*.bed"
output:
- vcf:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.{bcf,vcf}{,.gz}":
type: file
description: merged output file
pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}"
- index:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.{csi,tbi}":
type: file
description: index of merged output
pattern: "*.{csi,tbi}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"
- "@nvnieuwk"
- "@ramprasadn"
maintainers:
- "@joseespinosa"
- "@drpatelh"
- "@nvnieuwk"
- "@ramprasadn"
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