From 0d7b6d8f7ca62b7152dad0d2da6557bb62580e58 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 18 Oct 2023 10:11:09 +0200 Subject: [PATCH] feat: bump annonars, write out VCV+RCV+clinsig (#217) --- Cargo.lock | 4 +- Cargo.toml | 2 +- src/annotate/seqvars/mod.rs | 50 +++++++++++++------ .../seqvar_freqs/db-rs1263393206/output.vcf | 4 +- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 115be7da..cf9c2376 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "annonars" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17a6e189155aa6d3488e373db9625fc80733ec50cda565e6ed4b160a337760c8" +checksum = "ac9a747c515e24fed680d9a05112c0535e069ff5705bf51256474b47ef66a382" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 36e1badd..fa9b3752 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ path = "src/main.rs" [dependencies] actix-web = "4.4" -annonars = "0.23" +annonars = "0.24" anyhow = "1.0" bgzip = "0.3" bio = "1.3" diff --git a/src/annotate/seqvars/mod.rs b/src/annotate/seqvars/mod.rs index e9e5ad82..3ae87053 100644 --- a/src/annotate/seqvars/mod.rs +++ b/src/annotate/seqvars/mod.rs @@ -216,12 +216,20 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader { Map::::new( Number::Count(1), Type::String, - "ClinVar clinical significance", + "ClinVar clinical significance (one highest significance per VCV)", ), ); header_out.infos_mut().insert( field::Key::from_str("clinvar_rcv").unwrap(), - Map::::new(Number::Count(1), Type::String, "ClinVar RCV accession"), + Map::::new( + Number::Count(1), + Type::String, + "ClinVar RCV accession (corresponds to clinvar_clinsig)", + ), + ); + header_out.infos_mut().insert( + field::Key::from_str("clinvar_vcv").unwrap(), + Map::::new(Number::Count(1), Type::String, "ClinVar VCV accession"), ); header_out @@ -396,21 +404,33 @@ where clinvar_minimal::pbs::Record::decode(&mut std::io::Cursor::new(&raw_value))?; let clinvar_minimal::pbs::Record { - clinical_significance, - rcv, + vcv, + reference_assertions, .. } = clinvar_record; - let clinical_significance: clinvar_minimal::cli::reading::ClinicalSignificance = - clinical_significance.into(); - - vcf_record.info_mut().insert( - field::Key::from_str("clinvar_clinsig").unwrap(), - Some(field::Value::String(clinical_significance.to_string())), - ); - vcf_record.info_mut().insert( - field::Key::from_str("clinvar_rcv").unwrap(), - Some(field::Value::String(rcv)), - ); + if let Some(reference_assertion) = reference_assertions.first() { + let clinvar_minimal::pbs::ReferenceAssertion { + rcv, + clinical_significance, + .. + } = reference_assertion.clone(); + + let clinical_significance: clinvar_minimal::cli::reading::ClinicalSignificance = + clinical_significance.into(); + + vcf_record.info_mut().insert( + field::Key::from_str("clinvar_clinsig").unwrap(), + Some(field::Value::String(clinical_significance.to_string())), + ); + vcf_record.info_mut().insert( + field::Key::from_str("clinvar_rcv").unwrap(), + Some(field::Value::String(rcv)), + ); + vcf_record.info_mut().insert( + field::Key::from_str("clinvar_vcv").unwrap(), + Some(field::Value::String(vcv)), + ); + } } Ok(()) diff --git a/tests/data/db/create/seqvar_freqs/db-rs1263393206/output.vcf b/tests/data/db/create/seqvar_freqs/db-rs1263393206/output.vcf index 1237087c..bd04bcf2 100644 --- a/tests/data/db/create/seqvar_freqs/db-rs1263393206/output.vcf +++ b/tests/data/db/create/seqvar_freqs/db-rs1263393206/output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f3cc926773a089a9ef59a593c5d2d88ad0e639e8b91c43079716e4ac7d26e62 -size 17901 +oid sha256:a901a01e76edcd18dfb20209432b715c5558b2dbe41b1d8063588fd9ba58a330 +size 18050