Skip to content

Commit caa3398

Browse files
Merge pull request #54 from jeromekelleher/multi-chr
Multi chr
2 parents 1ae0762 + e272fb0 commit caa3398

File tree

22 files changed

+91
-16
lines changed

22 files changed

+91
-16
lines changed

bio2zarr/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,10 @@ def results_as_completed(self):
225225
def __exit__(self, exc_type, exc_val, exc_tb):
226226
if exc_type is None:
227227
wait_on_futures(self.futures)
228+
# Note: this doesn't seem to be working correctly. If
229+
# we set a timeout of None we get deadlocks
228230
set_progress(self.progress_config.total)
229-
timeout = None
231+
timeout = 1
230232
else:
231233
cancel_futures(self.futures)
232234
timeout = 0

bio2zarr/vcf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def make_field_def(name, vcf_type, vcf_number):
199199

200200

201201
def scan_vcf(path, target_num_partitions):
202-
logger.debug(f"Scanning {path}")
203202
with vcf_utils.IndexedVcf(path) as indexed_vcf:
204203
vcf = indexed_vcf.vcf
205204
filters = [
@@ -238,6 +237,8 @@ def scan_vcf(path, target_num_partitions):
238237
pass
239238

240239
regions = indexed_vcf.partition_into_regions(num_parts=target_num_partitions)
240+
logger.info(
241+
f"Split {path} into {len(regions)} regions (target={target_num_partitions})")
241242
for region in regions:
242243
metadata.partitions.append(
243244
VcfPartition(

bio2zarr/vcf_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,16 @@ class IndexedVcf(contextlib.AbstractContextManager):
369369
def __init__(self, vcf_path, index_path=None):
370370
self.vcf = None
371371
vcf_path = pathlib.Path(vcf_path)
372+
if not vcf_path.exists():
373+
raise FileNotFoundError(vcf_path)
372374
# TODO use constants here instead of strings
373375
if index_path is None:
374376
index_path = vcf_path.with_suffix(vcf_path.suffix + ".tbi")
375377
if not index_path.exists():
376378
index_path = vcf_path.with_suffix(vcf_path.suffix + ".csi")
377379
if not index_path.exists():
378-
raise ValueError("Cannot find .tbi or .csi file.")
380+
raise FileNotFoundError(
381+
"Cannot find .tbi or .csi file for {vcf_path}")
379382
else:
380383
index_path = pathlib.Path(index_path)
381384

394 Bytes
Binary file not shown.
99 Bytes
Binary file not shown.
345 Bytes
Binary file not shown.
112 Bytes
Binary file not shown.
398 Bytes
Binary file not shown.
100 Bytes
Binary file not shown.
347 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)