#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OligoWeights {
pub temp_gt: f64,
pub temp_lt: f64,
pub bound_gt: f64,
pub bound_lt: f64,
pub gc_content_gt: f64,
pub gc_content_lt: f64,
pub size_gt: f64,
pub size_lt: f64,
pub compl_any: f64,
pub compl_any_th: f64,
pub compl_end: f64,
pub compl_end_th: f64,
pub hairpin_th: f64,
pub num_ns: f64,
pub repeat_sim: f64,
pub seq_quality: f64,
pub end_quality: f64,
pub pos_penalty: f64,
pub end_stability: f64,
pub template_mispriming: f64,
pub template_mispriming_th: f64,
pub failure_rate: f64,
}
impl Default for OligoWeights {
fn default() -> Self {
Self {
temp_gt: 1.0,
temp_lt: 1.0,
bound_gt: 0.0,
bound_lt: 0.0,
gc_content_gt: 0.0,
gc_content_lt: 0.0,
size_gt: 1.0,
size_lt: 1.0,
compl_any: 0.0,
compl_any_th: 0.0,
compl_end: 0.0,
compl_end_th: 0.0,
hairpin_th: 0.0,
num_ns: 0.0,
repeat_sim: 0.0,
seq_quality: 0.0,
end_quality: 0.0,
pos_penalty: 1.0,
end_stability: 0.0,
template_mispriming: 0.0,
template_mispriming_th: 0.0,
failure_rate: 0.0,
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PairWeights {
pub primer_quality: f64,
pub io_quality: f64,
pub diff_tm: f64,
pub compl_any: f64,
pub compl_any_th: f64,
pub compl_end: f64,
pub compl_end_th: f64,
pub product_tm_lt: f64,
pub product_tm_gt: f64,
pub product_size_lt: f64,
pub product_size_gt: f64,
pub repeat_sim: f64,
pub template_mispriming: f64,
pub template_mispriming_th: f64,
}
impl Default for PairWeights {
fn default() -> Self {
Self {
primer_quality: 1.0,
io_quality: 0.0,
diff_tm: 0.0,
compl_any: 0.0,
compl_any_th: 0.0,
compl_end: 0.0,
compl_end_th: 0.0,
product_tm_lt: 0.0,
product_tm_gt: 0.0,
product_size_lt: 0.0,
product_size_gt: 0.0,
repeat_sim: 0.0,
template_mispriming: 0.0,
template_mispriming_th: 0.0,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_oligo_weights_default() {
let w = OligoWeights::default();
assert!((w.temp_gt - 1.0).abs() < f64::EPSILON);
assert!((w.temp_lt - 1.0).abs() < f64::EPSILON);
assert!((w.size_gt - 1.0).abs() < f64::EPSILON);
assert!((w.size_lt - 1.0).abs() < f64::EPSILON);
assert!((w.gc_content_gt - 0.0).abs() < f64::EPSILON);
assert!((w.num_ns - 0.0).abs() < f64::EPSILON);
}
#[test]
fn test_pair_weights_default() {
let w = PairWeights::default();
assert!((w.primer_quality - 1.0).abs() < f64::EPSILON);
assert!((w.io_quality - 0.0).abs() < f64::EPSILON);
assert!((w.diff_tm - 0.0).abs() < f64::EPSILON);
assert!((w.compl_any - 0.0).abs() < f64::EPSILON);
}
}