mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Merge pull request #1534 from matthdsm/tool/elprep-merge
Tool/elprep merge
This commit is contained in:
commit
86484f3361
6 changed files with 121 additions and 0 deletions
43
modules/elprep/merge/main.nf
Normal file
43
modules/elprep/merge/main.nf
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
process ELPREP_MERGE {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::elprep=5.1.2" : null)
|
||||||
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||||
|
'https://depot.galaxyproject.org/singularity/elprep:5.1.2--he881be0_0':
|
||||||
|
'quay.io/biocontainers/elprep:5.1.2--he881be0_0' }"
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("output/**.{bam,sam}") , emit: bam
|
||||||
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
|
when:
|
||||||
|
task.ext.when == null || task.ext.when
|
||||||
|
|
||||||
|
script:
|
||||||
|
def args = task.ext.args ?: ''
|
||||||
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||||
|
def suffix = args.contains("--output-type sam") ? "sam" : "bam"
|
||||||
|
def single_end = meta.single_end ? " --single-end" : ""
|
||||||
|
|
||||||
|
"""
|
||||||
|
# create directory and move all input so elprep can find and merge them before splitting
|
||||||
|
mkdir input
|
||||||
|
mv ${bam} input/
|
||||||
|
|
||||||
|
elprep merge \\
|
||||||
|
input/ \\
|
||||||
|
output/${prefix}.${suffix} \\
|
||||||
|
$args \\
|
||||||
|
${single_end} \\
|
||||||
|
--nr-of-threads $task.cpus
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
elprep: \$(elprep 2>&1 | head -n2 | tail -n1 |sed 's/^.*version //;s/ compiled.*\$//')
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
44
modules/elprep/merge/meta.yml
Normal file
44
modules/elprep/merge/meta.yml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
name: "elprep_merge"
|
||||||
|
description: Merge split bam/sam chunks in one file
|
||||||
|
keywords:
|
||||||
|
- bam
|
||||||
|
- sam
|
||||||
|
- merge
|
||||||
|
tools:
|
||||||
|
- "elprep":
|
||||||
|
description: "elPrep is a high-performance tool for preparing .sam/.bam files for variant calling in sequencing pipelines. It can be used as a drop-in replacement for SAMtools/Picard/GATK4."
|
||||||
|
homepage: "https://github.com/ExaScience/elprep"
|
||||||
|
documentation: "https://github.com/ExaScience/elprep"
|
||||||
|
tool_dev_url: "https://github.com/ExaScience/elprep"
|
||||||
|
doi: "10.1371/journal.pone.0244471"
|
||||||
|
licence: "['AGPL v3']"
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: List of BAM/SAM chunks to merge
|
||||||
|
pattern: "*.{bam,sam}"
|
||||||
|
|
||||||
|
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"
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: Merged BAM/SAM file
|
||||||
|
pattern: "*.{bam,sam}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@matthdsm"
|
|
@ -603,6 +603,10 @@ elprep/filter:
|
||||||
- modules/elprep/filter/**
|
- modules/elprep/filter/**
|
||||||
- tests/modules/elprep/filter/**
|
- tests/modules/elprep/filter/**
|
||||||
|
|
||||||
|
elprep/merge:
|
||||||
|
- modules/elprep/merge/**
|
||||||
|
- tests/modules/elprep/merge/**
|
||||||
|
|
||||||
elprep/split:
|
elprep/split:
|
||||||
- modules/elprep/split/**
|
- modules/elprep/split/**
|
||||||
- tests/modules/elprep/split/**
|
- tests/modules/elprep/split/**
|
||||||
|
|
17
tests/modules/elprep/merge/main.nf
Normal file
17
tests/modules/elprep/merge/main.nf
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { ELPREP_SPLIT } from '../../../../modules/elprep/split/main.nf'
|
||||||
|
include { ELPREP_MERGE } from '../../../../modules/elprep/merge/main.nf'
|
||||||
|
|
||||||
|
workflow test_elprep_merge {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
ELPREP_SPLIT ( input )
|
||||||
|
ELPREP_MERGE ( ELPREP_SPLIT.out.bam )
|
||||||
|
}
|
5
tests/modules/elprep/merge/nextflow.config
Normal file
5
tests/modules/elprep/merge/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
process {
|
||||||
|
withName : ELPREP_MERGE {
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
}
|
||||||
|
}
|
8
tests/modules/elprep/merge/test.yml
Normal file
8
tests/modules/elprep/merge/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- name: elprep merge test_elprep_merge
|
||||||
|
command: nextflow run tests/modules/elprep/merge -entry test_elprep_merge -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- elprep
|
||||||
|
- elprep/merge
|
||||||
|
files:
|
||||||
|
- path: output/elprep/output/test.bam
|
||||||
|
- path: output/elprep/versions.yml
|
Loading…
Reference in a new issue