Skip to content

Commit 2abcfc6

Browse files
committed
merge
2 parents 440f5d1 + 46bee69 commit 2abcfc6

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/vitessce/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class FileType(DocEnum):
191191
CLUSTERS_JSON = "clusters.json", "A JSON-based expression matrix file type (this file type is poorly named)."
192192
GENES_JSON = "genes.json", "A JSON-based expression matrix file type."
193193
GENOMIC_PROFILES_ZARR = "genomic-profiles.zarr", "The Zarr-based genomic profile (multivec) file type."
194+
GENOMIC_PROFILES_ZARR_ZIP = "genomic-profiles.zarr.zip", "The Zarr-based genomic profile (multivec) file type, in a Zarr directory store that has been zipped."
194195
ANNDATA_CELLS_ZARR = "anndata-cells.zarr", "The Zarr-based cells file type from an anndata object."
195196
ANNDATA_CELL_SETS_ZARR = "anndata-cell-sets.zarr", "The Zarr-based cell-sets file type from an anndata object."
196197
ANNDATA_EXPRESSION_MATRIX_ZARR = "anndata-expression-matrix.zarr", "The Zarr-based expression matrix file type from an anndata object."

src/vitessce/wrappers.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ def generator(base_url):
15831583

15841584
class MultivecZarrWrapper(AbstractWrapper):
15851585

1586-
def __init__(self, zarr_path=None, zarr_url=None, **kwargs):
1586+
def __init__(self, zarr_path=None, zarr_url=None, is_zip=None, **kwargs):
15871587
super().__init__(**kwargs)
15881588
self._repr = make_repr(locals())
15891589
if zarr_url is not None and zarr_path is not None:
@@ -1594,11 +1594,18 @@ def __init__(self, zarr_path=None, zarr_url=None, **kwargs):
15941594
"Expected either zarr_url or zarr_path to be provided")
15951595
self._zarr_path = zarr_path
15961596
self._zarr_url = zarr_url
1597+
self.is_zip = is_zip
15971598
if self._zarr_path is not None:
15981599
self.is_remote = False
1600+
if is_zip is None and '.zip' in str(zarr_path):
1601+
self.is_zip = True
15991602
else:
16001603
self.is_remote = True
1601-
self.local_dir_uid = make_unique_filename(".multivec.zarr")
1604+
if is_zip is None and '.zip' in str(zarr_url):
1605+
self.is_zip = True
1606+
if self.is_zip is None:
1607+
self.is_zip = False
1608+
self.local_dir_uid = make_unique_filename(".multivec.zarr.zip" if self.is_zip else ".multivec.zarr")
16021609

16031610
def convert_and_save(self, dataset_uid, obj_i, base_dir=None):
16041611
# Only create out-directory if needed
@@ -1615,6 +1622,8 @@ def convert_and_save(self, dataset_uid, obj_i, base_dir=None):
16151622
def make_genomic_profiles_routes(self, dataset_uid, obj_i):
16161623
if self.is_remote:
16171624
return []
1625+
elif self.is_zip:
1626+
return self.get_local_file_route(dataset_uid, obj_i, self._zarr_path, self.local_dir_uid)
16181627
else:
16191628
return self.get_local_dir_route(dataset_uid, obj_i, self._zarr_path, self.local_dir_uid)
16201629

@@ -1626,7 +1635,7 @@ def get_zarr_url(self, base_url="", dataset_uid="", obj_i=""):
16261635
def make_genomic_profiles_file_def_creator(self, dataset_uid, obj_i):
16271636
def genomic_profiles_file_def_creator(base_url):
16281637
obj_file_def = {
1629-
"fileType": "genomic-profiles.zarr",
1638+
"fileType": ft.GENOMIC_PROFILES_ZARR_ZIP.value if self.is_zip else ft.GENOMIC_PROFILES_ZARR.value,
16301639
"url": self.get_zarr_url(base_url, dataset_uid, obj_i)
16311640
}
16321641
if self._request_init is not None:

0 commit comments

Comments
 (0)