mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Merge pull request #1693 from matthdsm/update/mosdepth
mosdepth: cram compatiblility
This commit is contained in:
commit
2c0b0df088
5 changed files with 166 additions and 77 deletions
|
@ -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,19 +29,21 @@ 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 ) {
|
if (bed && args.contains("--by")) {
|
||||||
interval = "--by ${bed}"
|
exit 1, "'--by' can only be specified once when running mosdepth! Either remove input BED file definition or remove '--by' from 'ext.args' definition"
|
||||||
} else {
|
|
||||||
interval = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mosdepth \\
|
mosdepth \\
|
||||||
|
--threads ${task.cpus} \\
|
||||||
$interval \\
|
$interval \\
|
||||||
|
$reference \\
|
||||||
$args \\
|
$args \\
|
||||||
$prefix \\
|
$prefix \\
|
||||||
$bam
|
$bam
|
||||||
|
|
||||||
cat <<-END_VERSIONS > versions.yml
|
cat <<-END_VERSIONS > versions.yml
|
||||||
"${task.process}":
|
"${task.process}":
|
||||||
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
|
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -2,35 +2,72 @@
|
||||||
|
|
||||||
nextflow.enable.dsl = 2
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
include { MOSDEPTH } from '../../../modules/mosdepth/main.nf'
|
include { MOSDEPTH } from '../../../modules/mosdepth/main.nf'
|
||||||
|
include { MOSDEPTH as MOSDEPTH_FAIL } from '../../../modules/mosdepth/main.nf'
|
||||||
|
include { MOSDEPTH as MOSDEPTH_WINDOW } 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 )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_mosdepth_window {
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end: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['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ]
|
||||||
|
|
||||||
|
MOSDEPTH_WINDOW ( input, [], [] )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_mosdepth_fail {
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end: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['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ]
|
||||||
|
|
||||||
|
MOSDEPTH_FAIL ( input, bed, [] )
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
process {
|
process {
|
||||||
|
|
||||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
withName: MOSDEPTH_FAIL {
|
||||||
|
ext.args = "--by 100"
|
||||||
|
}
|
||||||
|
withName: MOSDEPTH_WINDOW {
|
||||||
|
ext.args = "--by 100"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,93 @@
|
||||||
- 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
|
||||||
|
|
||||||
|
- name: mosdepth test_mosdepth_window
|
||||||
|
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_window -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
|
||||||
|
tags:
|
||||||
|
- mosdepth
|
||||||
|
files:
|
||||||
|
- path: output/mosdepth/test.mosdepth.global.dist.txt
|
||||||
|
md5sum: e82e90c7d508a135b5a8a7cd6933452e
|
||||||
|
- path: output/mosdepth/test.mosdepth.region.dist.txt
|
||||||
|
md5sum: 39e0e707ec32feb5176fd20a95f1f468
|
||||||
|
- 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: f02e2cb49cc050e13d76942d6960827a
|
||||||
|
- path: output/mosdepth/test.regions.bed.gz.csi
|
||||||
|
md5sum: 257d67678136963d9dd904330079609d
|
||||||
|
|
||||||
|
- name: mosdepth test_mosdepth_fail
|
||||||
|
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_fail -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
|
||||||
|
tags:
|
||||||
|
- mosdepth
|
||||||
|
exit_code: 1
|
||||||
|
|
Loading…
Reference in a new issue