Merge remote-tracking branch 'nf-core/master'

This commit is contained in:
Chris Cheshire 2021-01-05 09:10:11 +00:00
commit 7e9cbfc8d1
99 changed files with 4307 additions and 3795 deletions

42
.github/workflows/bowtie_align.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: bowtie_align
on:
push:
paths:
- software/bowtie/align/**
- software/bowtie/index/**
- .github/workflows/bowtie_align.yml
- tests/software/bowtie/**
pull_request:
paths:
- software/bowtie/align/**
- software/bowtie/index/**
- .github/workflows/bowtie_align.yml
- tests/software/bowtie/**
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag bowtie_align --symlink --wt 2

40
.github/workflows/bowtie_index.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: bowtie_index
on:
push:
paths:
- software/bowtie/index/**
- .github/workflows/bowtie_index.yml
- tests/software/bowtie/**
pull_request:
paths:
- software/bowtie/index/**
- .github/workflows/bowtie_index.yml
- tests/software/bowtie/**
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag bowtie_index --symlink --wt 2

View file

@ -17,20 +17,20 @@ jobs:
- name: Run Markdownlint - name: Run Markdownlint
run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.markdownlint.yml run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.markdownlint.yml
# EditorConfig: EditorConfig:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/setup-node@v1 - uses: actions/setup-node@v1
# with: with:
# node-version: "10" node-version: "10"
# - name: Install ECLint - name: Install editorconfig-checker
# run: npm install -g eclint run: npm install -g editorconfig-checker
# - name: Run ECLint check - name: Run ECLint check
# run: eclint check $(git ls-files | grep -v test) run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test)
YAML: YAML:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -34,4 +34,3 @@ process INTERSECT_BED {
bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt
""" """
} }

View file

@ -0,0 +1,60 @@
/*
* -----------------------------------------------------
* 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,59 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BOWTIE_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::bowtie=1.3.0 bioconda::samtools=1.10' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container 'https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0'
} else {
container 'quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0'
}
input:
tuple val(meta), path(reads)
path index
output:
tuple val(meta), path('*.bam'), emit: bam
tuple val(meta), path('*.out'), emit: log
path '*.version.txt' , emit: version
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped.fastq" : ''
def endedness = meta.single_end ? "$reads" : "-1 ${reads[0]} -2 ${reads[1]}"
"""
INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'`
bowtie \\
--threads $task.cpus \\
--sam \\
-x \$INDEX \\
-q \\
$unaligned \\
$options.args \\
$endedness \\
2> ${prefix}.out \\
| samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam -
if [ -f ${prefix}.unmapped.fastq ]; then
gzip ${prefix}.unmapped.fastq
fi
if [ -f ${prefix}.unmapped_1.fastq ]; then
gzip ${prefix}.unmapped_1.fastq
gzip ${prefix}.unmapped_2.fastq
fi
echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,69 @@
name: bowtie_align
description: Align reads to a reference genome using bowtie
keywords:
- align
- fasta
- genome
- reference
tools:
- bowtie:
description: |
bowtie is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: http://bowtie-bio.sourceforge.net/index.shtml
documentation: http://bowtie-bio.sourceforge.net/manual.shtml
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.
- save_unaligned:
type: boolean
description: Save unaligned reads
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: Bowtie genome index files
pattern: "*.ebwt"
output:
- bam:
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
- fastq:
type: file
description: Unaligned FastQ files
pattern: "*.fastq.gz"
authors:
- "@kevinmenden"

View file

@ -0,0 +1,60 @@
/*
* -----------------------------------------------------
* 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 BOWTIE_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::bowtie=1.3.0' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container 'https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1'
} else {
container 'quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1'
}
input:
path fasta
output:
path 'bowtie', emit: index
path '*.version.txt', emit: version
script:
def software = getSoftwareName(task.process)
"""
mkdir bowtie
bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName}
echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,51 @@
name: bowtie_index
description: Create bowtie index for reference genome
keywords:
- index
- fasta
- genome
- reference
tools:
- bowtie:
description: |
bowtie is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: http://bowtie-bio.sourceforge.net/index.shtml
documentation: http://bowtie-bio.sourceforge.net/manual.shtml
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:
- fasta:
type: file
description: Input genome fasta file
output:
- index:
type: file
description: Bowtie genome index files
pattern: "*.ebwt"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@kevinmenden"

View file

@ -44,7 +44,7 @@ process MACS2_CALLPEAK {
--format $format \\ --format $format \\
--name $prefix \\ --name $prefix \\
--treatment $ipbam \\ --treatment $ipbam \\
$control $control
macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt
""" """

View file

@ -33,7 +33,7 @@ process RSEQC_READDISTRIBUTION {
read_distribution.py \\ read_distribution.py \\
-i $bam \\ -i $bam \\
-r $bed \\ -r $bed \\
> ${prefix}.read_distribution.txt > ${prefix}.read_distribution.txt
read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt
""" """

View file

@ -0,0 +1,33 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BOWTIE_INDEX } from '../../../software/bowtie/index/main.nf' addParams( options: [:] )
include { BOWTIE_ALIGN } from '../../../software/bowtie/align/main.nf' addParams( options: [:] )
workflow test_bowtie_index {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
}
workflow test_bowtie_alignment_single_end {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
def input = []
input = [ [ id:'test', single_end:true ], // meta map
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true) ] ]
BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index )
}
workflow test_bowtie_alignment_paired_end {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
def input = []
input = [ [ id:'test', single_end:false ], // meta map
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ]
BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index )
}

View file

@ -0,0 +1,64 @@
- name: Run bowtie index
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_index -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_index
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- name: Run bowtie index and align single-end
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_single_end -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_align
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- path: output/bowtie/test.out
md5sum: a81cb18024616415a6cec3108a36fccd
- path: output/bowtie/test.bam
md5sum: 9feed8a55d4b5e600dcc577768ef07fc
- name: Run bowtie index and align paired-end
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_paired_end -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_align
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- path: output/bowtie/test.out
md5sum: a23e9a2a76e949aeb3693bcfae41a615
- path: output/bowtie/test.bam
md5sum: cf6a6381aa504e8342638ff3b509721e