Merge pull request #1701 from matthdsm/update/mosdepth

Mosdepth: add all remaining outputs
This commit is contained in:
Harshil Patel 2022-05-25 19:46:37 +01:00 committed by GitHub
commit f89b76afa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 48 deletions

View file

@ -13,15 +13,19 @@ process MOSDEPTH {
path fasta 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('*.summary.txt') , emit: summary_txt
tuple val(meta), path('*.summary.txt') , emit: summary_txt tuple val(meta), path('*.region.dist.txt') , optional:true, emit: regions_txt
tuple val(meta), path('*.per-base.d4') , emit: per_base_d4 , optional:true tuple val(meta), path('*.per-base.d4') , optional:true, emit: per_base_d4
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed, optional:true tuple val(meta), path('*.per-base.bed.gz') , optional:true, emit: per_base_bed
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi, optional:true tuple val(meta), path('*.per-base.bed.gz.csi') , optional:true, emit: per_base_csi
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed , optional:true tuple val(meta), path('*.regions.bed.gz') , optional:true, emit: regions_bed
tuple val(meta), path('*.regions.bed.gz.csi') , emit: regions_csi , optional:true tuple val(meta), path('*.regions.bed.gz.csi') , optional:true, emit: regions_csi
path "versions.yml" , emit: versions tuple val(meta), path('*.quantized.bed.gz') , optional:true, emit: quantized_bed
tuple val(meta), path('*.quantized.bed.gz.csi') , optional:true, emit: quantized_csi
tuple val(meta), path('*.thresholds.bed.gz') , optional:true, emit: thresholds_bed
tuple val(meta), path('*.thresholds.bed.gz.csi'), optional:true, emit: thresholds_csi
path "versions.yml" , emit: versions
when: when:
task.ext.when == null || task.ext.when task.ext.when == null || task.ext.when
@ -34,10 +38,13 @@ process MOSDEPTH {
if (bed && args.contains("--by")) { if (bed && args.contains("--by")) {
exit 1, "'--by' can only be specified once when running mosdepth! Either remove input BED file definition or remove '--by' from 'ext.args' definition" exit 1, "'--by' can only be specified once when running mosdepth! Either remove input BED file definition or remove '--by' from 'ext.args' definition"
} }
if (!bed && args.contains("--thresholds")) {
exit 1, "'--thresholds' can only be specified in conjunction with '--by'"
}
""" """
mosdepth \\ mosdepth \\
--threads ${task.cpus} \\ --threads $task.cpus \\
$interval \\ $interval \\
$reference \\ $reference \\
$args \\ $args \\
@ -61,6 +68,10 @@ process MOSDEPTH {
touch ${prefix}.per-base.bed.gz.csi touch ${prefix}.per-base.bed.gz.csi
touch ${prefix}.regions.bed.gz touch ${prefix}.regions.bed.gz
touch ${prefix}.regions.bed.gz.csi touch ${prefix}.regions.bed.gz.csi
touch ${prefix}.quantized.bed.gz
touch ${prefix}.quantized.bed.gz.csi
touch ${prefix}.thresholds.bed.gz
touch ${prefix}.thresholds.bed.gz.csi
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -72,6 +72,22 @@ output:
type: file type: file
description: Index file for BED file with per-region coverage description: Index file for BED file with per-region coverage
pattern: "*.{regions.bed.gz.csi}" pattern: "*.{regions.bed.gz.csi}"
- quantized_bed:
type: file
description: BED file with binned coverage
pattern: "*.{quantized.bed.gz}"
- quantized_csi:
type: file
description: Index file for BED file with binned coverage
pattern: "*.{quantized.bed.gz.csi}"
- thresholds_bed:
type: file
description: BED file with the number of bases in each region that are covered at or above each threshold
pattern: "*.{thresholds.bed.gz}"
- thresholds_csi:
type: file
description: Index file for BED file with threshold coverage
pattern: "*.{thresholds.bed.gz.csi}"
- versions: - versions:
type: file type: file
description: File containing software versions description: File containing software versions

View file

@ -2,72 +2,95 @@
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_FAIL } from '../../../modules/mosdepth/main.nf'
include { MOSDEPTH as MOSDEPTH_WINDOW } from '../../../modules/mosdepth/main.nf' include { MOSDEPTH as MOSDEPTH_WINDOW } from '../../../modules/mosdepth/main.nf'
include { MOSDEPTH as MOSDEPTH_THRESHOLD } from '../../../modules/mosdepth/main.nf'
include { MOSDEPTH as MOSDEPTH_QUANTIZED } from '../../../modules/mosdepth/main.nf'
workflow test_mosdepth { workflow test_mosdepth {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ] file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
] ]
MOSDEPTH ( input, [], [] ) MOSDEPTH ( input, [], [] )
} }
workflow test_mosdepth_bed { workflow test_mosdepth_bed {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], 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) ] bed = file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
MOSDEPTH ( input, bed, [] ) MOSDEPTH ( input, bed, [] )
} }
workflow test_mosdepth_cram { workflow test_mosdepth_cram {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], 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) ] fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
MOSDEPTH ( input, [], fasta ) MOSDEPTH ( input, [], fasta )
} }
workflow test_mosdepth_cram_bed { workflow test_mosdepth_cram_bed {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], 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) ] bed = file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
fasta = [ file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) ] fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
MOSDEPTH ( input, bed, fasta ) MOSDEPTH ( input, bed, fasta )
} }
workflow test_mosdepth_window { workflow test_mosdepth_window {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], 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) ] bed = file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
MOSDEPTH_WINDOW ( input, [], [] ) MOSDEPTH_WINDOW ( input, [], [] )
} }
workflow test_mosdepth_quantized {
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)
]
MOSDEPTH_QUANTIZED ( input, [], [] )
}
workflow test_mosdepth_thresholds {
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_THRESHOLD ( input, bed, [] )
}
workflow test_mosdepth_fail { workflow test_mosdepth_fail {
input = [ input = [
[ id:'test', single_end:true ], [ 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'], checkIfExists: true),
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], 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) ] bed = file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)
MOSDEPTH_FAIL ( input, bed, [] ) MOSDEPTH_FAIL ( input, bed, [] )
} }

