Skip to content

Commit 81ea672

Browse files
committed
Add support for variant scoring by MIVMIR, GICAM models
Signed-off-by: Tor Björgen <tor.bjorgen@scilifelab.se>
1 parent a68931d commit 81ea672

22 files changed

Lines changed: 918 additions & 26 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Parameters `save_all_mapped_as_cram` and `save_noalt_mapped_as_cram` to replace `save_mapped_as_cram`, allowing independent control over publishing unfiltered and alt-filtered alignment files as CRAM [#807](https://github.com/nf-core/raredisease/pull/807)
3333
- Parameter `run_vcfanno_db_sanity_check` to check vcfanno database files for zero records and remove the corresponding annotation blocks from the TOML config before running vcfanno [#821](https://github.com/nf-core/raredisease/pull/821)
3434
- Added `--skip_split_multiallelics` parameter to allow users to skip the `bcftools norm --multiallelics -both` step in SNV calling (DeepVariant and Sentieon), which can cause indel quality degradation in single-interval runs [#823](https://github.com/nf-core/raredisease/pull/823)
35+
- Add SNV scoring by MIVMIR, GICAM models [#812](https://github.com/nf-core/raredisease/pull/812)
3536

3637
### `Changed`
3738

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ For more details about the output files and reports, please refer to the
175175

176176
nf-core/raredisease was written in a collaboration between the Clinical Genomics nodes in Sweden, with major contributions from [Ramprasad Neethiraj](https://github.com/ramprasadn), [Anders Jemt](https://github.com/jemten), [Lucia Pena Perez](https://github.com/Lucpen), and [Mei Wu](https://github.com/projectoriented) at Clinical Genomics Stockholm.
177177

178-
Additional contributors were [Sima Rahimi](https://github.com/sima-r), [Gwenna Breton](https://github.com/Gwennid) and [Emma Västerviga](https://github.com/EmmaCAndersson) (Clinical Genomics Gothenburg); [Halfdan Rydbeck](https://github.com/hrydbeck) and [Lauri Mesilaakso](https://github.com/ljmesi) (Clinical Genomics Linköping); [Subazini Thankaswamy Kosalai](https://github.com/sysbiocoder) (Clinical Genomics Örebro); [Annick Renevey](https://github.com/rannick), [Peter Pruisscher](https://github.com/peterpru) and [Eva Caceres](https://github.com/fevac) (Clinical Genomics Stockholm); [Ryan Kennedy](https://github.com/ryanjameskennedy) (Clinical Genomics Lund); [Anders Sune Pedersen](https://github.com/asp8200) (Danish National Genome Center) and [Lucas Taniguti](https://github.com/lmtani).
178+
Additional contributors were [Sima Rahimi](https://github.com/sima-r), [Gwenna Breton](https://github.com/Gwennid) and [Emma Västerviga](https://github.com/EmmaCAndersson) (Clinical Genomics Gothenburg); [Halfdan Rydbeck](https://github.com/hrydbeck) and [Lauri Mesilaakso](https://github.com/ljmesi) (Clinical Genomics Linköping); [Subazini Thankaswamy Kosalai](https://github.com/sysbiocoder) (Clinical Genomics Örebro); [Annick Renevey](https://github.com/rannick), [Peter Pruisscher](https://github.com/peterpru), [Eva Caceres](https://github.com/fevac) and [Tor Björgen](https://github.com/torbjorgen) (Clinical Genomics Stockholm); [Ryan Kennedy](https://github.com/ryanjameskennedy) (Clinical Genomics Lund); [Anders Sune Pedersen](https://github.com/asp8200) (Danish National Genome Center) and [Lucas Taniguti](https://github.com/lmtani).
179179

180180
We thank the nf-core community for their extensive assistance in the development of this pipeline.
181181

assets/rank_model_genmod_gicam.ini

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
[Version]
2+
version = 1
3+
name = rank_model_for_gicam
4+
5+
[Categories]
6+
7+
[[inheritance_models]]
8+
category_aggregation = min
9+
10+
[[variant_call_quality_filter]]
11+
category_aggregation = sum
12+
13+
[model_score]
14+
category = variant_call_quality_filter
15+
data_type = integer
16+
description = Inheritance model score
17+
field = INFO
18+
info_key = ModelScore
19+
record_rule = min
20+
separators = ',',':',
21+
22+
[[not_reported]]
23+
score = 0
24+
25+
[[low_qual]]
26+
score = -5
27+
lower = 0
28+
upper = 10
29+
30+
[[medium_qual]]
31+
score = -2
32+
lower = 10
33+
upper = 20
34+
35+
[[high_qual]]
36+
score = 0
37+
lower = 20
38+
upper = 300
39+
40+
[genetic_models]
41+
category = inheritance_models
42+
data_type = string
43+
description = Inheritance models followed for the variant
44+
field = INFO
45+
info_key = GeneticModels
46+
record_rule = max
47+
separators = ',', ':', '|',
48+
49+
[[ad]]
50+
priority = 1
51+
score = 1
52+
string = 'AD'
53+
54+
[[ad_dn]]
55+
score = 1
56+
priority = 1
57+
string = 'AD_dn'
58+
59+
[[ar]]
60+
score = 1
61+
priority = 1
62+
string = 'AR_hom'
63+
64+
[[ar_dn]]
65+
score = 1
66+
priority = 1
67+
string = 'AR_hom_dn'
68+
69+
[[ar_comp]]
70+
score = 1
71+
priority = 1
72+
string = 'AR_comp'
73+
74+
[[ar_comp_dn]]
75+
score = 1
76+
priority = 1
77+
string = 'AR_comp_dn'
78+
79+
[[xr]]
80+
score = 1
81+
priority = 1
82+
string = 'XR'
83+
84+
[[xr_dn]]
85+
score = 1
86+
priority = 1
87+
string = 'XR_dn'
88+
89+
[[xd]]
90+
score = 1
91+
priority = 1
92+
string = 'XD'
93+
94+
[[xd_dn]]
95+
score = 1
96+
priority = 1
97+
string = 'XD_dn'
98+
99+
[[not_reported]]
100+
score = -12
101+
102+
[filter]
103+
category = variant_call_quality_filter
104+
data_type = string
105+
description = The filters for the variant
106+
field = FILTER
107+
record_rule = min
108+
separators = ';',
109+
110+
[[not_reported]]
111+
score = 0
112+
113+
[[pass]]
114+
score = 3
115+
priority = 1
116+
string = 'PASS'
117+
118+
[[dot]]
119+
score = 3
120+
priority = 2
121+
string = '.'

conf/modules/rank_variants.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ process {
8383
ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" }
8484
}
8585

86+
withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIPTABIX_GICAM' {
87+
ext.prefix = { "${meta.id}_snv_ranked_gicam_${meta.set}" }
88+
}
89+
90+
withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIPTABIX_GENMOD_GICAM' {
91+
ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" }
92+
}
93+
94+
withName: '.*RANK_VARIANTS_SNV:BCFTOOLS_MERGE_GENMOD_GICAM' {
95+
ext.args = { "--columns MivmirScore,MivmirExplanation,GicamScore" }
96+
ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" }
97+
}
8698
}
8799

88100
//

docs/output.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
6969
- [Filtering and ranking](#filtering-and-ranking)
7070
- [Filter_vep](#filter_vep)
7171
- [GENMOD](#genmod)
72+
- [MIVMIR, GICAM](#mivmir-gicam)
7273
- [Mobile element analysis](#mobile-element-analysis)
7374
- [Calling mobile elements](#calling-mobile-elements)
7475
- [Annotating mobile elements](#annotating-mobile-elements)
@@ -527,6 +528,15 @@ We recommend using vcfanno to annotate SNVs with precomputed CADD scores (files
527528

528529
</details>
529530

531+
#### MIVMIR, GICAM
532+
533+
[MIVMIR](../modules/local/mivmir/meta.yml) and [GICAM](../modules/local/gicam/meta.yml) are two machine learning models used to
534+
infer a pathogenicity score for SNVs. In essence, MIVMIR infer SNV pathogenicity and GICAM improves precision for
535+
duo, trio, ... analysis. MIVMIR, GICAM can be enabled by setting the `--rank_with_mivmir_gicam` feature flag and
536+
adds annotations `INFO/MivmirScore`, `INFO/MivmirExplanation`, `INFO/GicamScore`.
537+
Only `<case_id>_snv_ranked_<research|clinical>.vcf.gz` contains the above annotations.
538+
Refer to the module documentation `.yml` for more information on required inputs and output formats.
539+
530540
### Mobile element analysis
531541

532542
#### Calling mobile elements

docs/usage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ The mandatory and optional parameters for each category are tabulated below.
290290
| vcfanno_toml<sup>3</sup> | vep_filters/vep_filters_scout_fmt<sup>10</sup> |
291291
| vep_cache_version | cadd_resources<sup>11</sup> |
292292
| vep_cache<sup>4</sup> | run_vcfanno_db_sanity_check<sup>12</sup> |
293-
| gnomad_af<sup>5</sup> | |
293+
| gnomad_af<sup>5</sup> | rank_with_mivmir_gicam<sup>13</sup> |
294294
| score_config_snv<sup>6</sup> | |
295295
| variant_consequences_snv<sup>7</sup> | |
296296
| vep_plugin_files<sup>8</sup> | |
@@ -310,6 +310,7 @@ no header and the following columns: `CHROM POS REF_ALLELE,ALT_ALLELE AF`. Sampl
310310
<sup>10</sup> This file contains a list of candidate genes (with [HGNC](https://www.genenames.org/) IDs) that is used to split the variants into candidate variants and research variants. Research variants contain all the variants, while candidate variants are a subset of research variants and are associated with candidate genes. Sample file [here](https://github.com/nf-core/test-datasets/blob/raredisease/reference/hgnc.txt). Not required if `--skip_subworkflows generate_clinical_set` is set. To skip this splitting entirely, add `generate_clinical_set` to `--skip_subworkflows`.<br />
311311
<sup>11</sup>Path to a folder containing cadd annotations. Equivalent of the data/annotations/ folder described [here](https://github.com/kircherlab/CADD-scripts/#manual-installation), and it is used to calculate CADD scores for small indels. <br />
312312
<sup>12</sup>When set to `true`, each vcfanno database file listed in `vcfanno_resources` is checked for records (non-header lines). Any database with zero records is removed from the vcfanno TOML config before annotation runs. Default: `false`.<br />
313+
<sup>13</sup> Enable variant SNV-INDEL scoring using MIVMIR, GICAM machine learning models.
313314

314315
:::note
315316
We use CADD only to annotate small indels. To annotate SNVs with precomputed CADD scores, pass the file containing CADD scores as a resource to vcfanno instead. Files containing the precomputed CADD scores for SNVs can be downloaded from [here](https://cadd.gs.washington.edu/download) (download files listed under the description: "All possible SNVs of GRCh3<7/8>/hg3<7/8>")

main.nf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ workflow NFCORE_RAREDISEASE {
106106
val_readcount_intervals
107107
val_reduced_penetrance
108108
val_rtg_truthvcfs
109+
val_rank_with_mivmir_gicam
109110
val_run_mt_for_wes
110111
val_run_rtgvcfeval
111112
val_run_vcfanno_db_sanity_check
@@ -217,6 +218,8 @@ workflow NFCORE_RAREDISEASE {
217218
ch_score_config_mt = channelFromPath(val_score_config_mt, true)
218219
ch_score_config_snv = channelFromPath(val_score_config_snv, true)
219220
ch_score_config_sv = channelFromPath(val_score_config_sv, true)
221+
// ch_genmod_gicam_score_config is integral to GICAM inference; it cannot be changed without retraining gicam
222+
ch_score_config_genmod_gicam = channel.fromPath("$projectDir/assets/rank_model_genmod_gicam.ini", checkIfExists: true).collect()
220223
ch_vcf2cytosure_blacklist = channelFromPath(val_vcf2cytosure_blacklist, true)
221224
ch_vcfanno_lua = channelFromPath(val_vcfanno_lua, true)
222225
ch_vcfanno_toml = channelFromPath(val_vcfanno_toml, true)
@@ -434,6 +437,7 @@ workflow NFCORE_RAREDISEASE {
434437
ch_score_config_mt,
435438
ch_score_config_snv,
436439
ch_score_config_sv,
440+
ch_score_config_genmod_gicam,
437441
ch_sdf,
438442
ch_sentieon_pcr_indel_model,
439443
ch_subdepth,
@@ -511,6 +515,7 @@ workflow NFCORE_RAREDISEASE {
511515
val_mt_subsample_rd,
512516
val_mt_subsample_seed,
513517
val_platform,
518+
val_rank_with_mivmir_gicam,
514519
val_run_mt_for_wes,
515520
val_run_rtgvcfeval,
516521
val_run_vcfanno_db_sanity_check,
@@ -624,6 +629,7 @@ workflow {
624629
params.readcount_intervals,
625630
params.reduced_penetrance,
626631
params.rtg_truthvcfs,
632+
params.rank_with_mivmir_gicam,
627633
params.run_mt_for_wes,
628634
params.run_rtgvcfeval,
629635
params.run_vcfanno_db_sanity_check,

modules/local/gicam/main.nf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
process GICAM_INFER {
2+
// https://github.com/Clinical-Genomics/rdds/tree/master/src/rdds/gicam
3+
4+
tag "${meta.id}"
5+
label 'process_high'
6+
7+
container "docker.io/clinicalgenomics/rdds_mivmir:v1.12.0-rc6"
8+
9+
beforeScript "mkdir ${task.workDir}/rdds-tmp"
10+
afterScript "rm -r ${task.workDir}/rdds-tmp"
11+
containerOptions {[
12+
workflow.containerEngine.equals("singularity") ? "--bind ${task.workDir}/rdds-tmp:/rdds/tmp" : "",
13+
workflow.containerEngine.equals("docker") ? "--tmpfs /rdds/tmp": "",
14+
""
15+
].minus("").join(" ")}
16+
17+
input:
18+
tuple val(meta), path(input_vcf)
19+
20+
output:
21+
tuple val(meta), path('*-predictions.vcf'), emit: vcf
22+
tuple val("${task.process}"), val('gicam'), val('v1.12.0-rc6'), topic: versions, emit: versions_gicam
23+
24+
when:
25+
task.ext.when == null || task.ext.when
26+
27+
script:
28+
"""
29+
. /opt/pyenv/bin/activate
30+
export PYTHONPATH=/rdds/src
31+
python3 -m rdds.gicam infer-vcf --cpu_cores ${task.cpus} ${input_vcf}
32+
"""
33+
}

modules/local/gicam/meta.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: gicam
2+
description: "Machine learning tool to improve precision for duo, trio, ... analysis"
3+
keywords:
4+
- score
5+
- ranking
6+
- gicam
7+
tools:
8+
- mivmir:
9+
description: Model for SNV ranking in conjunction with MIVMIR.
10+
This model improves precision for duo, trio, ... analysis situations by reducing MIVMIR scores for variants that's
11+
not following the appropriate GENMOD genetic inheritance model.
12+
Applied to MIVMIR scores as a post-processing step.
13+
14+
VCF key inputs to the model are
15+
- MivmirScore, (0, 1)
16+
- RankScoreNormalized, (0, 1) as produced by GENMOD using rank_model_genmod_gicam.ini custom scoring config
17+
18+
The tool adds one key to the VCF
19+
- GicamScore (0, 1) where 1.0 inferred pathogenic.
20+
21+
!NOTE! GICAM is optimized for the GENMOD scoring config present in this directory, that
22+
generates RankScoreNormalized. Changing the GENMOD scoring config will break inference
23+
(unless GICAM is first retrained on the new config).
24+
homepage: https://github.com/clinicalgenomics/rdds
25+
documentation: https://github.com/Clinical-Genomics/rdds/tree/master/src/rdds/gicam
26+
doi: ""
27+
licence: ["MIT"]
28+
identifier: ""
29+
input:
30+
- - meta:
31+
type: map
32+
description: |
33+
Groovy Map containing sample information
34+
e.g. [ id:'test', single_end:false ]
35+
- input_vcf:
36+
type: file
37+
description: vcf file
38+
pattern: "*.{vcf}"
39+
ontologies: []
40+
output:
41+
vcf:
42+
- - meta:
43+
type: map
44+
description: |
45+
Groovy Map containing sample information
46+
e.g. [ id:'test', single_end:false ]
47+
- "*-predictions.vcf":
48+
type: file
49+
description: Scored output VCF file
50+
pattern: "*.{vcf}"
51+
ontologies: []
52+
versions_gicam:
53+
- - "${task.process}":
54+
type: string
55+
description: The process the versions were collected from
56+
- "gicam":
57+
type: string
58+
description: The tool name
59+
- "version":
60+
type: string
61+
description: Tool version
62+
63+
topics:
64+
versions:
65+
- - "${task.process}":
66+
type: string
67+
description: The process the versions were collected from
68+
- "gicam":
69+
type: string
70+
description: The tool name
71+
- "version":
72+
type: eval
73+
description: Tool version
74+
75+
authors:
76+
- "@torbjorgen"
77+
maintainers:
78+
- "@torbjorgen"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
nextflow_process {
2+
3+
name "Test Process GICAM_INFER"
4+
script "modules/local/gicam/main.nf"
5+
process "GICAM_INFER"
6+
7+
test("Test GICAM inference on annotated VCF") {
8+
9+
when {
10+
process {
11+
"""
12+
input[0] = [
13+
[ id:'test', single_end:false ], // meta map
14+
// VCF as annotated by rank_variants subworkflow (including mivmir and genmod custom inheritance config), prior to gicam inference call
15+
file(params.pipelines_testdata_base_path + 'testdata/justhusky_snv_gicam.vcf', checkIfExists: true)
16+
]
17+
"""
18+
}
19+
}
20+
21+
then {
22+
assert process.success
23+
assert snapshot(process.out).match()
24+
}
25+
26+
}
27+
28+
}

0 commit comments

Comments
 (0)