-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_convert.py
39 lines (30 loc) · 1.07 KB
/
test_convert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pytest
from anndata import read_zarr
from convert import convert
class TestConvert:
@pytest.fixture()
def h5_file(self):
return "data/filtered_gene_bc_matrices_h5.h5"
@pytest.fixture()
def h5ad_file(self):
return "data/filtered_gene_bc_matrices.h5ad"
def test_10x_h5_to_zarr(self, h5_file, tmpdir):
p = tmpdir.join("filtered_gene_bc_matrices.zarr")
input = h5_file
output = str(p)
convert(input, output)
# read back and check a few things
adata = read_zarr(output)
assert adata.X.shape == (34, 343)
assert adata.obs.shape == (34, 0)
assert adata.var.shape == (343, 1)
def test_h5ad_to_zarr(self, h5ad_file, tmpdir):
p = tmpdir.join("filtered_gene_bc_matrices.zarr")
input = h5ad_file
output = str(p)
convert(input, output)
# read back and check a few things
adata = read_zarr(output)
assert adata.X.shape == (2700, 32738)
assert adata.obs.shape == (2700, 0)
assert adata.var.shape == (32738, 1)