Skip to content

Commit c510584

Browse files
Add chrM example
1 parent ce7eca9 commit c510584

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

tests/data/vcf/1kg_2020_chrM.vcf.gz

4.15 KB
Binary file not shown.
116 Bytes
Binary file not shown.

tests/test_vcf_roundtrip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
@pytest.mark.parametrize(
9-
"vcf_file", ["sample.vcf.gz", "1kg_2020_chr20_annotations.bcf"]
9+
"vcf_file", ["sample.vcf.gz", "1kg_2020_chr20_annotations.bcf", "1kg_2020_chrM.vcf.gz"]
1010
)
1111
@pytest.mark.parametrize("implementation", ["c", "numba"])
1212
def test_vcf_to_zarr_to_vcf__real_files(shared_datadir, tmp_path, vcf_file, implementation):

vcztools/vcf_writer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ def write_vcf(
186186

187187
def c_chunk_to_vcf(root, v_chunk, contigs, filters, output):
188188
chrom = contigs[root.variant_contig.blocks[v_chunk]]
189-
pos = root.variant_position.blocks[v_chunk]
189+
# TODO check we don't truncate silently by doing this
190+
pos = root.variant_position.blocks[v_chunk].astype(np.int32)
190191
id = root.variant_id.blocks[v_chunk].astype("S")
191192
alleles = root.variant_allele.blocks[v_chunk]
192193
ref = alleles[:, 0].astype("S")

0 commit comments

Comments
 (0)