Skip to content

Commit

Permalink
fix(call): fix VCF output for alts with no common suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jun 15, 2024
1 parent 121d308 commit 903a366
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions strkit/call/output/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import pathlib
import pysam

from os.path import commonprefix
from typing import Optional

Expand Down Expand Up @@ -123,10 +124,10 @@ def output_contig_vcf_lines(
call = result["call"]

seq_alleles_raw: tuple[Optional[str], ...] = (ref_seq, *(seq_alts or (None,))) if call is not None else (".",)
seq_alleles: list[str] = [ref_start_anchor + ref_seq[:common_suffix_idx]]
seq_alleles: list[str] = [ref_start_anchor + (ref_seq[:common_suffix_idx] if common_suffix_idx else ref_seq)]

if call is not None and seq_alts:
seq_alleles.extend(ref_start_anchor + a[:common_suffix_idx] for a in seq_alts)
seq_alleles.extend(ref_start_anchor + (a[:common_suffix_idx] if common_suffix_idx else a) for a in seq_alts)
else:
seq_alleles.append(".")

Expand Down

0 comments on commit 903a366

Please sign in to comment.