|
|
@@ -88,6 +88,9 @@ pub enum Annotation {
|
|
|
|
|
|
/// Variant in a variable number of tandem repeat locus
|
|
|
VNTR,
|
|
|
+
|
|
|
+ /// RepeatMasker
|
|
|
+ RepeatMasker,
|
|
|
}
|
|
|
|
|
|
/// Denotes the biological sample type associated with a variant call.
|
|
|
@@ -214,6 +217,7 @@ impl fmt::Display for Annotation {
|
|
|
VEP(_) => "VEP".into(),
|
|
|
CpG => "CpG".into(),
|
|
|
VNTR => "VNTR".into(),
|
|
|
+ RepeatMasker => "VNTR".into(),
|
|
|
TriNucleotides(bases) => format!(
|
|
|
"Trinucleotides({})",
|
|
|
bases.iter().map(|b| b.to_string()).collect::<String>(),
|
|
|
@@ -364,8 +368,8 @@ impl Annotations {
|
|
|
for ann in anns.iter() {
|
|
|
match ann {
|
|
|
LowConstitDepth | LowEntropy | GnomAD(_) | VEP(_) | TriNucleotides(_)
|
|
|
- | ReplicationTiming(_) | HighDepth | CpG | VNTR | Panel(_) | LowMAPQ
|
|
|
- | HighConstitAlt => categorical.push(ann.to_string()),
|
|
|
+ | ReplicationTiming(_) | HighDepth | CpG | VNTR | RepeatMasker | Panel(_)
|
|
|
+ | LowMAPQ | HighConstitAlt => categorical.push(ann.to_string()),
|
|
|
Callers(caller, sample) => categorical.push(format!("{caller} {sample}")),
|
|
|
ShannonEntropy(v) => numerical.push((ann.to_string(), *v)),
|
|
|
ConstitDepth(v) | Annotation::ConstitAlt(v) => {
|
|
|
@@ -529,36 +533,31 @@ impl Annotations {
|
|
|
}
|
|
|
|
|
|
pub fn somatic_constit_boundaries(&self, max_alt_constit: u16, min_constit_depth: u16) {
|
|
|
- self.store
|
|
|
- .iter_mut()
|
|
|
- .filter(|anns| {
|
|
|
- let contains = anns
|
|
|
+ for mut entry in self.store.iter_mut() {
|
|
|
+ let anns = entry.value_mut();
|
|
|
+ // 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 {
|
|
|
+ // push at most once
|
|
|
+ if anns
|
|
|
.iter()
|
|
|
- .any(|item| matches!(item, Annotation::Callers(_, Sample::SoloTumor)));
|
|
|
- let contains_not = anns
|
|
|
+ .any(|a| matches!(a, Annotation::ConstitDepth(d) if *d < min_constit_depth))
|
|
|
+ {
|
|
|
+ anns.push(Annotation::LowConstitDepth);
|
|
|
+ }
|
|
|
+ if anns
|
|
|
.iter()
|
|
|
- .all(|item| !matches!(item, Annotation::Callers(_, Sample::Somatic)));
|
|
|
-
|
|
|
- contains && contains_not
|
|
|
- })
|
|
|
- .for_each(|mut e| {
|
|
|
- let v = e.value_mut();
|
|
|
- let mut to_add = Vec::new();
|
|
|
- v.iter().for_each(|ann| match ann {
|
|
|
- Annotation::ConstitDepth(v) => {
|
|
|
- if *v < min_constit_depth {
|
|
|
- to_add.push(Annotation::LowConstitDepth);
|
|
|
- }
|
|
|
- }
|
|
|
- Annotation::ConstitAlt(v) => {
|
|
|
- if *v > max_alt_constit {
|
|
|
- to_add.push(Annotation::HighConstitAlt);
|
|
|
- }
|
|
|
- }
|
|
|
- _ => (),
|
|
|
- });
|
|
|
- v.extend(to_add);
|
|
|
- });
|
|
|
+ .any(|a| matches!(a, Annotation::ConstitAlt(a0) if *a0 > max_alt_constit))
|
|
|
+ {
|
|
|
+ anns.push(Annotation::HighConstitAlt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
pub fn count_annotations(&self, annotation_types: Vec<Annotation>) -> Vec<usize> {
|