Adding module bamtools stats (#2104)

* added bamtools stats module and tested

* added bamtools stats module and tested

* fixing prettier complaints

* changed process tag to single
This commit is contained in:
Francesco Lescai 2022-09-27 07:24:43 +02:00 committed by GitHub
parent 07e2868920
commit 77d5dd60eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,35 @@
process BAMTOOLS_STATS {
tag "$meta.id"
label 'process_single'
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("*.stats"), emit: stats
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}"
"""
bamtools \\
stats \\
-in $bam \\
>${prefix}.bam.stats
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,43 @@
name: "bamtools_stats"
description: BamTools provides both a programmer's API and an end-user's toolkit for handling BAM files.
keywords:
- bamtools
- stats
- bam
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"
- stats:
type: file
description: File containing alignment statistics
pattern: "*.stats"
authors:
- "@lescai"

View file

@ -126,6 +126,10 @@ bamtools/split:
- modules/bamtools/split/**
- tests/modules/bamtools/split/**
bamtools/stats:
- modules/bamtools/stats/**
- tests/modules/bamtools/stats/**
bamutil/trimbam:
- modules/bamutil/trimbam/**
- tests/modules/bamutil/trimbam/**

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BAMTOOLS_STATS } from '../../../../modules/bamtools/stats/main.nf'
workflow test_bamtools_stats {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
BAMTOOLS_STATS ( input )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,8 @@
- name: bamtools stats test_bamtools_stats
command: nextflow run ./tests/modules/bamtools/stats -entry test_bamtools_stats -c ./tests/config/nextflow.config -c ./tests/modules/bamtools/stats/nextflow.config
tags:
- bamtools/stats
- bamtools
files:
- path: output/bamtools/test.bam.stats
md5sum: b7c3f01682673a652d664a2889b15b66