mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-13 00:44:55 +08:00
Merge pull request #16255 from astrovsky01/visium_datatype
Add Visium datatype for squidpy and spatialomics tools
This commit is contained in:
@@ -185,6 +185,7 @@
|
||||
<datatype extension="grib" type="galaxy.datatypes.binary:Grib" mimetype="application/octet-stream" display_in_upload="true"/>
|
||||
<datatype extension="loom" type="galaxy.datatypes.binary:Loom" description="An HDF5-based Loom File" mimetype="application/octet-stream" display_in_upload="true"/>
|
||||
<datatype extension="h5ad" type="galaxy.datatypes.binary:Anndata" description="An HDF5-based anndata File" mimetype="application/octet-stream" display_in_upload="true"/>
|
||||
<datatype extension="visium.tar.gz" type="galaxy.datatypes.binary:Visium" subclass="true" display_in_upload="true" description="Visium is a tar.gz archive with at least a 'Spatial' subfolder, a filtered h5 file and a raw h5 file." />
|
||||
<datatype extension="mz5" type="galaxy.datatypes.binary:H5" subclass="true" mimetype="application/octet-stream" display_in_upload="true"/>
|
||||
<datatype extension="hyphy_results.json" type="galaxy.datatypes.text:Json" mimetype="application/json" subclass="true" display_in_upload="false"/>
|
||||
<datatype extension="hivtrace" type="galaxy.datatypes.text:Json" mimetype="application/json" subclass="true" display_in_upload="false"/>
|
||||
|
||||
@@ -318,6 +318,29 @@ class Meryldb(CompressedArchive):
|
||||
return False
|
||||
|
||||
|
||||
class Visium(CompressedArchive):
|
||||
"""Visium is a tar.gz archive with at least a 'Spatial' subfolder, a filtered h5 file and a raw h5 file."""
|
||||
|
||||
file_ext = "visium.tar.gz"
|
||||
|
||||
def sniff(self, filename: str) -> bool:
|
||||
"""
|
||||
Check data structure:
|
||||
Contains h5 files
|
||||
Contains spatial folder
|
||||
"""
|
||||
try:
|
||||
if filename and tarfile.is_tarfile(filename):
|
||||
with tarfile.open(filename, "r") as temptar:
|
||||
_tar_content = temptar.getnames()
|
||||
if "spatial" in _tar_content:
|
||||
if len([_ for _ in _tar_content if _.endswith("matrix.h5")]) == 2:
|
||||
return True
|
||||
except Exception as e:
|
||||
log.warning("%s, sniff Exception: %s", self, e)
|
||||
return False
|
||||
|
||||
|
||||
class Bref3(Binary):
|
||||
"""Bref3 format is a binary format for storing phased, non-missing genotypes for a list of samples."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user