Merge pull request #252 from MaxUlysse/master_tiddit

New module: tiddit
This commit is contained in:
Maxime Garcia 2021-02-25 09:34:33 +01:00 committed by GitHub
commit ea6fde0193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 240 additions and 4 deletions

12
.github/filters.yml vendored
View file

@ -172,10 +172,6 @@ gunzip:
- software/gunzip/** - software/gunzip/**
- tests/software/gunzip/** - tests/software/gunzip/**
tabix_tabix:
- software/tabix/tabix/**
- tests/software/tabix/tabix/**
ivar_consensus: ivar_consensus:
- software/ivar/consensus/** - software/ivar/consensus/**
- tests/software/ivar/consensus/** - tests/software/ivar/consensus/**
@ -305,6 +301,14 @@ tabix_bgzip:
- software/tabix/bgzip/** - software/tabix/bgzip/**
- tests/software/tabix/bgzip/** - tests/software/tabix/bgzip/**
tabix_tabix:
- 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/**

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

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

View file

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

View 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