Merge branch 'master' into ivar-variant

This commit is contained in:
Anders Goncalves da Silva 2021-02-15 20:50:35 -08:00
commit 89f65e0875
22 changed files with 652 additions and 0 deletions

12
.github/filters.yml vendored
View file

@ -96,6 +96,14 @@ bwa_mem:
- software/bwa/mem/** - software/bwa/mem/**
- tests/software/bwa/mem/** - tests/software/bwa/mem/**
bwamem2_index:
- software/bwamem2/index/**
- tests/software/bwamem2/index/**
bwamem2_mem:
- software/bwamem2/mem/**
- tests/software/bwamem2/mem/**
cat_fastq: cat_fastq:
- software/cat/fastq/** - software/cat/fastq/**
- tests/software/cat/fastq/** - tests/software/cat/fastq/**
@ -144,6 +152,10 @@ minimap2_align:
- software/minimap2/align/** - software/minimap2/align/**
- tests/software/minimap2/align/** - tests/software/minimap2/align/**
mosdepth:
- software/mosdepth/**
- tests/software/mosdepth/**
multiqc: multiqc:
- software/fastqc/** - software/fastqc/**
- software/multiqc/** - software/multiqc/**

View 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"
}
}
}

View file

@ -0,0 +1,35 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BWAMEM2_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::bwa-mem2=2.1=he513fc3_0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bwa-mem2:2.1--he513fc3_0"
} else {
container "quay.io/biocontainers/bwa-mem2:2.1--he513fc3_0"
}
input:
path fasta
output:
path "bwamem2" , emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
mkdir bwamem2
bwa-mem2 index $options.args $fasta -p bwamem2/${fasta}
echo \$(bwa-mem2 version 2>&1) > ${software}.version.txt
"""
}

View file

@ -0,0 +1,50 @@
name: bwamem2_index
description: Create BWA-mem2 index for reference genome
keywords:
- index
- fasta
- genome
- reference
tools:
- bwa:
description: |
BWA-mem2 is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: https://github.com/bwa-mem2/bwa-mem2
documentation: https://github.com/bwa-mem2/bwa-mem2#usage
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: file
description: BWA genome index files
pattern: "*.{0132,amb,ann,bwt.2bit.64,pac}"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@maxulysse"

View 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"
}
}
}

View file

@ -0,0 +1,46 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BWAMEM2_MEM {
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::bwa-mem2=2.1=he513fc3_0 bioconda::samtools=1.11=h6270b1f_0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/mulled-v2-e5d375990341c5aef3c9aff74f96f66f65375ef6:e6f0d20c9d78572ddbbf00d8767ee6ff865edd4e-0"
} else {
container "quay.io/biocontainers/mulled-v2-e5d375990341c5aef3c9aff74f96f66f65375ef6:e6f0d20c9d78572ddbbf00d8767ee6ff865edd4e-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 ./ -name "*.amb" | sed 's/.amb//'`
bwa-mem2 mem \\
$options.args \\
$read_group \\
-t $task.cpus \\
\$INDEX \\
$reads \\
| samtools view $options.args2 -@ $task.cpus -bhS -o ${prefix}.bam -
echo \$(bwa-mem2 version 2>&1) > ${software}.version.txt
"""
}

View file

@ -0,0 +1,65 @@
name: bwamem2_mem
description: Performs fastq alignment to a fasta reference using BWA
keywords:
- mem
- bwa
- alignment
- map
- fastq
- bam
- sam
tools:
- bwa:
description: |
BWA is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: http://bio-bwa.sourceforge.net/
documentation: http://www.htslib.org/doc/samtools.html
arxiv: arXiv:1303.3997
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: file
description: BWA genome index files
pattern: "Directory containing BWA index *.{amb,ann,bwt,pac,sa}"
output:
- bam:
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@maxulysse"

View 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"
}
}
}

48
software/mosdepth/main.nf Normal file
View file

@ -0,0 +1,48 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process MOSDEPTH {
tag "$meta.id"
label 'process_medium'
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::mosdepth=0.3.1' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/mosdepth:0.3.1--ha7ba039_0"
} else {
container "quay.io/biocontainers/mosdepth:0.3.1--ha7ba039_0"
}
input:
tuple val(meta), path(bam), path(bai)
path bed
val window_size
output:
tuple val(meta), path('*.global.dist.txt') , emit: global_txt
tuple val(meta), path('*.region.dist.txt') , emit: regions_txt
tuple val(meta), path('*.summary.txt') , emit: summary_txt
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed
tuple val(meta), path('*.regions.bed.gz.csi') , emit: regions_csi
path '*.version.txt' , emit: version
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def interval = window_size ? "--by ${window_size}" : "--by ${bed}"
"""
mosdepth \\
$interval \\
$options.args \\
$prefix \\
$bam
echo \$(mosdepth --version 2>&1) | sed 's/^.*mosdepth //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,97 @@
name: mosdepth
description: Calculates genome-wide sequencing coverage.
keywords:
- mosdepth
- bam
- cram
- coverage
tools:
- mosdepth:
description: |
Fast BAM/CRAM depth calculation for WGS, exome, or targeted sequencing.
documentation: https://github.com/brentp/mosdepth
doi: 10.1093/bioinformatics/btx699
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 ]
- bam:
type: file
description: Input BAM/CRAM file
pattern: "*.{bam,cram}"
- bai:
type: file
description: Index for BAM/CRAM file
pattern: "*.{bai,crai}"
- bed:
type: file
description: BED file with intersected intervals
pattern: "*.{bed}"
- window_size:
type: integer
description: Window size
pattern: "[0-9]+"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- global_txt:
type: file
description: Text file with global cumulative coverage distribution
pattern: "*.{global.dist.txt}"
- regions_txt:
type: file
description: Text file with region cumulative coverage distribution
pattern: "*.{region.dist.txt}"
- summary_txt:
type: file
description: Text file with summary mean depths per chromosome and regions
pattern: "*.{summary.txt}"
- per_base_bed:
type: file
description: BED file with per-base coverage
pattern: "*.{per-base.bed.gz}"
- per_base_csi:
type: file
description: Index file for BED file with per-base coverage
pattern: "*.{per-base.bed.gz.csi}"
- regions_bed:
type: file
description: BED file with per-region coverage
pattern: "*.{regions.bed.gz}"
- regions_csi:
type: file
description: Index file for BED file with per-region coverage
pattern: "*.{regions.bed.gz.csi}"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

Binary file not shown.

View file

@ -0,0 +1,3 @@
4686137 1 2
20895 1 Y
142347 1 R

View file

@ -0,0 +1,3 @@
4686137 1 11
0 gi|170079663|ref|NC_010473.1| Escherichia coli str. K-12 substr. DH10B, complete genome
0 4686137 2

Binary file not shown.

View file

@ -0,0 +1,9 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BWAMEM2_INDEX } from '../../../../software/bwamem2/index/main.nf' addParams( options: [:] )
workflow test_bwamem2_index {
BWAMEM2_INDEX ( file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) )
}

View file

@ -0,0 +1,16 @@
- name: bwamem2 index
command: nextflow run ./tests/software/bwamem2/index -entry test_bwamem2_index -c tests/config/nextflow.config
tags:
- bwamem2
- bwamem2_index
files:
- path: output/bwamem2/bwamem2/NC_010473.fa.0123
md5sum: e112e4d2fd893fb939d306b27ece9de5
- path: output/bwamem2/bwamem2/NC_010473.fa.amb
md5sum: 942a990ae872f1c0b8d72dda2db405d5
- path: output/bwamem2/bwamem2/NC_010473.fa.ann
md5sum: ebf1a0279cf5b8d7f1a8cb855a3a3705
- path: output/bwamem2/bwamem2/NC_010473.fa.bwt.2bit.64
md5sum: f0154573be12440aee294b726cd88c86
- path: output/bwamem2/bwamem2/NC_010473.fa.pac
md5sum: 4d5e6fc45bbc968f7f859e9ca2cc89ad

View file

@ -0,0 +1,36 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BWAMEM2_MEM } from '../../../../software/bwamem2/mem/main.nf' addParams( options: [:] )
/*
* Test with single-end data
*/
workflow test_bwamem2_mem_single_end {
def input = []
input = [ [ id:'test', single_end:true ], // meta map
[ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ]
BWAMEM2_MEM (
input,
file("${launchDir}/tests/data/index/E_coli/bwamem2/", checkIfExists: true)
)
}
/*
* Test with paired-end data
*/
workflow test_bwamem2_mem_paired_end {
def input = []
input = [ [ id:'test', single_end:false ], // meta map
[ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R2.fastq.gz", checkIfExists: true) ] ]
BWAMEM2_MEM (
input,
file("${launchDir}/tests/data/index/E_coli/bwamem2/", checkIfExists: true)
)
}

View file

@ -0,0 +1,19 @@
- name: bwamem2 mem single-end
command: nextflow run ./tests/software/bwamem2/mem -entry test_bwamem2_mem_single_end -c tests/config/nextflow.config
tags:
- bwamem2
- bwamem2_mem
- bwamem2_mem_single_end
files:
- path: output/bwamem2/test.bam
md5sum: 354acd3b7033a2d4ee69452df18c0a4d
- name: bwamem2 mem paired-end
command: nextflow run ./tests/software/bwamem2/mem -entry test_bwamem2_mem_paired_end -c tests/config/nextflow.config
tags:
- bwamem2
- bwamem2_mem
- bwamem2_mem_paired_end
files:
- path: output/bwamem2/test.bam
md5sum: 26187528a7bde13a2a9e9dd549b9bcd0

View file

@ -0,0 +1,17 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MOSDEPTH } from '../../../software/mosdepth/main.nf' addParams( options: [:] )
workflow test_mosdepth {
input = [ [ id:'test', single_end:true ],
[ file("${launchDir}/tests/data/bam/test.paired_end.sorted.bam", checkIfExists: true) ],
[ file("${launchDir}/tests/data/bam/test.paired_end.sorted.bam.bai", checkIfExists: true) ] ]
dummy = [ file("${launchDir}/tests/data/dummy/dummy_file.txt", checkIfExists: true) ]
window_size = 100
MOSDEPTH ( input, dummy, window_size )
}

View file

@ -0,0 +1,19 @@
- name: mosdepth
command: nextflow run ./tests/software/mosdepth -entry test_mosdepth -c tests/config/nextflow.config
tags:
- mosdepth
files:
- path: output/mosdepth/test.per-base.bed.gz
md5sum: 4965936f5a7502cff93286c0324e41ff
- path: output/mosdepth/test.regions.bed.gz
md5sum: 6997da219218fa57484572c3a2963dd6
- path: output/mosdepth/test.per-base.bed.gz.csi
md5sum: feed5da1defda07b6eaebcf497581115
- path: output/mosdepth/test.mosdepth.region.dist.txt
md5sum: f1f89c14bab380f44e95b09f676d0c52
- path: output/mosdepth/test.mosdepth.global.dist.txt
md5sum: 239d156c9008dc59c7f0138f6b0ba300
- path: output/mosdepth/test.regions.bed.gz.csi
md5sum: a1c982f3e2a97f529ad5780d32010c32
- path: output/mosdepth/test.mosdepth.summary.txt
md5sum: 5a92dee6e87136a65c7973260f229852