mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
feat: add tiddit_sv module
This commit is contained in:
parent
2bf3890afb
commit
f62196a4a6
7 changed files with 236 additions and 0 deletions
4
.github/filters.yml
vendored
4
.github/filters.yml
vendored
|
@ -273,6 +273,10 @@ tabix_tabix:
|
||||||
- software/tabix/tabix/**
|
- software/tabix/tabix/**
|
||||||
- tests/software/tabix/tabix/**
|
- tests/software/tabix/tabix/**
|
||||||
|
|
||||||
|
tiddit_sv:
|
||||||
|
- software/tiddit/sv/**
|
||||||
|
- tests/software/tiddit/sv/**
|
||||||
|
|
||||||
tool_subtool:
|
tool_subtool:
|
||||||
- software/TOOL/SUBTOOL/**
|
- software/TOOL/SUBTOOL/**
|
||||||
- tests/software/TOOL/SUBTOOL/**
|
- tests/software/TOOL/SUBTOOL/**
|
||||||
|
|
59
software/tiddit/sv/functions.nf
Normal file
59
software/tiddit/sv/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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
software/tiddit/sv/main.nf
Normal file
45
software/tiddit/sv/main.nf
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
def options = initOptions(params.options)
|
||||||
|
|
||||||
|
process TIDDIT_SV {
|
||||||
|
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::tiddit=2.12.1" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/tiddit:2.12.1--py38h1773678_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/tiddit:2.12.1--py38h1773678_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam)
|
||||||
|
path fasta
|
||||||
|
path fai
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.vcf"), emit: vcf
|
||||||
|
tuple val(meta), path("*.ploidy.tab"), emit: ploidy
|
||||||
|
tuple val(meta), path("*.signals.tab"), emit: signals
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def output = options.suffix ? "${meta.id}.${options.suffix}" : "${meta.id}"
|
||||||
|
def reference = fasta == "dummy_file.txt" ? "--ref $fasta" : ""
|
||||||
|
"""
|
||||||
|
tiddit \\
|
||||||
|
--sv $options.args \\
|
||||||
|
--bam $bam \\
|
||||||
|
$reference \\
|
||||||
|
-o $output
|
||||||
|
|
||||||
|
echo \$(tiddit -h 2>&1) | sed 's/^.*Version: //; s/(.*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
71
software/tiddit/sv/meta.yml
Normal file
71
software/tiddit/sv/meta.yml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: tiddit_sv
|
||||||
|
description: Identify chromosomal rearrangements.
|
||||||
|
keywords:
|
||||||
|
- structural
|
||||||
|
- variants
|
||||||
|
- vcf
|
||||||
|
tools:
|
||||||
|
- sv:
|
||||||
|
description: Search for structural variants.
|
||||||
|
homepage: https://github.com/SciLifeLab/TIDDIT
|
||||||
|
documentation: https://github.com/SciLifeLab/TIDDIT/blob/master/README.md
|
||||||
|
doi: 10.12688/f1000research.11168.1
|
||||||
|
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 ]
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Input FASTA file
|
||||||
|
pattern: "*.{fasta,fa}"
|
||||||
|
- fai:
|
||||||
|
type: file
|
||||||
|
description: FASTA index file
|
||||||
|
pattern: "*.{fai}"
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- vcf:
|
||||||
|
type: file
|
||||||
|
description: vcf
|
||||||
|
pattern: "*.{vcf}"
|
||||||
|
- ploidy:
|
||||||
|
type: file
|
||||||
|
description: tab
|
||||||
|
pattern: "*.{ploidy.tab}"
|
||||||
|
- signals:
|
||||||
|
type: file
|
||||||
|
description: tab
|
||||||
|
pattern: "*.{signals.tab}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@maxulysse"
|
0
tests/data/dummy/dummy_file2.txt
Normal file
0
tests/data/dummy/dummy_file2.txt
Normal file
30
tests/software/tiddit/sv/main.nf
Normal file
30
tests/software/tiddit/sv/main.nf
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { TIDDIT_SV } from '../../../../software/tiddit/sv/main.nf' addParams( options: [:] )
|
||||||
|
include { SAMTOOLS_FAIDX } from '../../../../software/samtools/faidx/main.nf' addParams( options: [:] )
|
||||||
|
|
||||||
|
workflow test_tiddit_sv {
|
||||||
|
def input = []
|
||||||
|
def fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
|
||||||
|
|
||||||
|
input = [ [ id:'test' ], // meta map
|
||||||
|
[ file("${launchDir}/tests/data/bam/test.paired_end.sorted.bam", checkIfExists: true) ] ]
|
||||||
|
|
||||||
|
SAMTOOLS_FAIDX ( fasta )
|
||||||
|
|
||||||
|
TIDDIT_SV ( input, fasta, SAMTOOLS_FAIDX.out.fai )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_tiddit_sv_no_ref {
|
||||||
|
def input = []
|
||||||
|
def dummy_file = file("${launchDir}/tests/data/dummy/dummy_file.txt", checkIfExists: true)
|
||||||
|
def dummy_file2 = file("${launchDir}/tests/data/dummy/dummy_file2.txt", checkIfExists: true)
|
||||||
|
|
||||||
|
input = [ [ id:'test' ], // meta map
|
||||||
|
[ file("${launchDir}/tests/data/bam/test.paired_end.sorted.bam", checkIfExists: true) ] ]
|
||||||
|
|
||||||
|
|
||||||
|
TIDDIT_SV ( input, dummy_file, dummy_file2 )
|
||||||
|
}
|
27
tests/software/tiddit/sv/test.yml
Normal file
27
tests/software/tiddit/sv/test.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
- name: tiddit sv
|
||||||
|
command: nextflow run ./tests/software/tiddit/sv -entry test_tiddit_sv -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- tiddit
|
||||||
|
- tiddit_sv
|
||||||
|
- vcf
|
||||||
|
files:
|
||||||
|
- path: output/tiddit/test.ploidy.tab
|
||||||
|
md5sum: 207bd22e75de82160f98bedc2d3d262d
|
||||||
|
- path: output/tiddit/test.signals.tab
|
||||||
|
md5sum: 67e041b737fe0fe1a33119c3109e9eff
|
||||||
|
- path: output/tiddit/test.vcf
|
||||||
|
md5sum: 24e749d49a2e91acdfb3bc13c1c6e51d
|
||||||
|
|
||||||
|
- name: tiddit sv no ref
|
||||||
|
command: nextflow run ./tests/software/tiddit/sv -entry test_tiddit_sv_no_ref -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- tiddit
|
||||||
|
- tiddit_sv
|
||||||
|
- vcf
|
||||||
|
files:
|
||||||
|
- path: output/tiddit/test.ploidy.tab
|
||||||
|
md5sum: 207bd22e75de82160f98bedc2d3d262d
|
||||||
|
- path: output/tiddit/test.signals.tab
|
||||||
|
md5sum: 67e041b737fe0fe1a33119c3109e9eff
|
||||||
|
- path: output/tiddit/test.vcf
|
||||||
|
md5sum: 24e749d49a2e91acdfb3bc13c1c6e51d
|
Loading…
Reference in a new issue