Skip to content

Commit

Permalink
Drop URI datatype in favor of deferred
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Oct 31, 2024
1 parent e273bc8 commit 25bff00
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
3 changes: 0 additions & 3 deletions lib/galaxy/config/sample/datatypes_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@
</datatype>
<datatype extension="directory" type="galaxy.datatypes.data:Directory"/>
<datatype extension="zarr" type="galaxy.datatypes.data:ZarrDirectory" />
<datatype extension="zarr_uri" type="galaxy.datatypes.text:ZarrRemoteUri" display_in_upload="true"/>
<datatype extension="ome_zarr" type="galaxy.datatypes.images:OMEZarr" />
<datatype extension="ome_zarr_uri" type="galaxy.datatypes.text:OMEZarrRemoteUri" subclass="true" display_in_upload="true"/>
<datatype extension="yaml" type="galaxy.datatypes.text:Yaml" display_in_upload="true" />
<!-- Proteomics Datatypes -->
<datatype extension="mrm" type="galaxy.datatypes.tabular:Tabular" display_in_upload="true" subclass="true"/>
Expand Down Expand Up @@ -1118,7 +1116,6 @@
<sniffer type="galaxy.datatypes.qiime2:QIIME2Metadata"/>
<sniffer type="galaxy.datatypes.qiime2:QIIME2Artifact"/>
<sniffer type="galaxy.datatypes.qiime2:QIIME2Visualization"/>
<sniffer type="galaxy.datatypes.text:ZarrRemoteUri"/>
<sniffer type="galaxy.datatypes.binary:CompressedOMEZarrZipArchive"/>
<sniffer type="galaxy.datatypes.binary:CompressedZarrZipArchive"/>
<sniffer type="galaxy.datatypes.binary:CompressedZipArchive"/>
Expand Down
48 changes: 0 additions & 48 deletions lib/galaxy/datatypes/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1421,51 +1421,3 @@ def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
(lines[9].strip() == end_header and lines[10].strip() == grid_points)
or (lines[9].strip() == end_header_spin and lines[10].strip() == grid_points_spin)
)


class ZarrRemoteUri(Text):
"""Zarr remote URI
It is a text file containing a single line with the URI to a remote Zarr store.
The URI must NOT include the protocol (http://, https://, s3://, etc.) otherwise
Galaxy will try to download it as a file.
"""

info = "Zarr remote URI"

MetadataElement(
name="remote_uri",
default=None,
desc="Remote URI to a Zarr store",
readonly=True,
optional=False,
visible=False,
)

def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> None:
with open(dataset.get_file_name()) as f:
uri = f.read().strip()
if "://" not in uri:
uri = f"https://{uri}"
dataset.metadata.remote_uri = uri

def sniff(self, filename: str) -> bool:
# Must have a single line and end with '.zarr'
with open(filename) as f:
lines = f.readlines()
return len(lines) == 1 and lines[0].strip().endswith(".zarr")

def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
if not dataset.dataset.purged:
dataset.info = self.info
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"


class OMEZarrRemoteUri(ZarrRemoteUri):
"""OME-Zarr remote URI"""

file_ext = "ome_zarr_uri"

info = "OME-Zarr remote URI"

0 comments on commit 25bff00

Please sign in to comment.