Skip to content

Commit 7db7586

Browse files
committed
Change zip to fail if iterables are different lengths
1 parent b815d54 commit 7db7586

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

bio2zarr/plink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ def validate(bed_path, zarr_path):
185185
assert call_genotype.shape[2] == 2
186186

187187
row_id = 0
188-
for bed_row, zarr_row in zip(bed_genotypes, call_genotype, strict=False):
188+
for bed_row, zarr_row in zip(bed_genotypes, call_genotype, strict=True):
189189
# print("ROW", row_id)
190190
# print(bed_row, zarr_row)
191191
row_id += 1
192-
for bed_call, zarr_call in zip(bed_row, zarr_row, strict=False):
192+
for bed_call, zarr_call in zip(bed_row, zarr_row, strict=True):
193193
if bed_call == -127:
194194
assert list(zarr_call) == [-1, -1]
195195
elif bed_call == 0:

bio2zarr/vcf2zarr/icf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def scan_vcf(path, target_num_partitions, *, local_alleles):
289289
samples=[Sample(sample_id) for sample_id in vcf.samples],
290290
contigs=[
291291
Contig(contig_id, length)
292-
for contig_id, length in zip(vcf.seqnames, contig_lengths, strict=False)
292+
for contig_id, length in zip(vcf.seqnames, contig_lengths, strict=True)
293293
],
294294
filters=filters,
295295
fields=fields,
@@ -766,7 +766,7 @@ def chunks(self, partition_id, start_chunk=0):
766766
for count, cumulative in zip(
767767
chunk_num_records[start_chunk:],
768768
chunk_cumulative_records[start_chunk + 1 :],
769-
strict=False,
769+
strict=True,
770770
):
771771
path = partition_path / f"{cumulative}"
772772
chunk = self.read_chunk(path)

bio2zarr/vcf2zarr/vcz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def encode_alleles_partition(self, partition_index):
760760
for ref, alt in zip(
761761
ref_field.iter_values(partition.start, partition.stop),
762762
alt_field.iter_values(partition.start, partition.stop),
763-
strict=False,
763+
strict=True,
764764
):
765765
j = alleles.next_buffer_row()
766766
alleles.buff[j, :] = constants.STR_FILL

bio2zarr/vcf2zarr/verification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def assert_format_val_equal(vcf_val, zarr_val, vcf_type, vcf_number):
114114
assert isinstance(vcf_val, np.ndarray)
115115
if vcf_type in ("String", "Character"):
116116
assert len(vcf_val) == len(zarr_val)
117-
for v, z in zip(vcf_val, zarr_val, strict=False):
117+
for v, z in zip(vcf_val, zarr_val, strict=True):
118118
if vcf_number == "1":
119119
assert v == z
120120
else:

bio2zarr/vcf_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
450450
return False
451451

452452
def contig_record_counts(self):
453-
d = dict(zip(self.sequence_names, self.index.record_counts, strict=False))
453+
d = dict(zip(self.sequence_names, self.index.record_counts, strict=True))
454454
if self.file_type == VcfFileType.BCF:
455455
d = {k: v for k, v in d.items() if v > 0}
456456
return d

0 commit comments

Comments
 (0)