Merge pull request #223 from phue/bismark_genome_preparation

add bismark/genome_preparation + test
This commit is contained in:
Harshil Patel 2021-02-18 19:08:00 +00:00 committed by GitHub
commit 01c0d335ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 203 additions and 0 deletions

4
.github/filters.yml vendored
View file

@ -54,6 +54,10 @@ bedtools_sort:
- software/bedtools/sort/**
- tests/software/bedtools/sort/**
bismark_genome_preparation:
- software/bismark/genome_preparation/**
- tests/software/bismark/genome_preparation/**
blast_makeblastdb:
- software/blast/makeblastdb/**
- tests/software/blast/makeblastdb/**

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,37 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BISMARK_GENOME_PREPARATION {
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::bismark==0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0"
} else {
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input:
path fasta, stageAs: "BismarkIndex/*"
output:
path "BismarkIndex" , emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
bismark_genome_preparation \\
$options.args \\
BismarkIndex
echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,57 @@
name: bismark_genome_preparation
description: |
Converts a specified reference genome into two different bisulfite
converted versions and indexes them for alignments.
keywords:
- bismark
- 3-letter genome
- index
- methylation
- 5mC
- methylseq
- bisulphite
- fasta
tools:
- bismark:
description: |
Bismark is a tool to map bisulfite treated sequencing reads
and perform methylation calling in a quick and easy-to-use fashion.
homepage: https://github.com/FelixKrueger/Bismark
documentation: https://github.com/FelixKrueger/Bismark/tree/master/Docs
doi: 10.1093/bioinformatics/btr167
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: Bismark genome index directory
pattern: "BismarkIndex"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@phue"

View file

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

View file

@ -0,0 +1,36 @@
- name: Run bismark_genome_preparation test workflow
command: nextflow run ./tests/software/bismark/genome_preparation -entry test_bismark_genome_preparation -c tests/config/nextflow.config
tags:
- bismark
- bismark_genome_preparation
files:
- path: output/bismark/BismarkIndex/NC_010473.fa
md5sum: ad277e6b3da5dcf9fccfcd3a55fcec8e
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/genome_mfa.CT_conversion.fa
md5sum: f878bc2c1d6d1404157ebf931e971f02
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.1.bt2
md5sum: d865be3bfe02a3d5e277128fe7902b47
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.2.bt2
md5sum: 486dfea5dde17f126cf498ead0e91421
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.3.bt2
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.4.bt2
md5sum: 4c81a7364a80bf3151a5464108593497
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/genome_mfa.GA_conversion.fa
md5sum: 8cb16ceaf0543061151d8c1b7d1f85b4
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.1.bt2
md5sum: fe77e5d17a7aa30c3a788bb90b396842
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.2.bt2
md5sum: 3c6e4a48ad05f8af5f4015db7571d253
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.3.bt2
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.4.bt2
md5sum: f651bcfb9713f6ee1ce648b7c244b50e
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.rev.1.bt2
md5sum: 2261afbed214da6f59f1bf648c20fb6b
- path: output/bismark/BismarkIndex/Bisulfite_Genome/CT_conversion/BS_CT.rev.2.bt2
md5sum: 622991847ea56f3c4f8583bb23ceee7a
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.rev.1.bt2
md5sum: 32220350073a71a9cd69677f3aa4e577
- path: output/bismark/BismarkIndex/Bisulfite_Genome/GA_conversion/BS_GA.rev.2.bt2
md5sum: f7467830c4f33497c54c9e7e502a5def