Skip to content

Commit ff7ed5a

Browse files
Rename convert_vcf to convert
1 parent c4d180e commit ff7ed5a

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

bio2zarr/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def encode(if_path, zarr_path, verbose, schema, worker_processes):
8585
@worker_processes
8686
def convert_vcf(vcfs, out_path, verbose, worker_processes):
8787
setup_logging(verbose)
88-
vcf.convert_vcf(
88+
vcf.convert(
8989
vcfs, out_path, show_progress=True, worker_processes=worker_processes
9090
)
9191

bio2zarr/vcf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ def encode(
13441344
)
13451345

13461346

1347-
def convert_vcf(
1347+
def convert(
13481348
vcfs,
13491349
out_path,
13501350
*,

tests/test_cli.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,19 @@ def test_encode(self):
6464
worker_processes=1,
6565
show_progress=True,
6666
)
67+
68+
def test_convert(self):
69+
runner = ct.CliRunner(mix_stderr=False)
70+
with mock.patch("bio2zarr.vcf.convert") as mocked:
71+
result = runner.invoke(
72+
cli.vcf2zarr, ["convert", "vcf_path", "zarr_path"], catch_exceptions=False
73+
)
74+
assert result.exit_code == 0
75+
assert len(result.stdout) == 0
76+
assert len(result.stderr) == 0
77+
mocked.assert_called_once_with(
78+
("vcf_path",),
79+
"zarr_path",
80+
worker_processes=1,
81+
show_progress=True,
82+
)

tests/test_simulated_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_ploidy(self, ploidy, tmp_path):
2828
# This also compresses the input file
2929
pysam.tabix_index(str(vcf_file), preset="vcf")
3030
out = tmp_path / "example.vcf.zarr"
31-
vcf.convert_vcf([tmp_path / "sim.vcf.gz"], out)
31+
vcf.convert([tmp_path / "sim.vcf.gz"], out)
3232
ds = sg.load_dataset(out)
3333
assert ds.sizes["ploidy"] == ploidy
3434
assert ds.sizes["variants"] == ts.num_sites

tests/test_vcf_examples.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TestSmallExample:
1313
@pytest.fixture(scope="class")
1414
def ds(self, tmp_path_factory):
1515
out = tmp_path_factory.mktemp("data") / "example.vcf.zarr"
16-
vcf.convert_vcf([self.data_path], out)
16+
vcf.convert([self.data_path], out)
1717
return sg.load_dataset(out)
1818

1919
def test_filters(self, ds):
@@ -224,7 +224,7 @@ def test_call_HQ(self, ds):
224224
def test_no_genotypes(self, ds, tmp_path):
225225
path = "tests/data/vcf/sample_no_genotypes.vcf.gz"
226226
out = tmp_path / "example.vcf.zarr"
227-
vcf.convert_vcf([path], out)
227+
vcf.convert([path], out)
228228
ds2 = sg.load_dataset(out)
229229
assert len(ds2["sample_id"]) == 0
230230
for col in ds:
@@ -244,7 +244,7 @@ def test_chunk_size(
244244
self, ds, tmp_path, chunk_length, chunk_width, y_chunks, x_chunks
245245
):
246246
out = tmp_path / "example.vcf.zarr"
247-
vcf.convert_vcf(
247+
vcf.convert(
248248
[self.data_path], out, chunk_length=chunk_length, chunk_width=chunk_width
249249
)
250250
ds2 = sg.load_dataset(out)
@@ -277,7 +277,7 @@ def test_chunk_size(
277277
@pytest.mark.parametrize("worker_processes", [0, 1, 2])
278278
def test_worker_processes(self, ds, tmp_path, worker_processes):
279279
out = tmp_path / "example.vcf.zarr"
280-
vcf.convert_vcf(
280+
vcf.convert(
281281
[self.data_path], out, chunk_length=3, worker_processes=worker_processes
282282
)
283283
ds2 = sg.load_dataset(out)
@@ -306,7 +306,7 @@ class Test1000G2020Example:
306306
@pytest.fixture(scope="class")
307307
def ds(self, tmp_path_factory):
308308
out = tmp_path_factory.mktemp("data") / "example.vcf.zarr"
309-
vcf.convert_vcf([self.data_path], out, worker_processes=0)
309+
vcf.convert([self.data_path], out, worker_processes=0)
310310
return sg.load_dataset(out)
311311

312312
def test_position(self, ds):
@@ -418,7 +418,7 @@ class Test1000G2020AnnotationsExample:
418418
def ds(self, tmp_path_factory):
419419
out = tmp_path_factory.mktemp("data") / "example.zarr"
420420
# TODO capture warnings from htslib here
421-
vcf.convert_vcf([self.data_path], out, worker_processes=0)
421+
vcf.convert([self.data_path], out, worker_processes=0)
422422
return sg.load_dataset(out)
423423

424424
def test_position(self, ds):
@@ -650,7 +650,7 @@ class TestGeneratedFieldsExample:
650650
@pytest.fixture(scope="class")
651651
def ds(self, tmp_path_factory):
652652
out = tmp_path_factory.mktemp("data") / "vcf.zarr"
653-
vcf.convert_vcf([self.data_path], out)
653+
vcf.convert([self.data_path], out)
654654
return sg.load_dataset(out)
655655

656656
def test_info_string1(self, ds):
@@ -700,5 +700,5 @@ def test_info_string2(self, ds):
700700
def test_by_validating(name, tmp_path):
701701
path = f"tests/data/vcf/{name}"
702702
out = tmp_path / "test.zarr"
703-
vcf.convert_vcf([path], out, worker_processes=0)
703+
vcf.convert([path], out, worker_processes=0)
704704
vcf.validate(path, out)

0 commit comments

Comments
 (0)