Tool/elprep split (#1533)

* tool: elprep split

* fixes for testing

* fix tests

* fix test outputs

* create test-yaml

* fix suggestions by @jfy133

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Matthias De Smet 2022-04-22 10:20:05 +02:00 committed by GitHub
parent 35231d3949
commit 90b203d3e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,44 @@
process ELPREP_SPLIT {
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("**.{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}"
meta.single_end ? args += " --single-end": ""
"""
# create directory and move all input so elprep can find and merge them before splitting
mkdir input
mv ${bam} input/
mkdir ${prefix}
elprep split \\
input \\
. \\
$args \\
--nr-of-threads $task.cpus \\
--output-prefix $prefix
cat <<-END_VERSIONS > versions.yml
"${task.process}":
elprep: \$(elprep 2>&1 | head -n2 | tail -n1 |sed 's/^.*version //;s/ compiled.*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,43 @@
name: "elprep_split"
description: Split bam file into manageable chunks
keywords:
- bam
- split by chromosome
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"
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 files
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: List of split BAM/SAM files
pattern: "*.{bam,sam}"
authors:
- "@matthdsm"

View file

@ -599,6 +599,10 @@ ectyper:
- modules/ectyper/**
- tests/modules/ectyper/**
elprep/split:
- modules/elprep/split/**
- tests/modules/elprep/split/**
emmtyper:
- modules/emmtyper/**
- tests/modules/emmtyper/**

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ELPREP_SPLIT } from '../../../../modules/elprep/split/main.nf'
workflow test_elprep_split {
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 )
}

View file

@ -0,0 +1,9 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName : ELPREP_SPLIT {
ext.args = "--contig-group-size 1 --output-type bam"
}
}

View file

@ -0,0 +1,10 @@
- name: elprep split test_elprep_split
command: nextflow run tests/modules/elprep/split -entry test_elprep_split -c tests/config/nextflow.config
tags:
- elprep
- elprep/split
files:
- path: output/elprep/splits/test-group00001.bam
- path: output/elprep/splits/test-unmapped.bam
- path: output/elprep/test-spread.bam
- path: output/elprep/versions.yml