@@ -13,87 +13,71 @@ workflow ANNOTATE_STRUCTURAL_VARIANTS {
1313
1414 take :
1515 ch_vcf // channel: [mandatory] [ val(meta), path(vcf) ]
16- ch_sv_dbs // channel : [mandatory] [ val(csv) ]
17- ch_sv_bedpedbs // channel : [mandatory] [ val(csv) ]
16+ svdb_query_bedpedbs // String : [optional] params.svdb_query_bedpedbs
17+ svdb_query_dbs // String : [optional] params.svdb_query_dbs
1818 val_vep_genome // string: [mandatory] GRCh37 or GRCh38
1919 val_vep_cache_version // string: [mandatory] default: 107
20+ ch_svdb_bedpedbs // channel: [optional]
21+ ch_svdb_dbs // channel: [optional]
2022 ch_vep_cache // channel: [mandatory] [ path(cache) ]
2123 ch_genome_fasta // channel: [mandatory] [ val(meta), path(fasta) ]
2224 ch_genome_dictionary // channel: [mandatory] [ val(meta), path(dict) ]
2325 ch_vep_extra_files // channel: [mandatory] [ path(files) ]
2426
2527 main :
2628 ch_versions = channel. empty()
27- ch_svdb_dbs = channel. empty()
28- ch_svdb_bedpedbs = channel. empty()
29-
30- ch_sv_dbs
31- .splitCsv ( header :true )
32- .multiMap { row ->
33- vcf_dbs : row. filename
34- in_frqs : row. in_freq_info_key
35- in_occs : row. in_allele_count_info_key
36- out_frqs : row. out_freq_info_key
37- out_occs : row. out_allele_count_info_key
38- }
39- .set { ch_svdb_dbs }
40-
41- ch_sv_bedpedbs
42- .splitCsv ( header :true )
43- .multiMap { row ->
44- bedpedbs : row. filename
45- in_frqs : row. in_freq_info_key
46- in_occs : row. in_allele_count_info_key
47- out_frqs : row. out_freq_info_key
48- out_occs : row. out_allele_count_info_key
49- }
50- .set { ch_svdb_bedpedbs }
51-
52- SVDB_QUERY_DB (
53- ch_vcf,
54- ch_svdb_dbs. in_occs. toList(),
55- ch_svdb_dbs. in_frqs. toList(),
56- ch_svdb_dbs. out_occs. toList(),
57- ch_svdb_dbs. out_frqs. toList(),
58- ch_svdb_dbs. vcf_dbs. toList(),
59- []
60- )
61-
62- ch_vcf
63- .join(SVDB_QUERY_DB . out. vcf, remainder : true )
64- .branch { meta, vcfcalls, annotatedvcf ->
65- original_call : annotatedvcf. equals(null )
66- return [meta, vcfcalls]
67- annotated_with_db : ! (annotatedvcf. equals(null ))
68- return [meta, annotatedvcf]
69- }
70- .set { ch_for_mix_querydb }
71-
72- ch_querydb_out = ch_for_mix_querydb. original_call. mix(ch_for_mix_querydb. annotated_with_db)
73-
74- SVDB_QUERY_BEDPE (
75- ch_querydb_out,
76- ch_svdb_bedpedbs. in_occs. toList(),
77- ch_svdb_bedpedbs. in_frqs. toList(),
78- ch_svdb_bedpedbs. out_occs. toList(),
79- ch_svdb_bedpedbs. out_frqs. toList(),
80- [],
81- ch_svdb_bedpedbs. bedpedbs. toList()
82- )
83-
84- ch_querydb_out
85- .join(SVDB_QUERY_BEDPE . out. vcf, remainder : true )
86- .branch { meta, annotated_db, annotated_bedped ->
87- querydb_out : annotated_bedped. equals(null )
88- return [meta, annotated_db]
89- querybedped_out : ! (annotated_bedped. equals(null ))
90- return [meta, annotated_bedped]
91- }
92- .set { ch_for_mix_querybedpedb }
93-
94- ch_querypedbed_out = ch_for_mix_querybedpedb. querydb_out. mix(ch_for_mix_querybedpedb. querybedped_out)
9529
96- PICARD_SORTVCF (ch_querypedbed_out, ch_genome_fasta, ch_genome_dictionary)
30+ if (svdb_query_dbs) {
31+ ch_svdb_dbs
32+ .multiMap { file, in_freq_info_key, in_allele_count_info_key, out_freq_info_key, out_allele_count_info_key ->
33+ vcf_dbs : file
34+ in_frqs : in_freq_info_key
35+ in_occs : in_allele_count_info_key
36+ out_frqs : out_freq_info_key
37+ out_occs : out_allele_count_info_key
38+ }
39+ .set { ch_svdb_dbs }
40+
41+ SVDB_QUERY_DB (
42+ ch_vcf,
43+ ch_svdb_dbs. in_occs. toList(),
44+ ch_svdb_dbs. in_frqs. toList(),
45+ ch_svdb_dbs. out_occs. toList(),
46+ ch_svdb_dbs. out_frqs. toList(),
47+ ch_svdb_dbs. vcf_dbs. toList(),
48+ []
49+ )
50+
51+ ch_vcf = SVDB_QUERY_DB . out. vcf
52+ ch_versions = ch_versions. mix(SVDB_QUERY_DB . out. versions)
53+ }
54+
55+ if (svdb_query_bedpedbs) {
56+ ch_svdb_bedpedbs
57+ .multiMap { file, in_freq_info_key, in_allele_count_info_key, out_freq_info_key, out_allele_count_info_key ->
58+ bedpedbs : file
59+ in_frqs : in_freq_info_key
60+ in_occs : in_allele_count_info_key
61+ out_frqs : out_freq_info_key
62+ out_occs : out_allele_count_info_key
63+ }
64+ .set { ch_svdb_bedpedbs }
65+
66+ SVDB_QUERY_BEDPE (
67+ ch_vcf,
68+ ch_svdb_bedpedbs. in_occs. toList(),
69+ ch_svdb_bedpedbs. in_frqs. toList(),
70+ ch_svdb_bedpedbs. out_occs. toList(),
71+ ch_svdb_bedpedbs. out_frqs. toList(),
72+ [],
73+ ch_svdb_bedpedbs. bedpedbs. toList()
74+ )
75+
76+ ch_vcf = SVDB_QUERY_BEDPE . out. vcf
77+ ch_versions = ch_versions. mix(SVDB_QUERY_BEDPE . out. versions)
78+ }
79+
80+ PICARD_SORTVCF (ch_vcf, ch_genome_fasta, ch_genome_dictionary)
9781
9882 PICARD_SORTVCF . out. vcf
9983 .map { meta, vcf -> return [meta,vcf,[]] }
@@ -116,8 +100,6 @@ workflow ANNOTATE_STRUCTURAL_VARIANTS {
116100
117101 TABIX_VEP (ENSEMBLVEP_SV . out. vcf)
118102
119- ch_versions = ch_versions. mix(SVDB_QUERY_DB . out. versions)
120- ch_versions = ch_versions. mix(SVDB_QUERY_BEDPE . out. versions)
121103 ch_versions = ch_versions. mix(PICARD_SORTVCF . out. versions)
122104 ch_versions = ch_versions. mix(BCFTOOLS_VIEW . out. versions)
123105 ch_versions = ch_versions. mix(ENSEMBLVEP_SV . out. versions)
0 commit comments