From 688b968e0a947c0eec7a918b60a77bca26c164f5 Mon Sep 17 00:00:00 2001 From: Till Hartmann Date: Fri, 11 Oct 2024 14:02:18 +0200 Subject: [PATCH] fix: skip REF-only records (#576) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: skip REF-only records * follow vcf spec 4.5 ยง5.5 --- src/annotate/strucvars/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/annotate/strucvars/mod.rs b/src/annotate/strucvars/mod.rs index cc602afc..832943eb 100644 --- a/src/annotate/strucvars/mod.rs +++ b/src/annotate/strucvars/mod.rs @@ -1889,7 +1889,7 @@ pub trait VcfRecordConverter { let mut end: Option = None; let alleles = vcf_record.alternate_bases().as_ref(); if alleles.len() != 1 { - panic!("Only one alternative allele is supported for SVs"); + panic!("Only one alternative allele is supported for SVs, got {} alternative alleles ({:?})", alleles.len(), alleles); } let allele = &alleles[0]; // TODO find out how to handle this properly (via noodles?) @@ -2959,6 +2959,13 @@ pub async fn run_vcf_to_jsonl( rng.fill_bytes(&mut uuid_buf); let uuid = Uuid::from_bytes(uuid_buf); + if record.alternate_bases().is_empty() + || record.alternate_bases().as_ref() == ["<*>".to_string()] + { + // REF-only, skip + tracing::warn!("skipping REF-only / empty ALT record {:?}", record); + continue; + } let mut record = converter.convert(pedigree, &record, uuid, GenomeRelease::Grch37)?; annotate_cov_mq(&mut record, cov_readers)?; if let Some(chromosome_no) = mapping.get(&record.chromosome) {