Skip to content

Commit

Permalink
fix(call): better contig format detection for snvs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Feb 7, 2024
1 parent 3dde4a7 commit a12dfc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions strkit/call/call_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
PROFILE_LOCUS_CALLS: bool = False

NUMERAL_CONTIG_PATTERN = re.compile(r"^(\d{1,2}|X|Y)$")
ACCESSION_PATTERN = re.compile(r"^NC_\d+")


def get_vcf_contig_format(snv_vcf_file: Optional[pysam.VariantFile]) -> Literal["chr", "num", "acc", ""]:
Expand All @@ -47,8 +48,10 @@ def get_vcf_contig_format(snv_vcf_file: Optional[pysam.VariantFile]) -> Literal[
return "chr"
elif NUMERAL_CONTIG_PATTERN.match(snv_vcf_contigs[0]):
return "num"
else: # assume stupid accession format
return "acc" # TODO: remove this 'helping' logic... seems harmful
elif ACCESSION_PATTERN.match(snv_vcf_contigs[0]):
return "acc"
else:
return ""


def locus_worker(
Expand Down

0 comments on commit a12dfc2

Please sign in to comment.