|
@@ -18,7 +18,7 @@ use std::{
|
|
|
|
|
|
|
|
use crate::{
|
|
use crate::{
|
|
|
helpers::{mean, Blake3BuildHasher, Hash128},
|
|
helpers::{mean, Blake3BuildHasher, Hash128},
|
|
|
- variant::{vcf_variant::AlterationCategory, variant_collection::VariantCollection},
|
|
|
|
|
|
|
+ variant::{variant_collection::VariantCollection, vcf_variant::AlterationCategory},
|
|
|
};
|
|
};
|
|
|
use bitcode::{Decode, Encode};
|
|
use bitcode::{Decode, Encode};
|
|
|
use cosmic::Cosmic;
|
|
use cosmic::Cosmic;
|
|
@@ -563,17 +563,30 @@ impl Annotations {
|
|
|
self.store.retain(|key, _| !keys_to_remove.contains(key));
|
|
self.store.retain(|key, _| !keys_to_remove.contains(key));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Adds constitutional-boundary annotations to variants lacking somatic evidence.
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// This method scans all stored variant entries and identifies those that:
|
|
|
|
|
+ /// - have tumor-only support (`Sample::SoloTumor`), and
|
|
|
|
|
+ /// - lack any somatic call (`Sample::Somatic`).
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// For such variants, it conditionally appends boundary annotations:
|
|
|
|
|
+ /// - [`Annotation::LowConstitDepth`] if any constitutional depth
|
|
|
|
|
+ /// (`Annotation::ConstitDepth`) is below `min_constit_depth`;
|
|
|
|
|
+ /// - [`Annotation::HighConstitAlt`] if any constitutional alternate allele count
|
|
|
|
|
+ /// (`Annotation::ConstitAlt`) exceeds `max_alt_constit`.
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// Each boundary annotation is added at most once per variant.
|
|
|
pub fn somatic_constit_boundaries(&self, max_alt_constit: u16, min_constit_depth: u16) {
|
|
pub fn somatic_constit_boundaries(&self, max_alt_constit: u16, min_constit_depth: u16) {
|
|
|
for mut entry in self.store.iter_mut() {
|
|
for mut entry in self.store.iter_mut() {
|
|
|
let anns = entry.value_mut();
|
|
let anns = entry.value_mut();
|
|
|
// tumor but no somatic
|
|
// tumor but no somatic
|
|
|
- let has_tumor = anns
|
|
|
|
|
- .iter()
|
|
|
|
|
- .any(|a| matches!(a, Annotation::Callers(_, Sample::SoloTumor)));
|
|
|
|
|
- let has_somatic = anns
|
|
|
|
|
- .iter()
|
|
|
|
|
- .any(|a| matches!(a, Annotation::Callers(_, Sample::Somatic)));
|
|
|
|
|
- if has_tumor && !has_somatic {
|
|
|
|
|
|
|
+ // let has_tumor = anns
|
|
|
|
|
+ // .iter()
|
|
|
|
|
+ // .any(|a| matches!(a, Annotation::Callers(_, Sample::SoloTumor)));
|
|
|
|
|
+ // let has_somatic = anns
|
|
|
|
|
+ // .iter()
|
|
|
|
|
+ // .any(|a| matches!(a, Annotation::Callers(_, Sample::Somatic)));
|
|
|
|
|
+ // if has_tumor && !has_somatic {
|
|
|
// push at most once
|
|
// push at most once
|
|
|
if anns
|
|
if anns
|
|
|
.iter()
|
|
.iter()
|
|
@@ -587,7 +600,7 @@ impl Annotations {
|
|
|
{
|
|
{
|
|
|
anns.push(Annotation::HighConstitAlt);
|
|
anns.push(Annotation::HighConstitAlt);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|