View file

@ -7,4 +7,10 @@ process {
withName: MOSDEPTH_WINDOW { withName: MOSDEPTH_WINDOW {
ext.args = "--by 100" ext.args = "--by 100"
} }
withName: MOSDEPTH_QUANTIZED {
ext.args = "--quantize 0:1:4:100:200"
}
withName: MOSDEPTH_THRESHOLD {
ext.args = "--thresholds 1,10,20,30"
}
} }

View file

@ -86,6 +86,48 @@
- path: output/mosdepth/test.regions.bed.gz.csi - path: output/mosdepth/test.regions.bed.gz.csi
md5sum: 257d67678136963d9dd904330079609d md5sum: 257d67678136963d9dd904330079609d
- name: mosdepth test_mosdepth_quantized
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_quantized -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.summary.txt
md5sum: 4f0d231060cbde4efdd673863bd2fb59
- 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.quantized.bed.gz
md5sum: 3e434a8bafcf59a67841ae3d4d752838
- path: output/mosdepth/test.quantized.bed.gz.csi
md5sum: be9617f551f19a33923f1e886eaefb93
- name: mosdepth test_mosdepth_thresholds
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_thresholds -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: 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
- path: output/mosdepth/test.thresholds.bed.gz
md5sum: 13101e326eea3cbfa1d569b69f494f4c
- path: output/mosdepth/test.thresholds.bed.gz.csi
md5sum: 912055ee9452229439df6fae95644196
- name: mosdepth test_mosdepth_fail - 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 command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_fail -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags: tags: