Skip to content

Commit c5ec38b

Browse files
committed
🔨 change vec eval, limit print warn
1 parent 8a96973 commit c5ec38b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/commands/annotate_cmd.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub fn annotate_main(
100100
let mut n = 0u64;
101101
let mut n_written = 0u64;
102102
let mut modu = 10000u64;
103+
let mut skip_warn = 0;
103104

104105
for r in vcf.records() {
105106
let mut record = r.expect("error reading record");
@@ -126,14 +127,18 @@ pub fn annotate_main(
126127
}
127128
n += 1;
128129
// First check if the variant is *, skip those
129-
if String::from_utf8_lossy(record.alleles()[1]) == "*" {
130+
if record.alleles()[1][0] == b'*' {
130131
let rid = record.rid().unwrap();
131132
let chrom = std::str::from_utf8(oheader_view.rid2name(rid).unwrap()).unwrap();
132-
eprintln!(
133-
"contig {} pos {} alt has * value, skipping annotation, outputting entry as-is",
134-
&chrom,
135-
record.pos() + 1
136-
);
133+
// Only warn up to 10 times, just keep count in general
134+
if skip_warn < 10 {
135+
eprintln!(
136+
"contig {} pos {} alt has * value, skipping annotation, outputting entry as-is",
137+
&chrom,
138+
record.pos() + 1
139+
);
140+
}
141+
skip_warn += 1;
137142
ovcf.write(&record).expect("failed to write record");
138143
continue;
139144
}
@@ -193,6 +198,10 @@ pub fn annotate_main(
193198
1000 * (n as u128) / mili,
194199
n_written,
195200
);
201+
eprintln!(
202+
"Skipped {} variants with * alt.",
203+
skip_warn,
204+
);
196205

197206
/*
198207
//let ep = std::path::Path::new(&*epaths[0]);

0 commit comments

Comments
 (0)