|
|
@@ -74,15 +74,20 @@ pub enum Annotation {
|
|
|
/// Timing of replication for the variant's genomic position.
|
|
|
ReplicationTiming(ReplicationClass),
|
|
|
|
|
|
+ /// Variant in an High Depth position
|
|
|
HighDepth,
|
|
|
|
|
|
+ /// Variant in the given panel ranges
|
|
|
Panel(String),
|
|
|
|
|
|
+ /// Variant at a CpG
|
|
|
CpG,
|
|
|
|
|
|
+ /// Variant in a region of low alignement quality
|
|
|
LowMAPQ,
|
|
|
|
|
|
- VNTR
|
|
|
+ /// Variant in a variable number of tandem repeat locus
|
|
|
+ VNTR,
|
|
|
}
|
|
|
|
|
|
/// Denotes the biological sample type associated with a variant call.
|
|
|
@@ -193,31 +198,33 @@ impl FromStr for Sample {
|
|
|
/// such as base content or sample-specific information.
|
|
|
impl fmt::Display for Annotation {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
+ use Annotation::*;
|
|
|
+
|
|
|
let s = match self {
|
|
|
- Annotation::Callers(caller, sample) => format!("{caller} {sample}"),
|
|
|
- Annotation::AlterationCategory(alt_cat) => alt_cat.to_string(),
|
|
|
- Annotation::ShannonEntropy(_) => "ShannonEntropy".into(),
|
|
|
- Annotation::ConstitDepth(_) => "ConstitDepth".into(),
|
|
|
- Annotation::ConstitAlt(_) => "ConstitAlt".into(),
|
|
|
- Annotation::LowConstitDepth => "LowConstitDepth".into(),
|
|
|
- Annotation::HighConstitAlt => "HighConstitAlt".into(),
|
|
|
- Annotation::Cosmic(_) => "Cosmic".into(),
|
|
|
- Annotation::GnomAD(_) => "GnomAD".into(),
|
|
|
- Annotation::LowEntropy => "LowEntropy".into(),
|
|
|
- Annotation::VEP(_) => "VEP".into(),
|
|
|
- Annotation::CpG => "CpG".into(),
|
|
|
- Annotation::VNTR => "VNTR".into(),
|
|
|
- Annotation::TriNucleotides(bases) => format!(
|
|
|
- "Trinucleotides({})",
|
|
|
- bases.iter().map(|b| b.to_string()).collect::<String>(),
|
|
|
- ),
|
|
|
- Annotation::ReplicationTiming(rt) => match rt {
|
|
|
- ReplicationClass::Early => "ReplicationEarly".into(),
|
|
|
- ReplicationClass::Late => "ReplicationLate".into(),
|
|
|
- },
|
|
|
- Annotation::HighDepth => "HighDepth".into(),
|
|
|
- Annotation::Panel(name) => format!("Panel_{name}"),
|
|
|
- Annotation::LowMAPQ => "LowMAPQ".to_string(),
|
|
|
+ Callers(caller, sample) => format!("{caller} {sample}"),
|
|
|
+ AlterationCategory(alt_cat) => alt_cat.to_string(),
|
|
|
+ ShannonEntropy(_) => "ShannonEntropy".into(),
|
|
|
+ ConstitDepth(_) => "ConstitDepth".into(),
|
|
|
+ ConstitAlt(_) => "ConstitAlt".into(),
|
|
|
+ LowConstitDepth => "LowConstitDepth".into(),
|
|
|
+ HighConstitAlt => "HighConstitAlt".into(),
|
|
|
+ Cosmic(_) => "Cosmic".into(),
|
|
|
+ GnomAD(_) => "GnomAD".into(),
|
|
|
+ LowEntropy => "LowEntropy".into(),
|
|
|
+ VEP(_) => "VEP".into(),
|
|
|
+ CpG => "CpG".into(),
|
|
|
+ VNTR => "VNTR".into(),
|
|
|
+ TriNucleotides(bases) => format!(
|
|
|
+ "Trinucleotides({})",
|
|
|
+ bases.iter().map(|b| b.to_string()).collect::<String>(),
|
|
|
+ ),
|
|
|
+ ReplicationTiming(rt) => match rt {
|
|
|
+ ReplicationClass::Early => "ReplicationEarly".into(),
|
|
|
+ ReplicationClass::Late => "ReplicationLate".into(),
|
|
|
+ },
|
|
|
+ HighDepth => "HighDepth".into(),
|
|
|
+ Panel(name) => format!("Panel_{name}"),
|
|
|
+ LowMAPQ => "LowMAPQ".to_string(),
|
|
|
};
|
|
|
write!(f, "{}", s)
|
|
|
}
|
|
|
@@ -261,14 +268,15 @@ pub enum Caller {
|
|
|
|
|
|
impl fmt::Display for Caller {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
+ use Caller::*;
|
|
|
match self {
|
|
|
- Caller::DeepVariant => write!(f, "DeepVariant"),
|
|
|
- Caller::ClairS => write!(f, "ClairS"),
|
|
|
- Caller::NanomonSV => write!(f, "NanomonSV"),
|
|
|
- Caller::NanomonSVSolo => write!(f, "NanomonSV-solo"),
|
|
|
- Caller::Savana => write!(f, "Savana"),
|
|
|
- Caller::Severus => write!(f, "Severus"),
|
|
|
- Caller::DeepSomatic => write!(f, "DeepSomatic"),
|
|
|
+ DeepVariant => write!(f, "DeepVariant"),
|
|
|
+ ClairS => write!(f, "ClairS"),
|
|
|
+ NanomonSV => write!(f, "NanomonSV"),
|
|
|
+ NanomonSVSolo => write!(f, "NanomonSV-solo"),
|
|
|
+ Savana => write!(f, "Savana"),
|
|
|
+ Severus => write!(f, "Severus"),
|
|
|
+ DeepSomatic => write!(f, "DeepSomatic"),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -277,14 +285,15 @@ impl FromStr for Caller {
|
|
|
type Err = anyhow::Error;
|
|
|
|
|
|
fn from_str(s: &str) -> anyhow::Result<Self> {
|
|
|
+ use Caller::*;
|
|
|
match s {
|
|
|
- "DeepVariant" => Ok(Caller::DeepVariant),
|
|
|
- "ClairS" => Ok(Caller::ClairS),
|
|
|
- "NanomonSV" => Ok(Caller::NanomonSV),
|
|
|
- "NanomonSV-solo" => Ok(Caller::NanomonSVSolo),
|
|
|
- "Savana" => Ok(Caller::Savana),
|
|
|
- "Severus" => Ok(Caller::Severus),
|
|
|
- "DeepSomatic" => Ok(Caller::DeepSomatic),
|
|
|
+ "DeepVariant" => Ok(DeepVariant),
|
|
|
+ "ClairS" => Ok(ClairS),
|
|
|
+ "NanomonSV" => Ok(NanomonSV),
|
|
|
+ "NanomonSV-solo" => Ok(NanomonSVSolo),
|
|
|
+ "Savana" => Ok(Savana),
|
|
|
+ "Severus" => Ok(Severus),
|
|
|
+ "DeepSomatic" => Ok(DeepSomatic),
|
|
|
_ => Err(anyhow::anyhow!("Can't parse Caller {s}")),
|
|
|
}
|
|
|
}
|
|
|
@@ -339,6 +348,7 @@ impl Annotations {
|
|
|
&self,
|
|
|
annotations: Option<Box<dyn Fn(&Annotation) -> bool + Send + Sync>>,
|
|
|
) -> AnnotationsStats {
|
|
|
+ use Annotation::*;
|
|
|
let map: DashMap<String, u64> = DashMap::new();
|
|
|
let num_maps: DashMap<String, HashMap<String, Vec<f64>>> = DashMap::new();
|
|
|
|
|
|
@@ -353,29 +363,16 @@ impl Annotations {
|
|
|
let mut numerical = Vec::new();
|
|
|
for ann in anns.iter() {
|
|
|
match ann {
|
|
|
- Annotation::LowConstitDepth
|
|
|
- | Annotation::LowEntropy
|
|
|
- | Annotation::GnomAD(_)
|
|
|
- | Annotation::VEP(_)
|
|
|
- | Annotation::TriNucleotides(_)
|
|
|
- | Annotation::ReplicationTiming(_)
|
|
|
- | Annotation::HighDepth
|
|
|
- | Annotation::CpG
|
|
|
- | Annotation::VNTR
|
|
|
- | Annotation::Panel(_)
|
|
|
- | Annotation::LowMAPQ
|
|
|
- | Annotation::HighConstitAlt => categorical.push(ann.to_string()),
|
|
|
- Annotation::Callers(caller, sample) => {
|
|
|
- categorical.push(format!("{caller} {sample}"))
|
|
|
- }
|
|
|
- Annotation::ShannonEntropy(v) => numerical.push((ann.to_string(), *v)),
|
|
|
- Annotation::ConstitDepth(v) | Annotation::ConstitAlt(v) => {
|
|
|
+ LowConstitDepth | LowEntropy | GnomAD(_) | VEP(_) | TriNucleotides(_)
|
|
|
+ | ReplicationTiming(_) | HighDepth | CpG | VNTR | 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) => {
|
|
|
numerical.push((ann.to_string(), *v as f64));
|
|
|
}
|
|
|
- Annotation::Cosmic(c) => numerical.push((ann.to_string(), c.cosmic_cnt as f64)),
|
|
|
- Annotation::AlterationCategory(alt_cat) => {
|
|
|
- categorical.push(alt_cat.to_string())
|
|
|
- }
|
|
|
+ Cosmic(c) => numerical.push((ann.to_string(), c.cosmic_cnt as f64)),
|
|
|
+ AlterationCategory(alt_cat) => categorical.push(alt_cat.to_string()),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -661,13 +658,13 @@ pub trait CallerCat {
|
|
|
|
|
|
/// Determines whether a variant annotation meets either of the following criteria:
|
|
|
///
|
|
|
-/// 1. It is observed in gnomAD with a non-zero allele frequency *and* has
|
|
|
+/// 1. It is observed in gnomAD with a non-zero allele frequency *and* has
|
|
|
/// at least one constitutive alternate read.
|
|
|
-/// 2. All variant calls are from `SoloTumor` samples and there is at least one
|
|
|
+/// 2. All variant calls are from `SoloTumor` samples and there is at least one
|
|
|
/// constitutive alternate read.
|
|
|
///
|
|
|
-/// This function is typically used to identify variants that are either likely
|
|
|
-/// germline (based on population frequency and constitutive signal) or artifacts
|
|
|
+/// This function is typically used to identify variants that are either likely
|
|
|
+/// germline (based on population frequency and constitutive signal) or artifacts
|
|
|
/// (appearing only in tumor calls but with constitutive support).
|
|
|
///
|
|
|
/// # Arguments
|
|
|
@@ -715,4 +712,3 @@ pub fn is_gnomad_and_constit_alt(anns: &[Annotation]) -> bool {
|
|
|
|
|
|
(has_gnomad && has_constit_alt) || only_tumor_with_constit
|
|
|
}
|
|
|
-
|