Learn how to upload a Snakemake workflow on Latch.
>=3.8
and <=3.11
== 2.55.0.a6
profiles/default
and in it create a file called config.yaml
:
config.yaml
:
latch_metadata
and in it create a file called __init__.py
:
latch_metadata/__init__.py
, create a SnakemakeV2Metadata
object as below:
samples_dir
, genome_dir
, and results_dir
. The former two are inputs to the pipeline and the latter is the location where outputs will be stored.
We want all three of these to be exposed in the UI, so we will add them to the parameters
dict in latch_metadata/__init__.py
:
LatchDir
s (we made results_dir
a LatchOutputDir
because it is an output directory).
For now, this is all we need and we can move on, but if you like feel free to customize the metadata object further using the interface described here.
Let’s inspect the most relevant fields of the SnakemakeV2Metadata
object:
display_name
: The display name of the workflow, as it will appear on the Latch UI.
author
: Name of the person or organization that publishes the workflow
parameters
: Input parameters to the workflow, defined as SnakemakeParameter
objects. The Latch Console will expose these parameters to scientists before they execute the workflow.
wf
containing a file called entrypoint.py
. The file should have the following contents:
wf/entrypoint.py
Dockerfile
that will define the environment the runtime executes in. In particular, we want that environment to contain the conda environment defined by environment.yaml
.
Again, we can accomplish this with a simple command:
Dockerfile
with the following contents:
Dockerfile
latch register
command searches for a Latch workflow in the current directory and registers it to Latch.
After running the above command, the Latch SDK will generate the necessary files and upload your workflow to Latch.
Once the workflow is registered, navigate to the Workflows tab in the Latch Console and select the workflow you previously registered.
latch cp
:
snakemake-tutorial-data
in your account on Latch.
Now, navigate to the Workflows tab in the Latch Console and select the workflow you previously registered.
Then, select the appropriate input parameters from the test data you uploaded and click Launch Workflow
to execute the workflow.
Executions
tab of your workflow.
Under the Graph & Logs
tab, you can view the generated DAG and monitor the execution of your Snakemake workflow.
Once the workflow starts executing, you can monitor the status of each rule in the workflow through the Latch Console interface.
entrypoint
file itself. Since we need to know the contents of the Sample directory outside of a rule, we will need to stage it locally before the pipeline executes.
First, add the following import to the top of the wf/entrypoint.py
file:
snakemake_runtime(...)
so that it is the following:
samples_dir
before calling snakemake
- this way we will know the contents of the directory without needing to be in a rule.
Lastly, we will need to edit the Snakefile and remove the hardcoded samples:
latch snakemake generate-entrypoint .
to create the Latch wrapper.latch dockerfile --snakemake -c environment.yaml . -f
for the execution environment.latch register -y .
.entrypoint.py
for additional pre- or post-processing logic.