mosdept: cram compatiblility

This commit is contained in:
Matthias De Smet 2022-05-24 11:47:58 +02:00
parent 300e607a61
commit 01fb8851c3
4 changed files with 106 additions and 93 deletions

View file

@ -10,13 +10,13 @@ process MOSDEPTH {
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(bam), path(bai)
path bed path bed
val window_size path fasta
output: output:
tuple val(meta), path('*.global.dist.txt') , emit: global_txt tuple val(meta), path('*.global.dist.txt') , emit: global_txt
tuple val(meta), path('*.region.dist.txt') , emit: regions_txt , optional:true tuple val(meta), path('*.region.dist.txt') , emit: regions_txt , optional:true
tuple val(meta), path('*.summary.txt') , emit: summary_txt tuple val(meta), path('*.summary.txt') , emit: summary_txt
tuple val(meta), path('*.per-base.d4') , emit: d4 , optional:true tuple val(meta), path('*.per-base.d4') , emit: per_base_d4 , optional:true
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed, optional:true tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed, optional:true
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi, optional:true tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi, optional:true
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed , optional:true tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed , optional:true
@ -29,36 +29,17 @@ process MOSDEPTH {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
if (window_size) { def reference = fasta ? "--fasta ${fasta}" : ""
interval = "--by ${window_size}" def interval = bed ? "--by ${bed}" : ""
} else if ( bed ) {
interval = "--by ${bed}"
} else {
interval = ""
}
""" """
mosdepth \\ mosdepth \\
--threads ${task.cpus} \\
$interval \\ $interval \\
$reference \\
$args \\ $args \\
$prefix \\ $prefix \\
$bam $bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
END_VERSIONS
"""
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.global.dist.txt
touch ${prefix}.region.dist.txt
touch ${prefix}.summary.txt
touch ${prefix}.per-base.d4
touch ${prefix}.per-base.bed.gz
touch ${prefix}.per-base.bed.gz.csi
touch ${prefix}.regions.bed.gz
touch ${prefix}.regions.bed.gz.csi
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -30,10 +30,10 @@ input:
type: file type: file
description: BED file with intersected intervals description: BED file with intersected intervals
pattern: "*.{bed}" pattern: "*.{bed}"
- window_size: - fasta:
type: integer type: file
description: Window size description: Reference genome FASTA file
pattern: "[0-9]+" pattern: "*.{fa,fasta}"
output: output:
- meta: - meta:
type: map type: map
@ -60,6 +60,10 @@ output:
type: file type: file
description: Index file for BED file with per-base coverage description: Index file for BED file with per-base coverage
pattern: "*.{per-base.bed.gz.csi}" pattern: "*.{per-base.bed.gz.csi}"
- per_base_d4:
type: file
description: D4 file with per-base coverage
pattern: "*.{per-base.d4}"
- regions_bed: - regions_bed:
type: file type: file
description: BED file with per-region coverage description: BED file with per-region coverage
@ -76,3 +80,4 @@ authors:
- "@joseespinosa" - "@joseespinosa"
- "@drpatelh" - "@drpatelh"
- "@ramprasadn" - "@ramprasadn"
- "@matthdsm"

View file

@ -5,32 +5,45 @@ nextflow.enable.dsl = 2
include { MOSDEPTH } from '../../../modules/mosdepth/main.nf' include { MOSDEPTH } from '../../../modules/mosdepth/main.nf'
workflow test_mosdepth { workflow test_mosdepth {
input = [ [ id:'test', single_end:true ], input = [
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ], [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ] [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
] [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
]
MOSDEPTH ( input, [], [] ) MOSDEPTH ( input, [], [] )
} }
workflow test_mosdepth_window {
input = [ [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
]
window = 100
MOSDEPTH ( input, [], window )
}
workflow test_mosdepth_bed { workflow test_mosdepth_bed {
input = [ [ id:'test', single_end:true ], input = [
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ], [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ] [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
] [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
bed = [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ] ]
bed = [ file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ]
MOSDEPTH ( input, bed, [] ) MOSDEPTH ( input, bed, [] )
} }
workflow test_mosdepth_cram {
input = [
[ id:'test', single_end:true ],
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true) ],
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) ]
]
fasta = [ file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) ]
MOSDEPTH ( input, [], fasta )
}
workflow test_mosdepth_cram_bed {
input = [
[ id:'test', single_end:true ],
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true) ],
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) ]
]
bed = [ file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ]
fasta = [ file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) ]
MOSDEPTH ( input, bed, fasta )
}

View file

@ -1,53 +1,67 @@
- name: mosdepth - name: mosdepth test_mosdepth
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags: tags:
- mosdepth - mosdepth
files: files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi - path: output/mosdepth/test.mosdepth.global.dist.txt
md5sum: b2aad62c41a7146680d31df505fcc8c5 md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: ./output/mosdepth/test.per-base.bed.gz - path: output/mosdepth/test.mosdepth.summary.txt
md5sum: 11b3f649072c2c7453febb085b1a9c33 md5sum: 4f0d231060cbde4efdd673863bd2fb59
- path: ./output/mosdepth/test.mosdepth.global.dist.txt - path: output/mosdepth/test.per-base.bed.gz
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a md5sum: bc1df47d46f818fee5275975925d769a
- path: ./output/mosdepth/test.mosdepth.summary.txt - path: output/mosdepth/test.per-base.bed.gz.csi
md5sum: 7b249dd3b3e58cc122fbd25ea84aa25d md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4
- name: mosdepth window - name: mosdepth test_mosdepth_bed
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_window -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_bed -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags: tags:
- mosdepth - mosdepth
files: files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi - path: output/mosdepth/test.mosdepth.global.dist.txt
md5sum: b2aad62c41a7146680d31df505fcc8c5 md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: ./output/mosdepth/test.per-base.bed.gz - path: output/mosdepth/test.mosdepth.region.dist.txt
md5sum: 11b3f649072c2c7453febb085b1a9c33 md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: ./output/mosdepth/test.mosdepth.global.dist.txt - path: output/mosdepth/test.mosdepth.summary.txt
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a md5sum: 96c037f769974b904beb53edc4f56d82
- path: ./output/mosdepth/test.regions.bed.gz - path: output/mosdepth/test.per-base.bed.gz
md5sum: 64e1ced01c4443d7c1796ef553992f0c md5sum: bc1df47d46f818fee5275975925d769a
- path: ./output/mosdepth/test.regions.bed.gz.csi - path: output/mosdepth/test.per-base.bed.gz.csi
md5sum: 9e312b4b0784bd46dfbd23b3a8afed6a md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4
- path: ./output/mosdepth/test.mosdepth.region.dist.txt - path: output/mosdepth/test.regions.bed.gz
md5sum: 65fbc824c4212c6884354d8ac72ad37e md5sum: 5d398caf7171ec4406278e2add3009ae
- path: ./output/mosdepth/test.mosdepth.summary.txt - path: output/mosdepth/test.regions.bed.gz.csi
md5sum: 11804907dab069ddb99ca97bf2698572 md5sum: 47669cfe41f3e222e74d81e1b1be191f
- name: mosdepth bed - name: mosdepth test_mosdepth_cram
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_bed -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_cram -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags: tags:
- mosdepth - mosdepth
files: files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi - path: output/mosdepth/test.mosdepth.global.dist.txt
md5sum: b2aad62c41a7146680d31df505fcc8c5 md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: ./output/mosdepth/test.per-base.bed.gz - path: output/mosdepth/test.mosdepth.summary.txt
md5sum: 11b3f649072c2c7453febb085b1a9c33 md5sum: 4f0d231060cbde4efdd673863bd2fb59
- path: ./output/mosdepth/test.mosdepth.global.dist.txt - path: output/mosdepth/test.per-base.bed.gz
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a md5sum: bc1df47d46f818fee5275975925d769a
- path: ./output/mosdepth/test.regions.bed.gz - path: output/mosdepth/test.per-base.bed.gz.csi
md5sum: 347f877700d1dc42c95157199eff25d5 md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4
- path: ./output/mosdepth/test.regions.bed.gz.csi
md5sum: ed5fbf46e3bdcbf60094df295bc40356 - name: mosdepth test_mosdepth_cram_bed
- path: ./output/mosdepth/test.mosdepth.region.dist.txt command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_cram_bed -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
md5sum: 295564628113d2ec0ca34d7f661cfea8 tags:
- path: ./output/mosdepth/test.mosdepth.summary.txt - mosdepth
md5sum: b07817412fd17819c14541e63bc4926c files:
- path: output/mosdepth/test.mosdepth.global.dist.txt
md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: output/mosdepth/test.mosdepth.region.dist.txt
md5sum: e82e90c7d508a135b5a8a7cd6933452e
- path: output/mosdepth/test.mosdepth.summary.txt
md5sum: 96c037f769974b904beb53edc4f56d82
- path: output/mosdepth/test.per-base.bed.gz
md5sum: bc1df47d46f818fee5275975925d769a
- path: output/mosdepth/test.per-base.bed.gz.csi
md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4
- path: output/mosdepth/test.regions.bed.gz
md5sum: 5d398caf7171ec4406278e2add3009ae
- path: output/mosdepth/test.regions.bed.gz.csi
md5sum: 47669cfe41f3e222e74d81e1b1be191f