1- from pyfaidx import Sequence
21from pybedtools import Interval
2+ from pyfaidx import Sequence
33from kipoiseq .extractors import BaseExtractor , FastaStringExtractor
44try :
55 from cyvcf2 import VCF
@@ -18,7 +18,7 @@ class MultiSampleVCF(VCF):
1818
1919 def __init__ (self , * args , ** kwargs ):
2020 from cyvcf2 import VCF
21- super ().__init__ (* args , ** kwargs )
21+ super (MultiSampleVCF , self ).__init__ (* args , ** kwargs )
2222 self .sample_mapping = dict (zip (self .samples , range (len (self .samples ))))
2323
2424 def fetch_variants (self , interval , sample_id = None ):
@@ -46,11 +46,11 @@ def restore(self, sequence):
4646 """
4747 for i , interval in enumerate (self ):
4848 # interval.end can be bigger than interval.start
49- interval . end = max (interval . start , interval .end )
49+ interval_len = max (0 , interval .end - interval . start )
5050
5151 if type (self [i ]) == Interval :
5252 start = interval .start - sequence .start
53- end = start + interval . length
53+ end = start + interval_len
5454 self [i ] = sequence [start : end ]
5555
5656 def _concat (self ):
0 commit comments