mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
New module: bamtools/convert
(#1219)
* 📦 NEW: Add bamtools/convert module * 👌 IMPROVE: Update output channel name, Add tests for each output format * 👌 IMPROVE: Add error test * 🐛 FIX: Remove custom tags Co-authored-by: Chris Cheshire <chris.j.cheshire@gmail.com>
This commit is contained in:
parent
f3a405e4f2
commit
080320765c
6 changed files with 329 additions and 0 deletions
38
modules/bamtools/convert/main.nf
Normal file
38
modules/bamtools/convert/main.nf
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
process BAMTOOLS_CONVERT {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null)
|
||||||
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||||
|
'https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9' :
|
||||||
|
'quay.io/biocontainers/bamtools:2.5.1--h9a82719_9' }"
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.{bed,fasta,fastq,json,pileup,sam,yaml}"), emit: data
|
||||||
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
|
script:
|
||||||
|
def args = task.ext.args ?: ''
|
||||||
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||||
|
def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/
|
||||||
|
if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml"
|
||||||
|
m = args =~ /-format ([a-z]+)/
|
||||||
|
ext = m[0][1]
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
bamtools \\
|
||||||
|
convert \\
|
||||||
|
$args \\
|
||||||
|
-in $bam \\
|
||||||
|
-out ${prefix}.${ext}
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' )
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
52
modules/bamtools/convert/meta.yml
Normal file
52
modules/bamtools/convert/meta.yml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
name: bamtools_convert
|
||||||
|
description: BamTools provides both a programmer's API and an end-user's toolkit for handling BAM files.
|
||||||
|
keywords:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
- bam
|
||||||
|
- convert
|
||||||
|
- bed
|
||||||
|
- fasta
|
||||||
|
- fastq
|
||||||
|
- json
|
||||||
|
- pileup
|
||||||
|
- sam
|
||||||
|
- yaml
|
||||||
|
tools:
|
||||||
|
- bamtools:
|
||||||
|
description: C++ API & command-line toolkit for working with BAM data
|
||||||
|
homepage: http://github.com/pezmaster31/bamtools
|
||||||
|
documentation: https://github.com/pezmaster31/bamtools/wiki
|
||||||
|
tool_dev_url: http://github.com/pezmaster31/bamtools
|
||||||
|
doi: ""
|
||||||
|
licence: ['MIT']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: BAM file
|
||||||
|
pattern: "*.bam"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- versions:
|
||||||
|
type: file
|
||||||
|
description: File containing software versions
|
||||||
|
pattern: "versions.yml"
|
||||||
|
## TODO nf-core: Delete / customise this example output
|
||||||
|
- out:
|
||||||
|
type: file
|
||||||
|
description: The data in the asked format (bed, fasta, fastq, json, pileup, sam, yaml)
|
||||||
|
pattern: "*.{bed,fasta,fastq,json,pileup,sam,yaml}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@sguizard"
|
|
@ -46,6 +46,10 @@ bamaligncleaner:
|
||||||
- modules/bamaligncleaner/**
|
- modules/bamaligncleaner/**
|
||||||
- tests/modules/bamaligncleaner/**
|
- tests/modules/bamaligncleaner/**
|
||||||
|
|
||||||
|
bamtools/convert:
|
||||||
|
- modules/bamtools/convert/**
|
||||||
|
- tests/modules/bamtools/convert/**
|
||||||
|
|
||||||
bamtools/split:
|
bamtools/split:
|
||||||
- modules/bamtools/split/**
|
- modules/bamtools/split/**
|
||||||
- tests/modules/bamtools/split/**
|
- tests/modules/bamtools/split/**
|
||||||
|
|
104
tests/modules/bamtools/convert/main.nf
Normal file
104
tests/modules/bamtools/convert/main.nf
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_EXT_ERROR } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_NOEXT_ERROR } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_BED } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTA } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTQ } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_JSON } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_PILEUP } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_SAM } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_YAML } from '../../../../modules/bamtools/convert/main.nf'
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_ext_error {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_EXT_ERROR ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_noext_error {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_NOEXT_ERROR ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_bed {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_BED ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_fasta {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_FASTA ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_fastq {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_FASTQ ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_json {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_JSON ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_pileup {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_PILEUP ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_sam {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_SAM ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_bamtools_convert_yaml {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
BAMTOOLS_CONVERT_YAML ( input )
|
||||||
|
}
|
||||||
|
|
41
tests/modules/bamtools/convert/nextflow.config
Normal file
41
tests/modules/bamtools/convert/nextflow.config
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
process {
|
||||||
|
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_EXT_ERROR {
|
||||||
|
ext.args = "-format vcf"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_NOEXT_ERROR {
|
||||||
|
ext.args = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_BED {
|
||||||
|
ext.args = "-format bed"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_FASTA {
|
||||||
|
ext.args = "-format fasta"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_FASTQ {
|
||||||
|
ext.args = "-format fastq"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_JSON {
|
||||||
|
ext.args = "-format json"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_PILEUP {
|
||||||
|
ext.args = "-format pileup"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_SAM {
|
||||||
|
ext.args = "-format sam"
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: BAMTOOLS_CONVERT_YAML {
|
||||||
|
ext.args = "-format yaml"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
90
tests/modules/bamtools/convert/test.yml
Normal file
90
tests/modules/bamtools/convert/test.yml
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
- name: bamtools convert test_bamtools_convert_ext_error
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_ext_error -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
exit_code: 1
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_noext_error
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_noext_error -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
exit_code: 1
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_bed
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_bed -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.bed
|
||||||
|
md5sum: 4e34cc15bf31e700f5f3a9f8fffb6c81
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: eb7a144b8a97965d3482f6f96b8a8243
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_fasta
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_fasta -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.fasta
|
||||||
|
md5sum: 52aeacf78571862b7e97c7d44ac8f827
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: 42d19a2b2b07f05edb82b34369dfd754
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_fastq
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_fastq -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.fastq
|
||||||
|
md5sum: e591c48daad2c56638e5d6f21f1f71c5
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: 13f0bf8a3e1f8f527f96dabaa5c8051e
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_json
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_json -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.json
|
||||||
|
md5sum: 04afed696f9f14da85a460353645d1f5
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: 33d633dbd6209cb93c9b071f8c0ed3b3
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_pileup
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_pileup -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.pileup
|
||||||
|
md5sum: e5a3cb4a3e1bf980a575fafce6a2826f
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: fd3ad0edd1e085b1a002e0593d1d5814
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_sam
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_sam -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.sam
|
||||||
|
md5sum: 61ab3d0de16a9da8b651f9c692e19d5e
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: 4be470ce3cc0143ae5ae415b612a4965
|
||||||
|
|
||||||
|
- name: bamtools convert test_bamtools_convert_yaml
|
||||||
|
command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_yaml -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- bamtools
|
||||||
|
- bamtools/convert
|
||||||
|
files:
|
||||||
|
- path: output/bamtools/test.yaml
|
||||||
|
md5sum: 68b56f198da036fef33e150eb773dc3b
|
||||||
|
- path: output/bamtools/versions.yml
|
||||||
|
md5sum: 1116abc088c5edf11bee393961c18b3e
|
Loading…
Reference in a new issue