fritzsedlazeck / Sniffles

Structural variation caller using third generation sequencing
Other
545 stars 91 forks source link

phased alleles are switched? #315

Open wdecoster opened 2 years ago

wdecoster commented 2 years ago

Hi,

I have used longshot for phasing reads (HP & PS tags), but something weird is happening. The genotypes (0|1, 1|0) are switched around in comparison with what I see in IGV. In IGV, haplotype 1 has an insertion, while haplotype 2 doesn't. The VCF reports 0|1... I haven't checked all my samples (it's a frequent variant) but for 3 heterozygous carriers, the pattern is the same.

I'm not sure what is going on here, but it seems that at https://github.com/fritzsedlazeck/Sniffles/blob/385da00913c7a2b9988a008a99bc7976476ee0ac/src/sniffles/vcf.py#L25 there is some switching of genotypes?

Cheers, Wouter

ASLeonard commented 1 year ago

I've seen the same thing. Here are two examples both ways. IGV is grouped/coloured by HP:1 (haplotype 1) and HP:2 (haplotype 2), but the sniffle calls effectively have a consistent but swapped order.

1 24559727 Sniffles2.DEL.FE7S0 N 60 PASS PRECISE;SVTYPE=DEL;SVLEN=-2558;END=24562285;SUPPORT=16;COVERAGE=29,30,29,29,29;STRAND=+-;AF=0.552;PHASE=2,NULL,16,16,PASS,FAIL;STDEV_LEN=0;STDEV_POS=0 GT:GQ:DR:DV 1|0:60:13:16

image

1 39793894 Sniffles2.INS.2E3S0 N 60 PASS PRECISE;SVTYPE=INS;SVLEN=978;END=39793894;SUPPORT=14;COVERAGE=30,28,28,28,29;STRAND=+-;AF=0.5;PHASE=1,NULL,14,14,PASS,FAIL;STDEV_LEN=5.027;STDEV_POS=0;SUPPORT_LONG=0 GT:GQ:DR:DV 0|1:60:14:14

image

ASLeonard commented 1 year ago

From the part that @wdecoster linked

https://github.com/fritzsedlazeck/Sniffles/blob/385da00913c7a2b9988a008a99bc7976476ee0ac/src/sniffles/vcf.py#L25

the ps variable was always equal to 0 (in 10,618 cases), and so never trigged the swap in the if statement.

The INFO part of the record for PHASE= seemed correct. Every record with PHASE=1 was "0|1" and every record with PHASE=2 was "1|0", so the "phasing" seems to be working but not translating correctly to the genotyping.

fritzsedlazeck commented 9 months ago

@hermannromanek can you check this out? Sounds like an easy fix.

lfpaulin commented 2 months ago

This issue will be fixed in v2.4