Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix issue 36 #39

Merged
merged 7 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/commands/annotate_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub fn annotate_main(
let mut n = 0u64;
let mut n_written = 0u64;
let mut modu = 10000u64;
let mut skip_warn = 0;

for r in vcf.records() {
let mut record = r.expect("error reading record");
Expand All @@ -125,7 +126,25 @@ pub fn annotate_main(
);
}
n += 1;
// First check if the variant is *, skip those
if record.alleles()[1][0] == b'*' {
let rid = record.rid().unwrap();
let chrom = std::str::from_utf8(oheader_view.rid2name(rid).unwrap()).unwrap();
// Only warn up to 10 times, just keep count in general
if skip_warn < 10 {
eprintln!(
"contig {} pos {} alt has * value, skipping annotation, outputting entry as-is",
&chrom,
record.pos() + 1
);
if skip_warn == 9 { eprintln!("not reporting further warnings") }
}
skip_warn += 1;
ovcf.write(&record).expect("failed to write record");
continue;
}
// this updates evalues and fills expr values

for (i, e) in echts.iter_mut().enumerate() {
e.update_expr_values(&mut record, &mut expr_values[i]);
}
Expand Down Expand Up @@ -180,6 +199,10 @@ pub fn annotate_main(
1000 * (n as u128) / mili,
n_written,
);
eprintln!(
"Skipped {} variants with * alt.",
skip_warn,
);

/*
//let ep = std::path::Path::new(&*epaths[0]);
Expand Down
6 changes: 2 additions & 4 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
anno.vcf.gz
generated-all.vcf
generated-exclude.vcf
test.echtvar
test.echtvar.before
generated-*
test.echtvar*
sl.zip
Loading