Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/vitessce/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class FileType(DocEnum):
CLUSTERS_JSON = "clusters.json", "A JSON-based expression matrix file type (this file type is poorly named)."
GENES_JSON = "genes.json", "A JSON-based expression matrix file type."
GENOMIC_PROFILES_ZARR = "genomic-profiles.zarr", "The Zarr-based genomic profile (multivec) file type."
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."
ANNDATA_CELLS_ZARR = "anndata-cells.zarr", "The Zarr-based cells file type from an anndata object."
ANNDATA_CELL_SETS_ZARR = "anndata-cell-sets.zarr", "The Zarr-based cell-sets file type from an anndata object."
ANNDATA_EXPRESSION_MATRIX_ZARR = "anndata-expression-matrix.zarr", "The Zarr-based expression matrix file type from an anndata object."
Expand Down
15 changes: 12 additions & 3 deletions src/vitessce/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ def generator(base_url):

class MultivecZarrWrapper(AbstractWrapper):

def __init__(self, zarr_path=None, zarr_url=None, **kwargs):
def __init__(self, zarr_path=None, zarr_url=None, is_zip=None, **kwargs):
super().__init__(**kwargs)
self._repr = make_repr(locals())
if zarr_url is not None and zarr_path is not None:
Expand All @@ -1594,11 +1594,18 @@ def __init__(self, zarr_path=None, zarr_url=None, **kwargs):
"Expected either zarr_url or zarr_path to be provided")
self._zarr_path = zarr_path
self._zarr_url = zarr_url
self.is_zip = is_zip
if self._zarr_path is not None:
self.is_remote = False
if is_zip is None and '.zip' in str(zarr_path):
self.is_zip = True
else:
self.is_remote = True
self.local_dir_uid = make_unique_filename(".multivec.zarr")
if is_zip is None and '.zip' in str(zarr_url):
self.is_zip = True
if self.is_zip is None:
self.is_zip = False
self.local_dir_uid = make_unique_filename(".multivec.zarr.zip" if self.is_zip else ".multivec.zarr")

def convert_and_save(self, dataset_uid, obj_i, base_dir=None):
# Only create out-directory if needed
Expand All @@ -1615,6 +1622,8 @@ def convert_and_save(self, dataset_uid, obj_i, base_dir=None):
def make_genomic_profiles_routes(self, dataset_uid, obj_i):
if self.is_remote:
return []
elif self.is_zip:
return self.get_local_file_route(dataset_uid, obj_i, self._zarr_path, self.local_dir_uid)
else:
return self.get_local_dir_route(dataset_uid, obj_i, self._zarr_path, self.local_dir_uid)

Expand All @@ -1626,7 +1635,7 @@ def get_zarr_url(self, base_url="", dataset_uid="", obj_i=""):
def make_genomic_profiles_file_def_creator(self, dataset_uid, obj_i):
def genomic_profiles_file_def_creator(base_url):
obj_file_def = {
"fileType": "genomic-profiles.zarr",
"fileType": ft.GENOMIC_PROFILES_ZARR_ZIP.value if self.is_zip else ft.GENOMIC_PROFILES_ZARR.value,
"url": self.get_zarr_url(base_url, dataset_uid, obj_i)
}
if self._request_init is not None:
Expand Down
Loading