mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2025-01-02 20:52:07 -05:00
Delly/call (#565)
* testing works but need to fix paths and add exclude list * edited meta file and removed TODOs * left over TODOs * test passed, final push * resolving initial comments * Update software/delly/call/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
79f3a55f6e
commit
3f4eccbf0f
6 changed files with 198 additions and 0 deletions
68
software/delly/call/functions.nf
Normal file
68
software/delly/call/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// 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.args3 = args.args3 ?: ''
|
||||
options.publish_by_meta = args.publish_by_meta ?: []
|
||||
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_meta) {
|
||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||
for (key in key_list) {
|
||||
if (args.meta && key instanceof String) {
|
||||
def path = key
|
||||
if (args.meta.containsKey(key)) {
|
||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
||||
}
|
||||
path = path instanceof String ? path : ''
|
||||
path_list.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
44
software/delly/call/main.nf
Normal file
44
software/delly/call/main.nf
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process DELLY_CALL {
|
||||
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), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::delly=0.8.7" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/delly:0.8.7--he03298f_1"
|
||||
} else {
|
||||
container "quay.io/biocontainers/delly:0.8.7--he03298f_1"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam), path(bai)
|
||||
path fasta
|
||||
path fai
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bcf"), emit: bcf
|
||||
tuple val(meta), path("*.csi"), emit: csi
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
"""
|
||||
delly \\
|
||||
call \\
|
||||
$options.args \\
|
||||
-o ${prefix}.bcf \\
|
||||
-g $fasta \\
|
||||
$bam \\
|
||||
|
||||
echo \$(delly --version 2>&1) | sed 's/^.*Delly //; s/Using.*\$//' > ${software}.version.txt
|
||||
"""
|
||||
}
|
55
software/delly/call/meta.yml
Normal file
55
software/delly/call/meta.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
name: delly_call
|
||||
description: Call structural variants
|
||||
keywords:
|
||||
- genome
|
||||
- structural
|
||||
- variants
|
||||
- bcf
|
||||
|
||||
tools:
|
||||
- delly:
|
||||
description: Structural variant discovery by integrated paired-end and split-read analysis
|
||||
homepage: https://github.com/dellytools/delly
|
||||
documentation: https://github.com/dellytools/delly/blob/master/README.md
|
||||
tool_dev_url: None
|
||||
doi: "DOI:10.1093/bioinformatics/bts378"
|
||||
licence: ["BSD-3-clause"]
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM file from alignment must be sorted, indexed, and duplicate marked
|
||||
pattern: "*.{bam}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: The reference fasta file
|
||||
- fai:
|
||||
type: file
|
||||
description: Index of reference fasta file to identify split-reads
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
- bcf:
|
||||
type: file
|
||||
description: BCF format
|
||||
pattern: "*.{bcf}"
|
||||
- csi:
|
||||
type: file
|
||||
description: A generated csi index that matches the bcf output
|
||||
pattern: "*.{bcf.csi}"
|
||||
|
||||
authors:
|
||||
- "@projectoriented"
|
|
@ -210,6 +210,10 @@ deeptools/plotprofile:
|
|||
- software/deeptools/plotprofile/**
|
||||
- tests/software/deeptools/plotprofile/**
|
||||
|
||||
delly/call:
|
||||
- software/delly/call/**
|
||||
- tests/software/delly/call/**
|
||||
|
||||
dshbio/filterbed:
|
||||
- software/dshbio/filterbed/**
|
||||
- tests/software/dshbio/filterbed/**
|
||||
|
|
17
tests/software/delly/call/main.nf
Normal file
17
tests/software/delly/call/main.nf
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { DELLY_CALL } from '../../../../software/delly/call/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_delly_call {
|
||||
input = [ [ id:'test' ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true),
|
||||
]
|
||||
|
||||
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
|
||||
fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
|
||||
|
||||
DELLY_CALL ( input, fasta, fai )
|
||||
}
|
10
tests/software/delly/call/test.yml
Normal file
10
tests/software/delly/call/test.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
- name: delly call test_delly_call
|
||||
command: nextflow run tests/software/delly/call -entry test_delly_call -c tests/config/nextflow.config
|
||||
tags:
|
||||
- delly
|
||||
- delly/call
|
||||
files:
|
||||
- path: output/delly/test.bcf
|
||||
md5sum: b20df3b9086faccd6bfd2641d97712c8
|
||||
- path: output/delly/test.bcf.csi
|
||||
md5sum: 19e0cdf06c415f4942f6d4dbd5fb7271
|
Loading…
Reference in a new issue