@@ -61,19 +61,21 @@ def read_bam(
61
61
"""
62
62
path = Path (path )
63
63
if index is None :
64
- bai_index = path .with_suffix (".bai" )
65
- csi_index = path .with_suffix (".csi" )
64
+ bai_index = path .with_suffix (path . suffix + ".bai" )
65
+ csi_index = path .with_suffix (path . suffix + ".csi" )
66
66
if bai_index .exists ():
67
- index = bai_index
67
+ index = str ( bai_index )
68
68
elif csi_index .exists ():
69
- index = csi_index
69
+ index = str ( csi_index )
70
70
else :
71
71
msg = "Index .bai or .csi file not found."
72
72
raise FileNotFoundError (msg )
73
73
74
74
vpos = ox .partition_from_index_file (index , chunksize )
75
75
chunks = [
76
- dask .delayed (_read_bam_vpos_from_path )(path , tuple (vpos [i ]), tuple (vpos [i + 1 ]))
76
+ dask .delayed (_read_bam_vpos_from_path )(
77
+ str (path ), tuple (vpos [i ]), tuple (vpos [i + 1 ])
78
+ )
77
79
for i in range (len (vpos ) - 1 )
78
80
]
79
81
@@ -103,19 +105,21 @@ def read_vcf(
103
105
"""
104
106
path = Path (path )
105
107
if index is None :
106
- tbi_index = path .with_suffix (".tbi" )
107
- csi_index = path .with_suffix (".csi" )
108
+ tbi_index = path .with_suffix (path . suffix + ".tbi" )
109
+ csi_index = path .with_suffix (path . suffix + ".csi" )
108
110
if tbi_index .exists ():
109
- index = tbi_index
111
+ index = str ( tbi_index )
110
112
elif csi_index .exists ():
111
- index = csi_index
113
+ index = str ( csi_index )
112
114
else :
113
115
msg = "Index .tbi or .csi file not found."
114
116
raise FileNotFoundError (msg )
115
117
116
118
vpos = ox .partition_from_index_file (index , chunksize )
117
119
chunks = [
118
- dask .delayed (_read_vcf_vpos_from_path )(path , tuple (vpos [i ]), tuple (vpos [i + 1 ]))
120
+ dask .delayed (_read_vcf_vpos_from_path )(
121
+ str (path ), tuple (vpos [i ]), tuple (vpos [i + 1 ])
122
+ )
119
123
for i in range (len (vpos ) - 1 )
120
124
]
121
125
@@ -145,16 +149,18 @@ def read_bcf(
145
149
"""
146
150
path = Path (path )
147
151
if index is None :
148
- csi_index = path .with_suffix (".csi" )
152
+ csi_index = path .with_suffix (path . suffix + ".csi" )
149
153
if csi_index .exists ():
150
- index = csi_index
154
+ index = str ( csi_index )
151
155
else :
152
156
msg = "Index .csi file not found."
153
157
raise FileNotFoundError (msg )
154
158
155
159
vpos = ox .partition_from_index_file (index , chunksize )
156
160
chunks = [
157
- dask .delayed (_read_bcf_vpos_from_path )(path , tuple (vpos [i ]), tuple (vpos [i + 1 ]))
161
+ dask .delayed (_read_bcf_vpos_from_path )(
162
+ str (path ), tuple (vpos [i ]), tuple (vpos [i + 1 ])
163
+ )
158
164
for i in range (len (vpos ) - 1 )
159
165
]
160
166
0 commit comments