File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
3637class IntervalSeqBuilder (list ):
@@ -161,10 +162,10 @@ def _variant_to_sequence(self, variants):
161162 """
162163 for v in variants :
163164 ref = Sequence (name = v .CHROM , seq = v .REF ,
164- start = v .POS , end = v .POS + len (v .REF ))
165+ start = v .start , end = v .start + len (v .REF ))
165166 # TO DO: consider alternative alleles.
166167 alt = Sequence (name = v .CHROM , seq = v .ALT [0 ],
167- start = v .POS , end = v .POS + len (v .ALT [0 ]))
168+ start = v .start , end = v .start + len (v .ALT [0 ]))
168169 yield ref , alt
169170
170171 def _split_overlapping (self , variant_pairs , anchor ):
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments