Skip to content

Commit

Permalink
Merge pull request #123 from nf-cmgg/panel-coverage-efficiency
Browse files Browse the repository at this point in the history
update efficiency of panel coverage
  • Loading branch information
matthdsm authored Jan 23, 2025
2 parents 7e8e7a9 + 03f7b62 commit 58c7e1e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## dev

# v2.0.4
- Panel coverage will now run all genelists' coverage analysis in one process per sample

## v2.0.4

- Add flag to `snap` to allow for more expansion of compressed data
- Parse readgroup samplenames for `snp_` prefixed samples
Expand Down
16 changes: 12 additions & 4 deletions modules/local/panelcoverage/main.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process PANELCOVERAGE {
tag "$meta.id - $genelist"
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
Expand All @@ -8,7 +8,8 @@ process PANELCOVERAGE {
'biocontainers/bedtools:2.31.1--hf5e1c6e_1' }"

input:
tuple val(meta), path(perbase), path(perbase_index), path(genelist)
tuple val(meta), path(perbase), path(perbase_index)
path(genelists)

output:
tuple val(meta), path("*.mosdepth.region.dist.txt"), emit: regiondist
Expand All @@ -20,7 +21,10 @@ process PANELCOVERAGE {
script:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
cmgg_genelists regiondist --samplename ${prefix} --perbase ${perbase} --genelist ${genelist}
for GENELIST in $genelists
do
cmgg_genelists regiondist --samplename ${prefix} --perbase ${perbase} --genelist \$GENELIST
done
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -32,7 +36,11 @@ process PANELCOVERAGE {
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_genelist.mosdepth.region.dist.txt
for GENELIST in $genelists
do
name=\$(basename \$GENELIST .bed)
touch ${prefix}_\${name}.mosdepth.region.dist.txt
done
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
4 changes: 2 additions & 2 deletions subworkflows/local/coverage/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ workflow COVERAGE {

PANELCOVERAGE(
MOSDEPTH.out.per_base_bed
.join(MOSDEPTH.out.per_base_csi)
.combine(ch_genelists)
.join(MOSDEPTH.out.per_base_csi),
ch_genelists
)
ch_versions = ch_versions.mix(PANELCOVERAGE.out.versions.first())
ch_coverageqc_files = ch_coverageqc_files.mix(PANELCOVERAGE.out.regiondist)
Expand Down
2 changes: 2 additions & 0 deletions tests/modules/local/panelcoverage/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ nextflow_process {
[id: "test", single_end: false ],
file("https://github.com/nf-cmgg/test-datasets/raw/preprocessing/data/genomics/homo_sapiens/illumina/bed/sample1.per-base.bed.gz", checkIfExists:true),
file("https://github.com/nf-cmgg/test-datasets/raw/preprocessing/data/genomics/homo_sapiens/illumina/bed/sample1.per-base.bed.gz.csi", checkIfExists:true),
]
input[1] = [
file("https://github.com/nf-cmgg/test-datasets/raw/preprocessing/data/genomics/homo_sapiens/illumina/regions/genelists/genelist_chr21_per_exon.bed",checkIfExists:true)
]
"""
Expand Down
2 changes: 1 addition & 1 deletion workflows/preprocessing.nf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ workflow PREPROCESSING {

roi = roi ? file(roi, checkIfExists:true) : null

genelists = genelists ? file(genelists + "/*.bed", checkIfExists:true) : []
genelists = genelists ? Channel.value(file(genelists + "/*.bed", checkIfExists:true)) : Channel.empty()

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 58c7e1e

Please sign in to comment.