Skip to content

Commit

Permalink
fix: skip REF-only records (#576)
Browse files Browse the repository at this point in the history
* fix: skip REF-only records

* follow vcf spec 4.5 §5.5
  • Loading branch information
tedil authored Oct 11, 2024
1 parent c28ffdd commit 688b968
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/annotate/strucvars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ pub trait VcfRecordConverter {
let mut end: Option<i32> = 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?)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 688b968

Please sign in to comment.