-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# type: ignore | ||
from galaxy.datatypes.binary import ( | ||
Anndata | ||
) | ||
from .util import ( | ||
get_input_files, | ||
MockDataset, | ||
) | ||
|
||
# Tests for h5ad_metadata: | ||
|
||
|
||
def test_h5ad_sniff(): | ||
with get_input_files("anndata.h5ad") as input_files: | ||
assert Anndata.sniff(input_files[0]) is True | ||
|
||
|
||
def test_h5ad_set_meta(): | ||
with get_input_files("anndata.h5ad") as input_files: | ||
dataset = MockDataset(1) | ||
dataset.set_file_name(input_files[0]) | ||
|
||
Anndata.set_meta(dataset) | ||
|
||
assert dataset.metadata.layers_count == "9" | ||
assert dataset.metadata.layers_names == "['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp']" | ||
|
||
assert Anndata.set_meta._layercountsize(dataset) == "['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp'], 9, 0" | ||
|
||
|
||
|
||
def test_h5ad_set_peek(): | ||
with get_input_files("anndata.h5ad") as input_files: | ||
dataset = MockDataset(1) | ||
dataset.set_file_name(input_files[0]) | ||
assert Anndata.display_peek(dataset) == "Peek unavailable" | ||
|
||
Anndata.set_meta(dataset) | ||
Anndata.set_peek(dataset) | ||
|
||
assert ( | ||
dataset.peek | ||
== """ | ||
[n_obs x n_vars] | ||
640 x 11 | ||
[obs]: 2 layers | ||
blobs, index | ||
[var]: 1 layer | ||
index | ||
[obsm]: 0 layer | ||
[varm]: 0 layer | ||
[uns]: 0 layer | ||
""" | ||
) |