The Custom File Viewer enables scientists to click on files in Latch Data with a specific extension and view them in an application hosted on a Latch Pod without having to manually enter the pod and download the file.
.h5ad
files in Latch Data. Note that the
cellxgene file viewer is already available in Latch Data by default.
/opt/latch/custom_app
) looks like this:
pbmc3k.final.h5ad.zarr.h5ad
. However, to
launch this application from the Latch Data UI, we need to pass in the file path of the file we
want to view.
To do so, add the following command to your bash script:
LDATA_NODE_ARG
environment variable from the pod’s environment.
This variable is injected by the Latch backend and contains the ID of the
node that the user clicked on in Latch Data to launch the pod.
Now that we have the node ID, we can use latch cp
to download the file to the pod and launch the application.
LDATA_NODE_ARG
environment variable is set. If not, this pod was not launched
from a Latch Data file so we start the application with a default file.latch cp
. We download to a .tmp
file and then rename it to the
target file to avoid partial downloads from corrupting the cache..h5ad
files. The regex pattern for this is ^.*\.h5ad$
.