|
|
@@ -182,10 +182,10 @@ mod tests {
|
|
|
use self::{/* collection::pod5::{FlowCellCase, Pod5Collection}, */ config::Config};
|
|
|
use super::*;
|
|
|
use crate::{
|
|
|
- annotation::Annotation,
|
|
|
+ annotation::{Annotation, colorscb::annotate_colorsdb},
|
|
|
collection::{
|
|
|
bam::{self},
|
|
|
- flowcells::{scan_archive, FlowCells},
|
|
|
+ flowcells::{FlowCells, scan_archive},
|
|
|
vcf::VcfCollection,
|
|
|
},
|
|
|
helpers::find_files,
|
|
|
@@ -194,9 +194,9 @@ mod tests {
|
|
|
scan::scan::somatic_scan,
|
|
|
variant::{
|
|
|
variant_collection::{
|
|
|
- group_variants_by_bnd_desc, group_variants_by_bnd_rc, VariantCollection,
|
|
|
+ ExternalAnnotation, VariantCollection, group_variants_by_bnd_desc, group_variants_by_bnd_rc
|
|
|
},
|
|
|
- variants_stats::{self, somatic_depth_quality_ranges, VariantsStats},
|
|
|
+ variants_stats::{self, VariantsStats, somatic_depth_quality_ranges},
|
|
|
vcf_variant::{AlterationCategory, BNDDesc, BNDGraph, ToBNDGraph},
|
|
|
},
|
|
|
};
|
|
|
@@ -771,6 +771,78 @@ mod tests {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
+ #[test]
|
|
|
+ fn parse_del_vep() -> anyhow::Result<()> {
|
|
|
+ init();
|
|
|
+ let config = Config::default();
|
|
|
+ let vcf = "chr14\t48907506\t.\tCCAG\tC\t25.40\tPASS\t.\tGT:GQ:DP:AD:VAF:MID:PL\t0/1:25:58:34,24:0.41379:small_model:25,0,33";
|
|
|
+ let variant: VcfVariant = vcf.parse()?;
|
|
|
+ let annotations = Annotations::default();
|
|
|
+ let ext_annot = ExternalAnnotation::init("test", &config)?;
|
|
|
+ ext_annot.annotate_vep(std::slice::from_ref(&variant), &annotations)?;
|
|
|
+ {
|
|
|
+ let annots = annotations.store
|
|
|
+ .get(&variant.hash) // adapt if your API differs
|
|
|
+ .expect("variant should have annotations");
|
|
|
+
|
|
|
+ let vep = annots
|
|
|
+ .iter()
|
|
|
+ .find_map(|a| match a {
|
|
|
+ Annotation::VEP(v) => Some(v),
|
|
|
+ _ => None,
|
|
|
+ })
|
|
|
+ .expect("variant should have VEP annotation");
|
|
|
+
|
|
|
+ let samd4a_nm = vep
|
|
|
+ .iter()
|
|
|
+ .find(|v| v.feature.as_deref() == Some("NM_001161576.2"))
|
|
|
+ .expect("NM_001161576.2 transcript should be annotated");
|
|
|
+
|
|
|
+ assert_eq!(samd4a_nm.gene.as_deref(), Some("SAMD4A"));
|
|
|
+ assert_eq!(samd4a_nm.feature_type.as_deref(), Some("Transcript"));
|
|
|
+
|
|
|
+ assert!(samd4a_nm
|
|
|
+ .consequence
|
|
|
+ .as_ref()
|
|
|
+ .is_some_and(|c| c.contains(&annotation::vep::VepConsequence::InframeDeletion)));
|
|
|
+
|
|
|
+ assert_eq!(samd4a_nm.cds_position.as_deref(), Some("468-470"));
|
|
|
+ assert_eq!(samd4a_nm.protein_position.as_deref(), Some("156-157"));
|
|
|
+ assert_eq!(samd4a_nm.amino_acids.as_deref(), Some("TS/T"));
|
|
|
+ assert_eq!(samd4a_nm.codons.as_deref(), Some("acCAGc/acc"));
|
|
|
+
|
|
|
+ assert_eq!(samd4a_nm.extra.impact, Some(annotation::vep::VepImpact::MODERATE));
|
|
|
+ assert_eq!(samd4a_nm.extra.symbol.as_deref(), Some("SAMD4A"));
|
|
|
+ assert_eq!(
|
|
|
+ samd4a_nm.extra.hgvs_c.as_deref(),
|
|
|
+ Some("NM_001161576.2:c.472_474del")
|
|
|
+ );
|
|
|
+ assert_eq!(
|
|
|
+ samd4a_nm.extra.hgvs_p.as_deref(),
|
|
|
+ Some("NP_001155048.2:p.Ser158del")
|
|
|
+ );
|
|
|
+
|
|
|
+ info!("VEP ok");
|
|
|
+ }
|
|
|
+
|
|
|
+ annotate_colorsdb(std::slice::from_ref(&variant), &annotations, &config.colors_db_smallvar)?;
|
|
|
+ let annots = annotations.store
|
|
|
+ .get(&variant.hash) // adapt if your API differs
|
|
|
+ .expect("variant should have annotations");
|
|
|
+
|
|
|
+ let colors = annots
|
|
|
+ .iter()
|
|
|
+ .find_map(|a| match a {
|
|
|
+ Annotation::CoLoRSdb(v) => Some(v),
|
|
|
+ _ => None,
|
|
|
+ })
|
|
|
+ .expect("variant should have CoLoRSdb annotation");
|
|
|
+
|
|
|
+ assert_eq!(colors.ac, 2634);
|
|
|
+
|
|
|
+ Ok(())
|
|
|
+ }
|
|
|
+
|
|
|
#[test]
|
|
|
// fn variant_load_deepvariant() -> anyhow::Result<()> {
|
|
|
// init();
|