mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
add tests
This commit is contained in:
parent
c70b169f61
commit
2542c9d176
10 changed files with 148 additions and 158 deletions
|
@ -1,75 +0,0 @@
|
|||
// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :)
|
||||
// https://github.com/nf-core/modules/tree/master/modules
|
||||
// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace:
|
||||
// https://nf-co.re/join
|
||||
// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters.
|
||||
// All other parameters MUST be provided using the "task.ext" directive, see here:
|
||||
// https://www.nextflow.io/docs/latest/process.html#ext
|
||||
// where "task.ext" is a string.
|
||||
// Any parameters that need to be evaluated in the context of a particular sample
|
||||
// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately.
|
||||
// TODO nf-core: Software that can be piped together SHOULD be added to separate module files
|
||||
// unless there is a run-time, storage advantage in implementing in this way
|
||||
// e.g. it's ok to have a single module for bwa to output BAM instead of SAM:
|
||||
// bwa mem | samtools view -B -T ref.fasta
|
||||
// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty
|
||||
// list (`[]`) instead of a file can be used to work around this issue.
|
||||
|
||||
process BCFTOOLS_RHOCALL {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
// 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.
|
||||
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.15.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.15.1--h0ea216a_0':
|
||||
'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }"
|
||||
|
||||
input:
|
||||
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
|
||||
// MUST be provided as an input via a Groovy Map called "meta".
|
||||
// This information may not be required in some instances e.g. indexing reference genome files:
|
||||
// https://github.com/nf-core/modules/blob/master/modules/bwa/index/main.nf
|
||||
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
|
||||
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
|
||||
tuple val(meta), path(bam)
|
||||
|
||||
output:
|
||||
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
// TODO nf-core: List additional required output channels/values here
|
||||
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}"
|
||||
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
|
||||
// If the software is unable to output a version number on the command-line then it can be manually specified
|
||||
// e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf
|
||||
// Each software used MUST provide the software name and version number in the YAML version file (versions.yml)
|
||||
// TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive
|
||||
// TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter
|
||||
// using the Nextflow "task" variable e.g. "--threads $task.cpus"
|
||||
// TODO nf-core: Please replace the example samtools command below with your module's command
|
||||
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
|
||||
"""
|
||||
samtools \\
|
||||
sort \\
|
||||
$args \\
|
||||
-@ $task.cpus \\
|
||||
-o ${prefix}.bam \\
|
||||
-T $prefix \\
|
||||
$bam
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
name: "bcftools_rhocall"
|
||||
## TODO nf-core: Add a description of the module and list keywords
|
||||
description: write your description here
|
||||
keywords:
|
||||
- sort
|
||||
tools:
|
||||
- "bcftools":
|
||||
## TODO nf-core: Add a description and other details for the software below
|
||||
description: "BCFtools is a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. Most commands accept VCF, bgzipped VCF and BCF with filetype detected automatically even when streaming from a pipe. Indexed VCF and BCF will work in all situations. Un-indexed VCF and BCF and streams will work in most, but not all situations."
|
||||
homepage: "None"
|
||||
documentation: "None"
|
||||
tool_dev_url: "None"
|
||||
doi: ""
|
||||
licence: "['GPL']"
|
||||
|
||||
## 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:'test', single_end:false ]
|
||||
#
|
||||
## TODO nf-core: Delete / customise this example input
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
|
||||
## TODO nf-core: Add a description of all of the variables used as output
|
||||
output:
|
||||
#Only when we have meta
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
#
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
## TODO nf-core: Delete / customise this example output
|
||||
- bam:
|
||||
type: file
|
||||
description: Sorted BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
|
||||
authors:
|
||||
- "@ramprasadn"
|
61
modules/bcftools/roh/main.nf
Normal file
61
modules/bcftools/roh/main.nf
Normal file
|
@ -0,0 +1,61 @@
|
|||
process BCFTOOLS_ROH {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.15.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.15.1--h0ea216a_0':
|
||||
'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf), path(tbi)
|
||||
path af_file
|
||||
path genetic_map
|
||||
path regions_file
|
||||
path samples_file
|
||||
path targets_file
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.roh"), emit: roh
|
||||
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 af_read = af_file ? "--AF-file ${af_file}" : ''
|
||||
def gen_map = genetic_map ? "--genetic-map ${genetic_map}" : ''
|
||||
def reg_file = regions_file ? "--regions-file ${regions_file}" : ''
|
||||
def samp_file = samples_file ? "--samples-file ${samples_file}" : ''
|
||||
def targ_file = targets_file ? "--targets-file ${targets_file}" : ''
|
||||
"""
|
||||
bcftools \\
|
||||
roh \\
|
||||
$args \\
|
||||
$af_read \\
|
||||
$gen_map \\
|
||||
$reg_file \\
|
||||
$samp_file \\
|
||||
$targ_file \\
|
||||
-o ${prefix}.roh.gz \\
|
||||
$vcf
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
|
||||
stub:
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
touch ${prefix}.roh
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
56
modules/bcftools/roh/meta.yml
Normal file
56
modules/bcftools/roh/meta.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
name: "bcftools_roh"
|
||||
## TODO nf-core: Add a description of the module and list keywords
|
||||
description: write your description here
|
||||
keywords:
|
||||
- sort
|
||||
tools:
|
||||
- "roh":
|
||||
description: "A program for detecting runs of homo/autozygosity. Only bi-allelic sites are considered."
|
||||
homepage: https://www.htslib.org/
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ["MIT"]
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF file
|
||||
pattern: "*.{vcf,.vcf.gz}"
|
||||
- af_file:
|
||||
type: file
|
||||
description: "Read allele frequencies from a tab-delimited file containing the columns: CHROM\tPOS\tREF,ALT\tAF."
|
||||
- genetic_map:
|
||||
type: file
|
||||
description: "Genetic map in the format required also by IMPUTE2."
|
||||
- regions_file:
|
||||
type: file
|
||||
description: "Regions can be specified either on command line or in a VCF, BED, or tab-delimited file (the default)."
|
||||
- samples_file:
|
||||
type: file
|
||||
description: "File of sample names to include or exclude if prefixed with '^'."
|
||||
- targets_file:
|
||||
type: file
|
||||
description: "Targets can be specified either on command line or in a VCF, BED, or tab-delimited file (the default)."
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- roh:
|
||||
type: file
|
||||
description: Contains site-specific and/or per-region runs of homo/autozygosity calls.
|
||||
pattern: "*.{roh}"
|
||||
|
||||
authors:
|
||||
- "@ramprasadn"
|
|
@ -166,9 +166,9 @@ bcftools/reheader:
|
|||
- modules/bcftools/reheader/**
|
||||
- tests/modules/bcftools/reheader/**
|
||||
|
||||
bcftools/rhocall:
|
||||
- modules/bcftools/rhocall/**
|
||||
- tests/modules/bcftools/rhocall/**
|
||||
bcftools/roh:
|
||||
- modules/bcftools/roh/**
|
||||
- tests/modules/bcftools/roh/**
|
||||
|
||||
bcftools/sort:
|
||||
- modules/bcftools/sort/**
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { BCFTOOLS_RHOCALL } from '../../../../modules/bcftools/rhocall/main.nf'
|
||||
|
||||
workflow test_bcftools_rhocall {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||
]
|
||||
|
||||
BCFTOOLS_RHOCALL ( input )
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
## TODO nf-core: Please run the following command to build this file:
|
||||
# nf-core modules create-test-yml bcftools/rhocall
|
||||
- name: "bcftools rhocall"
|
||||
command: nextflow run ./tests/modules/bcftools/rhocall -entry test_bcftools_rhocall -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/rhocall/nextflow.config
|
||||
tags:
|
||||
- "bcftools"
|
||||
#
|
||||
- "bcftools/rhocall"
|
||||
#
|
||||
files:
|
||||
- path: "output/bcftools/test.bam"
|
||||
md5sum: e667c7caad0bc4b7ac383fd023c654fc
|
||||
- path: output/bcftools/versions.yml
|
||||
md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b
|
20
tests/modules/bcftools/roh/main.nf
Normal file
20
tests/modules/bcftools/roh/main.nf
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { BCFTOOLS_ROH } from '../../../../modules/bcftools/roh/main.nf'
|
||||
|
||||
workflow test_bcftools_roh {
|
||||
|
||||
input = [ [ id:'out' ], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)]
|
||||
|
||||
af_file = []
|
||||
gen_map = []
|
||||
regions = []
|
||||
targets = []
|
||||
samples = []
|
||||
|
||||
BCFTOOLS_ROH ( input, af_file, gen_map, regions, samples, targets )
|
||||
}
|
8
tests/modules/bcftools/roh/test.yml
Normal file
8
tests/modules/bcftools/roh/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: "bcftools roh"
|
||||
command: nextflow run ./tests/modules/bcftools/roh -entry test_bcftools_roh -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/roh/nextflow.config
|
||||
tags:
|
||||
- "bcftools"
|
||||
- "bcftools/rhoh"
|
||||
files:
|
||||
- path: "output/bcftools/test.roh"
|
||||
- path: output/bcftools/versions.yml
|
Loading…
Reference in a new issue