mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
commit
4703a60443
18 changed files with 161096 additions and 0 deletions
8
.github/filters.yml
vendored
8
.github/filters.yml
vendored
|
@ -100,6 +100,14 @@ bwamem2_mem:
|
|||
- software/bwamem2/mem/**
|
||||
- tests/software/bwamem2/mem/**
|
||||
|
||||
bwameth_align:
|
||||
- software/bwameth/align/**
|
||||
- tests/software/bwameth/align/**
|
||||
|
||||
bwameth_index:
|
||||
- software/bwameth/index/**
|
||||
- tests/software/bwameth/index/**
|
||||
|
||||
cat_fastq:
|
||||
- software/cat/fastq/**
|
||||
- tests/software/cat/fastq/**
|
||||
|
|
59
software/bwameth/align/functions.nf
Normal file
59
software/bwameth/align/functions.nf
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* -----------------------------------------------------
|
||||
* Utility functions used in nf-core DSL2 module files
|
||||
* -----------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extract name of software tool from process name using $task.process
|
||||
*/
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||
*/
|
||||
def initOptions(Map args) {
|
||||
def Map options = [:]
|
||||
options.args = args.args ?: ''
|
||||
options.args2 = args.args2 ?: ''
|
||||
options.publish_by_id = args.publish_by_id ?: false
|
||||
options.publish_dir = args.publish_dir ?: ''
|
||||
options.publish_files = args.publish_files
|
||||
options.suffix = args.suffix ?: ''
|
||||
return options
|
||||
}
|
||||
|
||||
/*
|
||||
* Tidy up and join elements of a list to return a path string
|
||||
*/
|
||||
def getPathFromList(path_list) {
|
||||
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||
return paths.join('/')
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to save/publish module results
|
||||
*/
|
||||
def saveFiles(Map args) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
if (ioptions.publish_by_id) {
|
||||
path_list.add(args.publish_id)
|
||||
}
|
||||
if (ioptions.publish_files instanceof Map) {
|
||||
for (ext in ioptions.publish_files) {
|
||||
if (args.filename.endsWith(ext.key)) {
|
||||
def ext_list = path_list.collect()
|
||||
ext_list.add(ext.value)
|
||||
return "${getPathFromList(ext_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
} else if (ioptions.publish_files == null) {
|
||||
return "${getPathFromList(path_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
}
|
46
software/bwameth/align/main.nf
Normal file
46
software/bwameth/align/main.nf
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
def options = initOptions(params.options)
|
||||
|
||||
process BWAMETH_ALIGN {
|
||||
tag "$meta.id"
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bwameth=0.2.2" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bwameth:0.20--py35_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bwameth:0.20--py35_0"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(reads)
|
||||
path index
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
||||
"""
|
||||
INDEX=`find -L ${index} -name "*.bwameth.c2t" | sed 's/.bwameth.c2t//'`
|
||||
|
||||
bwameth.py \\
|
||||
$options.args \\
|
||||
$read_group \\
|
||||
-t $task.cpus \\
|
||||
--reference \$INDEX \\
|
||||
$reads \\
|
||||
| samtools view $options.args2 -@ $task.cpus -bhS -o ${prefix}.bam -
|
||||
|
||||
echo \$(bwameth.py --version 2>&1) | cut -f2 -d" " > ${software}.version.txt
|
||||
"""
|
||||
}
|
72
software/bwameth/align/meta.yml
Normal file
72
software/bwameth/align/meta.yml
Normal file
|
@ -0,0 +1,72 @@
|
|||
name: bwameth_align
|
||||
description: Performs alignment of BS-Seq reads using bwameth
|
||||
keywords:
|
||||
- bwameth
|
||||
- alignment
|
||||
- 3-letter genome
|
||||
- map
|
||||
- methylation
|
||||
- 5mC
|
||||
- methylseq
|
||||
- bisulphite
|
||||
- fastq
|
||||
- bam
|
||||
tools:
|
||||
- bwameth:
|
||||
description: |
|
||||
Fast and accurate alignment of BS-Seq reads
|
||||
using bwa-mem and a 3-letter genome.
|
||||
homepage: https://github.com/brentp/bwa-meth
|
||||
documentation: https://github.com/brentp/bwa-meth
|
||||
arxiv: arXiv:1401.1129
|
||||
params:
|
||||
- outdir:
|
||||
type: string
|
||||
description: |
|
||||
The pipeline's output directory. By default, the module will
|
||||
output files into `$params.outdir/<SOFTWARE>`
|
||||
- publish_dir_mode:
|
||||
type: string
|
||||
description: |
|
||||
Value for the Nextflow `publishDir` mode parameter.
|
||||
Available: symlink, rellink, link, copy, copyNoFollow, move.
|
||||
- enable_conda:
|
||||
type: boolean
|
||||
description: |
|
||||
Run the module with Conda using the software specified
|
||||
via the `conda` directive
|
||||
- singularity_pull_docker_container:
|
||||
type: boolean
|
||||
description: |
|
||||
Instead of directly downloading Singularity images for use with Singularity,
|
||||
force the workflow to pull and convert Docker containers instead.
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- reads:
|
||||
type: file
|
||||
description: |
|
||||
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
|
||||
respectively.
|
||||
- index:
|
||||
type: dir
|
||||
description: Directory containing bwameth genome index
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: Output BAM file containing read alignments
|
||||
pattern: "*.{bam}"
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
authors:
|
||||
- "@phue"
|
59
software/bwameth/index/functions.nf
Normal file
59
software/bwameth/index/functions.nf
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* -----------------------------------------------------
|
||||
* Utility functions used in nf-core DSL2 module files
|
||||
* -----------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extract name of software tool from process name using $task.process
|
||||
*/
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||
*/
|
||||
def initOptions(Map args) {
|
||||
def Map options = [:]
|
||||
options.args = args.args ?: ''
|
||||
options.args2 = args.args2 ?: ''
|
||||
options.publish_by_id = args.publish_by_id ?: false
|
||||
options.publish_dir = args.publish_dir ?: ''
|
||||
options.publish_files = args.publish_files
|
||||
options.suffix = args.suffix ?: ''
|
||||
return options
|
||||
}
|
||||
|
||||
/*
|
||||
* Tidy up and join elements of a list to return a path string
|
||||
*/
|
||||
def getPathFromList(path_list) {
|
||||
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||
return paths.join('/')
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to save/publish module results
|
||||
*/
|
||||
def saveFiles(Map args) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
if (ioptions.publish_by_id) {
|
||||
path_list.add(args.publish_id)
|
||||
}
|
||||
if (ioptions.publish_files instanceof Map) {
|
||||
for (ext in ioptions.publish_files) {
|
||||
if (args.filename.endsWith(ext.key)) {
|
||||
def ext_list = path_list.collect()
|
||||
ext_list.add(ext.value)
|
||||
return "${getPathFromList(ext_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
} else if (ioptions.publish_files == null) {
|
||||
return "${getPathFromList(path_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
}
|
35
software/bwameth/index/main.nf
Normal file
35
software/bwameth/index/main.nf
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
def options = initOptions(params.options)
|
||||
|
||||
process BWAMETH_INDEX {
|
||||
tag "$fasta"
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bwameth=0.2.2" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bwameth:0.20--py35_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bwameth:0.20--py35_0"
|
||||
}
|
||||
|
||||
input:
|
||||
path fasta, stageAs: "bwameth/*"
|
||||
|
||||
output:
|
||||
path "bwameth" , emit: index
|
||||
path "*.version.txt", emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
"""
|
||||
bwameth.py index $fasta
|
||||
|
||||
echo \$(bwameth.py --version 2>&1) | cut -f2 -d" " > ${software}.version.txt
|
||||
"""
|
||||
}
|
53
software/bwameth/index/meta.yml
Normal file
53
software/bwameth/index/meta.yml
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: bwameth_index
|
||||
description: Performs indexing of c2t converted reference genome
|
||||
keywords:
|
||||
- bwameth
|
||||
- 3-letter genome
|
||||
- index
|
||||
- methylseq
|
||||
- bisulphite
|
||||
- fasta
|
||||
tools:
|
||||
- bwameth:
|
||||
description: |
|
||||
Fast and accurate alignment of BS-Seq reads
|
||||
using bwa-mem and a 3-letter genome.
|
||||
homepage: https://github.com/brentp/bwa-meth
|
||||
documentation: https://github.com/brentp/bwa-meth
|
||||
arxiv: arXiv:1401.1129
|
||||
params:
|
||||
- outdir:
|
||||
type: string
|
||||
description: |
|
||||
The pipeline's output directory. By default, the module will
|
||||
output files into `$params.outdir/<SOFTWARE>`
|
||||
- publish_dir_mode:
|
||||
type: string
|
||||
description: |
|
||||
Value for the Nextflow `publishDir` mode parameter.
|
||||
Available: symlink, rellink, link, copy, copyNoFollow, move.
|
||||
- enable_conda:
|
||||
type: boolean
|
||||
description: |
|
||||
Run the module with Conda using the software specified
|
||||
via the `conda` directive
|
||||
- singularity_pull_docker_container:
|
||||
type: boolean
|
||||
description: |
|
||||
Instead of directly downloading Singularity images for use with Singularity,
|
||||
force the workflow to pull and convert Docker containers instead.
|
||||
input:
|
||||
- fasta:
|
||||
type: file
|
||||
description: Input genome fasta file
|
||||
output:
|
||||
- index:
|
||||
type: dir
|
||||
description: Directory containing bwameth genome index
|
||||
pattern: "index"
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
authors:
|
||||
- "@phue"
|
66946
tests/data/index/E_coli/bwameth/genome.fa
Normal file
66946
tests/data/index/E_coli/bwameth/genome.fa
Normal file
File diff suppressed because it is too large
Load diff
93726
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t
Normal file
93726
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,5 @@
|
|||
9372274 2 4
|
||||
20895 1 Y
|
||||
142347 1 R
|
||||
4707032 1 Y
|
||||
4828484 1 R
|
|
@ -0,0 +1,5 @@
|
|||
9372274 2 11
|
||||
0 rgi|170079663|ref|NC_010473.1| Escherichia coli str. K-12 substr. DH10B, complete genome
|
||||
0 4686137 2
|
||||
0 fgi|170079663|ref|NC_010473.1| Escherichia coli str. K-12 substr. DH10B, complete genome
|
||||
4686137 4686137 2
|
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.bwt
Normal file
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.bwt
Normal file
Binary file not shown.
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.pac
Normal file
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.pac
Normal file
Binary file not shown.
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.sa
Normal file
BIN
tests/data/index/E_coli/bwameth/genome.fa.bwameth.c2t.sa
Normal file
Binary file not shown.
37
tests/software/bwameth/align/main.nf
Normal file
37
tests/software/bwameth/align/main.nf
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { BWAMETH_ALIGN as BWAMETH_ALIGN_SE } from '../../../../software/bwameth/align/main.nf' addParams( options: [ publish_dir:'test_single_end' ] )
|
||||
include { BWAMETH_ALIGN as BWAMETH_ALIGN_PE } from '../../../../software/bwameth/align/main.nf' addParams( options: [ publish_dir:'test_paired_end' ] )
|
||||
|
||||
/*
|
||||
* Test with single-end data
|
||||
*/
|
||||
workflow test_bwameth_align_single_end {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
[ file("${launchDir}/tests/data/fastq/methylated_dna/Ecoli_10K_methylated_R1.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
BWAMETH_ALIGN_SE (
|
||||
input,
|
||||
file("${launchDir}/tests/data/index/E_coli/bwameth", checkIfExists: true)
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with paired-end data
|
||||
*/
|
||||
workflow test_bwameth_align_paired_end {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
[ file("${launchDir}/tests/data/fastq/methylated_dna/Ecoli_10K_methylated_R1.fastq.gz", checkIfExists: true),
|
||||
file("${launchDir}/tests/data/fastq/methylated_dna/Ecoli_10K_methylated_R2.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
BWAMETH_ALIGN_PE (
|
||||
input,
|
||||
file("${launchDir}/tests/data/index/E_coli/bwameth", checkIfExists: true)
|
||||
)
|
||||
}
|
17
tests/software/bwameth/align/test.yml
Normal file
17
tests/software/bwameth/align/test.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
- name: Run bwameth single-end test workflow
|
||||
command: nextflow run ./tests/software/bwameth/align -entry test_bwameth_align_single_end -c tests/config/nextflow.config
|
||||
tags:
|
||||
- bwameth
|
||||
- bwameth_align
|
||||
files:
|
||||
- path: output/test_single_end/test.bam
|
||||
md5sum: 48dde56f7b74de3a3e0b1914c45150de
|
||||
|
||||
- name: Run bwameth paired-end test workflow
|
||||
command: nextflow run ./tests/software/bwameth/align -entry test_bwameth_align_paired_end -c tests/config/nextflow.config
|
||||
tags:
|
||||
- bwameth
|
||||
- bwameth_align
|
||||
files:
|
||||
- path: output/test_paired_end/test.bam
|
||||
md5sum: b473343b32b7cfc677bfad1ab0e6bb5a
|
10
tests/software/bwameth/index/main.nf
Normal file
10
tests/software/bwameth/index/main.nf
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { BWAMETH_INDEX } from '../../../../software/bwameth/index/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_bwameth_index {
|
||||
|
||||
BWAMETH_INDEX ( file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) )
|
||||
}
|
18
tests/software/bwameth/index/test.yml
Normal file
18
tests/software/bwameth/index/test.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
- name: Run bwameth index test workflow
|
||||
command: nextflow run ./tests/software/bwameth/index -entry test_bwameth_index -c tests/config/nextflow.config
|
||||
tags:
|
||||
- bwameth
|
||||
- bwameth_index
|
||||
files:
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t.pac
|
||||
md5sum: 7586c6a3be45c4dea15376a5c7bb9bf0
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t.amb
|
||||
md5sum: 87e019665cbb66bdee2bacccb26845c9
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t.ann
|
||||
md5sum: a4659a63572b6998c67457bd8e95790d
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t.bwt
|
||||
md5sum: 582854008bcbe99d5b51290773a7db5f
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t
|
||||
md5sum: db670853725f4a31080c991e9df6b330
|
||||
- path: ./output/bwameth/bwameth/NC_010473.fa.bwameth.c2t.sa
|
||||
md5sum: 020db07e7e1544dc961c30c9936f3213
|
Loading…
Reference in a new issue