Skip to content

Commit

Permalink
daily progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEnglish committed Feb 2, 2024
1 parent e3535e5 commit 7d890e1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
6 changes: 5 additions & 1 deletion trust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ fn main() {
for i in parts {
println!("{:?}", i);
}

let mat = matching::Matcher::new();
let mut up_record = vcf::Record::default();
reader
.read_record(&header, &mut up_record)
.expect("Unable to parse record");
for result in reader.records(&header) {
let dn_record = result.expect("Unable to parse record");
// Need to put a sequence resolved guard on seq_similarity
if mat.filter_call(&dn_record, false) {
println!("filtering {:?}", up_record);
continue;
}
println!(
"size={:?} type={:?} bound={:?} dist={:?} ovl={:?} szsim={:?} gtcmp={:?} pres={:?} filt={:?} sim={:?}",
comparisons::entry_size(&dn_record),
Expand Down
39 changes: 36 additions & 3 deletions trust/src/matching.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::types::Gt;
use crate::comparisons;
use noodles_vcf::{self as vcf};
use std::cmp::Ordering;

Expand Down Expand Up @@ -96,12 +97,44 @@ impl Eq for MatchResult {}
#[derive(Debug)]
pub struct Matcher {
pub params: String, // This will be tricky? Maybe...
pub fn filter_call(entry: &vcf::Record, base: bool) {

}
}

impl Matcher (
impl Matcher {
pub fn new() -> Self {
Matcher { params: "Wouldbeparams".to_string() }
}

pub fn filter_call(&self, entry: &vcf::Record, base: bool) -> bool {
// self.params.check_monref & e
if entry.alternate_bases().len() == 0 {
return true;
}

// self.params.check_multi
if entry.alternate_bases().len() > 1 {
//panic and exit
return true;
}

// self.params.passonly
if comparisons::entry_is_filtered(&entry) {
return true;
}

let size = comparisons::entry_size(&entry);
//self.params.sizemax
//self.params.sizemin
//self.params.sizefilt
if (size > 1209) || (base & (size < 5)) || (!base & (size < 6)) {
return true;
}
//self.params.bSample / self.params.cSample
let (samp, prefix) = if base { (0, 'b') } else { (1, 'c') };
//if (self.params.no_ref..
false
}
}
//check_monref and alts is None
//# check_multi and
/* TODO
Expand Down
3 changes: 1 addition & 2 deletions truvari/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def filter_call(self, entry, base=False):
or (not base and size < self.params.sizefilt):
return True

samp = self.params.bSample if base else self.params.cSample
prefix = 'b' if base else 'c'
samp, prefix = (self.params.bSample, 'b') if base else (self.params.cSample, 'c')
if (self.params.no_ref in ["a", prefix] or self.params.pick == 'ac') \
and not truvari.entry_is_present(entry, samp):
return True
Expand Down

0 comments on commit 7d890e1

Please sign in to comment.