From 650687b083890bbb8054a16df5276bcfe9e569c8 Mon Sep 17 00:00:00 2001 From: Miguel Brown Date: Fri, 2 Feb 2024 19:45:12 +0000 Subject: [PATCH 1/2] :hammer: --- src/commands/annotate_cmd.rs | 10 ++++++++++ tests/.gitignore | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/commands/annotate_cmd.rs b/src/commands/annotate_cmd.rs index 09884d8..9e97ee1 100644 --- a/src/commands/annotate_cmd.rs +++ b/src/commands/annotate_cmd.rs @@ -125,7 +125,17 @@ pub fn annotate_main( ); } n += 1; + // First check if the variant is *, skip those + if String::from_utf8_lossy(record.alleles()[1]) == "*" { + eprintln!( + "alt has * value, skipping annotation for {:?}", + &record + ); + 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]); } diff --git a/tests/.gitignore b/tests/.gitignore index 8bb1f46..0162c54 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1,4 @@ anno.vcf.gz -generated-all.vcf -generated-exclude.vcf -test.echtvar -test.echtvar.before +generated-* +test.echtvar* sl.zip From 08ceffcc4b9138ba28780ba24451111a571f171f Mon Sep 17 00:00:00 2001 From: Miguel Brown Date: Fri, 2 Feb 2024 19:59:33 +0000 Subject: [PATCH 2/2] :broom: clean up output message --- src/commands/annotate_cmd.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/annotate_cmd.rs b/src/commands/annotate_cmd.rs index 9e97ee1..5649e85 100644 --- a/src/commands/annotate_cmd.rs +++ b/src/commands/annotate_cmd.rs @@ -127,9 +127,12 @@ pub fn annotate_main( n += 1; // First check if the variant is *, skip those if String::from_utf8_lossy(record.alleles()[1]) == "*" { + let rid = record.rid().unwrap(); + let chrom = std::str::from_utf8(oheader_view.rid2name(rid).unwrap()).unwrap(); eprintln!( - "alt has * value, skipping annotation for {:?}", - &record + "contig {} pos {} alt has * value, skipping annotation, outputting entry as-is", + &chrom, + record.pos() + 1 ); ovcf.write(&record).expect("failed to write record"); continue;