Skip to content

Commit 0f8d231

Browse files
committed
fixes #25: UNKNOWN are not be valid variant
1 parent f17215e commit 0f8d231

4 files changed

Lines changed: 3 additions & 1 deletion

File tree

kipoiseq/extractors/vcf_seq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def _region(self, interval):
3030
return '%s:%d-%d' % (interval.chrom, interval.start, interval.end)
3131

3232
def _has_variant(self, variant, sample_id):
33-
return variant.gt_types[self.sample_mapping[sample_id]] != 0
33+
gt_type = variant.gt_types[self.sample_mapping[sample_id]]
34+
return gt_type != 0 and gt_type != 2
3435

3536

3637
class IntervalSeqBuilder(list):

tests/data/test.vcf.gz

5 Bytes
Binary file not shown.

tests/data/test.vcf.gz.tbi

0 Bytes
Binary file not shown.

tests/extractors/test_vcf_seq_extractor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_multi_sample_vcf_fetch_variant(multi_sample_vcf):
1818
interval = Interval('chr1', 3, 5)
1919
assert len(list(multi_sample_vcf.fetch_variants(interval))) == 2
2020
assert len(list(multi_sample_vcf.fetch_variants(interval, 'NA00003'))) == 1
21+
assert len(list(multi_sample_vcf.fetch_variants(interval, 'NA00001'))) == 0
2122

2223
interval = Interval('chr1', 7, 12)
2324
assert len(list(multi_sample_vcf.fetch_variants(interval))) == 0

0 commit comments

Comments
 (0)