#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Genotype {
HomRef,
Het,
HomAlt,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Filter {
Pass,
LowQual,
LowDepth,
}
pub(crate) const ACGT: [u8; 4] = [b'A', b'C', b'G', b'T'];
#[derive(Debug, Clone)]
pub struct GermlineParams {
pub heterozygosity: f64,
pub min_depth: u32,
pub min_qual: f64,
}
impl Default for GermlineParams {
fn default() -> Self {
Self {
heterozygosity: 1e-3,
min_depth: 8,
min_qual: 30.0,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GermlineCall {
pub genotype: Genotype,
pub alt_base: u8,
pub qual: f64,
pub gq: u8,
pub pl: [u32; 3],
pub ad: [u32; 2],
pub dp: u32,
pub filter: Filter,
}
#[derive(Debug, Clone)]
pub struct SomaticParams {
pub min_tumor_depth: u32,
pub min_normal_depth: u32,
pub min_tumor_af: f32,
pub max_normal_af: f32,
pub min_quality: f64,
pub seq_error_rate: f64,
}
impl Default for SomaticParams {
fn default() -> Self {
Self {
min_tumor_depth: 8,
min_normal_depth: 8,
min_tumor_af: 0.05,
max_normal_af: 0.01,
min_quality: 10.0,
seq_error_rate: 1e-3,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SomaticCall {
pub ref_base: u8,
pub alt_base: u8,
pub tumor_alt: u32,
pub tumor_depth: u32,
pub normal_alt: u32,
pub normal_depth: u32,
pub tumor_af: f32,
pub normal_af: f32,
pub quality: f64,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn defaults_match_spec() {
let g = GermlineParams::default();
assert_eq!(g.heterozygosity, 1e-3);
assert_eq!(g.min_depth, 8);
assert_eq!(g.min_qual, 30.0);
let s = SomaticParams::default();
assert_eq!(s.min_tumor_depth, 8);
assert_eq!(s.min_tumor_af, 0.05);
assert_eq!(s.max_normal_af, 0.01);
assert_eq!(s.seq_error_rate, 1e-3);
assert_eq!(ACGT[0], b'A');
assert_eq!(ACGT[3], b'T');
assert_ne!(Genotype::Het, Genotype::HomAlt);
assert_ne!(Filter::Pass, Filter::LowDepth);
}
}