Skip to content

Commit 456776c

Browse files
committed
Update upd logic
1 parent 15ea029 commit 456776c

5 files changed

Lines changed: 561 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
- Saltshaker for downstream processing of mitochondrial SV calls from MitoSAlt [#775](https://github.com/nf-core/raredisease/pull/775)
2828
- Env variable NXF_SINGULARITY_NEW_PID_NAMESPACE = false to accommodate hisat2 running with latest Nextflow and Singularity [#775](https://github.com/nf-core/raredisease/pull/775)
2929
- Parameter `exclude_alt` to filter alignments to alt/unplaced contigs after alignment using samtools view, retaining only primary chromosomes (GRCh37: 1-22,X,Y,MT / GRCh38: chr1-chr22,chrX,chrY,chrM). Note that enabling this will restrict variant calling to these chromosomes [#803](https://github.com/nf-core/raredisease/pull/803)]
30+
- Run UPD_SITES, UPD_REGIONS, and CHROMOGRAPH for UPD only when analysis type is WGS [#805](https://github.com/nf-core/raredisease/pull/805)
3031

3132
### `Changed`
3233

subworkflows/local/annotate_genome_snvs/main.nf

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ workflow ANNOTATE_GENOME_SNVS {
3535
ch_vcfanno_toml // channel: [mandatory] [ path(toml) ]
3636
ch_vep_cache // channel: [mandatory] [ path(cache) ]
3737
ch_vep_extra_files // channel: [mandatory] [ path(files) ]
38+
val_analysis_type // string: wgs, wes, or mito
3839
val_cadd_resources // string: path to cadd resources file
3940
val_genome // string: GRCh37 or GRCh38
4041
val_vep_cache_version // string: vep version ex: 107
4142

4243
main:
43-
ch_cadd_vcf = channel.empty()
44-
ch_vcf_scatter_in = channel.empty()
45-
ch_vep_in = channel.empty()
44+
ch_cadd_vcf = channel.empty()
45+
ch_vcf_scatter_in = channel.empty()
46+
ch_vep_in = channel.empty()
47+
ch_chromograph_publish = channel.empty()
4648

4749
ch_vcf
4850
.filter { meta, _vcf, _tbi ->
@@ -176,10 +178,14 @@ workflow ANNOTATE_GENOME_SNVS {
176178
}
177179
.set { ch_upd_in }
178180

179-
UPD_SITES(ch_upd_in)
180-
UPD_REGIONS(ch_upd_in)
181-
CHROMOGRAPH_SITES([[],[]], [[],[]], [[],[]], [[],[]], [[],[]], [[],[]], UPD_SITES.out.bed)
182-
CHROMOGRAPH_REGIONS([[],[]], [[],[]], [[],[]], [[],[]], [[],[]], UPD_REGIONS.out.bed, [[],[]])
181+
if (val_analysis_type.equals("wgs")) {
182+
UPD_SITES(ch_upd_in)
183+
UPD_REGIONS(ch_upd_in)
184+
CHROMOGRAPH_SITES([[],[]], [[],[]], [[],[]], [[],[]], [[],[]], [[],[]], UPD_SITES.out.bed)
185+
CHROMOGRAPH_REGIONS([[],[]], [[],[]], [[],[]], [[],[]], [[],[]], UPD_REGIONS.out.bed, [[],[]])
186+
ch_chromograph_publish = CHROMOGRAPH_SITES.out.plots
187+
.mix(CHROMOGRAPH_REGIONS.out.plots)
188+
}
183189

184190
BCFTOOLS_CONCAT.out.vcf
185191
.map { meta, vcf -> [meta - meta.subMap('prefix'), vcf] }
@@ -193,8 +199,7 @@ workflow ANNOTATE_GENOME_SNVS {
193199
//rhocall_viz
194200
ANNOTATE_RHOCALLVIZ(ch_genome_chrsizes, ch_samples, ch_vep_ann_index )
195201

196-
ch_publish = CHROMOGRAPH_SITES.out.plots
197-
.mix(CHROMOGRAPH_REGIONS.out.plots)
202+
ch_publish = ch_chromograph_publish
198203
.mix(ch_concat_vcf_out)
199204
.mix(ch_concat_tbi_out)
200205
.map { meta, value -> ['annotate_snv/genome/', [meta, value]] }

subworkflows/local/annotate_genome_snvs/tests/main.nf.test

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ nextflow_workflow {
2222

2323
config "./nextflow.config"
2424

25-
test("ANNOTATE_GENOME_SNVS - GRCh37, stub") {
25+
test("ANNOTATE_GENOME_SNVS - GRCh37, wgs, stub") {
2626

2727
options "-stub"
2828

@@ -38,7 +38,7 @@ nextflow_workflow {
3838
input[6] = channel.of([id:'earlycasualcaiman', sample:'earlycasualcaiman', sex:1, phenotype:2, paternal:0, maternal:0, case_id:'justhusky'])
3939
input[7] = channel.of(file(params.pipelines_testdata_base_path + 'reference/target_wgs.interval_list', checkIfExists: true))
4040
input[8] = channel.of([
41-
[id:'justhusky', probands:['earlycasualcaiman'], upd_children:[], mother:'', father:''],
41+
[id:'justhusky', probands:['earlycasualcaiman'], upd_children:['earlycasualcaiman'], mother:'', father:''],
4242
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
4343
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
4444
])
@@ -48,9 +48,10 @@ nextflow_workflow {
4848
input[12] = channel.of(file(params.pipelines_testdata_base_path + 'reference/vcfanno_config.toml', checkIfExists: true)).collect()
4949
input[13] = channel.of(file(params.pipelines_testdata_base_path + 'reference/vep_cache_and_plugins.tar.gz', checkIfExists: true)).collect()
5050
input[14] = channel.value([])
51-
input[15] = null
52-
input[16] = 'GRCh37'
53-
input[17] = 107
51+
input[15] = 'wgs'
52+
input[16] = null
53+
input[17] = 'GRCh37'
54+
input[18] = 107
5455
"""
5556
}
5657
}
@@ -76,4 +77,57 @@ nextflow_workflow {
7677
)
7778
}
7879
}
80+
81+
test("ANNOTATE_GENOME_SNVS - GRCh37, wes, stub") {
82+
83+
options "-stub"
84+
85+
when {
86+
workflow {
87+
"""
88+
input[0] = channel.of([[id:'resources'], file('https://raw.githubusercontent.com/nf-core/raredisease/refs/heads/master/assets/cadd_to_vcf_header_-1.0-.txt', checkIfExists: true)]).collect()
89+
input[1] = Channel.from(env('PWD')).map { dir -> [ [ id: 'cadd_resources' ], dir ] }
90+
input[2] = channel.of(file(params.pipelines_testdata_base_path + 'reference/reference_chr.sizes', checkIfExists: true)).collect()
91+
input[3] = channel.of([[id:'genome'], file(params.pipelines_testdata_base_path + 'reference/reference.fasta.fai', checkIfExists: true)]).collect()
92+
input[4] = channel.of([[id:'genome'], file(params.pipelines_testdata_base_path + 'reference/reference.fasta', checkIfExists: true)]).collect()
93+
input[5] = channel.value([[],[]])
94+
input[6] = channel.of([id:'earlycasualcaiman', sample:'earlycasualcaiman', sex:1, phenotype:2, paternal:0, maternal:0, case_id:'justhusky'])
95+
input[7] = channel.of(file(params.pipelines_testdata_base_path + 'reference/target_wgs.interval_list', checkIfExists: true))
96+
input[8] = channel.of([
97+
[id:'justhusky', probands:['earlycasualcaiman'], upd_children:['earlycasualcaiman'], mother:'', father:''],
98+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true),
99+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true)
100+
])
101+
input[9] = channel.value([[]])
102+
input[10] = channel.of(file(params.pipelines_testdata_base_path + 'reference/vcfanno_functions.lua', checkIfExists: true)).collect()
103+
input[11] = channel.value(file(params.pipelines_testdata_base_path + 'reference/grch38_gnomad_reformated_-r3.1.1-.vcf.gz', checkIfExists: true))
104+
input[12] = channel.of(file(params.pipelines_testdata_base_path + 'reference/vcfanno_config.toml', checkIfExists: true)).collect()
105+
input[13] = channel.of(file(params.pipelines_testdata_base_path + 'reference/vep_cache_and_plugins.tar.gz', checkIfExists: true)).collect()
106+
input[14] = channel.value([])
107+
input[15] = 'wes'
108+
input[16] = null
109+
input[17] = 'GRCh37'
110+
input[18] = 107
111+
"""
112+
}
113+
}
114+
115+
then {
116+
assertAll(
117+
{ assert workflow.success },
118+
{ assert snapshot(
119+
workflow.out.collect { name, channel ->
120+
def sorted_channel = channel.toList().sort { item ->
121+
def sortKey = item
122+
while (sortKey instanceof List) {
123+
sortKey = sortKey[-1]
124+
}
125+
sortKey.toString().split(':md5,')[0].tokenize('/')[-1]
126+
}
127+
[name, sorted_channel]
128+
}.sort { it[0] }
129+
).match() }
130+
)
131+
}
132+
}
79133
}

0 commit comments

Comments
 (0)