Skip to the content.

A fork of the Snakemake Language extension for VS Code with additions for Positron: running Snakemake pipelines and following them live, locally or as Posit Workbench jobs. Everything below the Positron section is upstream’s documentation and applies unchanged.

Positron Snakemake: running the rnaseq workflow from Positron with its jobs on Posit Workbench, following them in Pipeline Runs and the run dashboard

Watch the full demo (2 min):

Positron

In Positron the extension adds:

In VS Code the extension behaves like upstream.

Requirements

The extension ID is posit.positron-snakemake. It contributes the same language, grammars and snippets as snakemake.snakemake-lang, so it stays inactive, and offers to uninstall that extension, while both are installed.

To install, build the VSIX with make and install positron-snakemake.vsix, or run make install. Settings for runs are under snakemake.run.*.


Snakemake Language Support

Provides basic language support for Snakemake files (Snakefile, *.smk). Feedback, suggestions, and contributions are very welcome!

This project has been started by Peter Alping, and can be considered a fork of this repository.

Features

Example

Snakemake syntax highlighting example

Example taken from Snakemake documentation.

Supported Syntax

[Keywords and Functions](https://github.com/sol-eng/positron-snakemake-extension/blob/main/src/keywords.yaml) - Configurations - these keywords specified in the format `: ` within a snakefile. - for example: ```snakemake configfile: "config.yaml" onsuccess: print("All jobs finished successfully.") include: "workflow/report.smk" ``` - [Rules and Modules](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#snakefiles-and-rules) - `rule :` defines a rule with its parameters, followed by an indented body - [`checkpoint :`] is a special type of `rule` that allows dynamic determination of workflow steps based on its output. - `module :` declares a module repository from which rules can be imported - `subworkflow` is now deprecated - Rule Parameters - Used in `rule` and `checkpoint` blocks to define inputs, outputs, and other settings. - You can re- `used rule as ... with` different parameters, but you cannot change the way it runs, including: - run - shell - script - [`notebook`](https://snakemake.readthedocs.io/en/stable/tutorial/interaction_visualization_reporting/tutorial.html#tutorial-interaction-visualization-and-reporting-with-snakemake) - [`wrapper`](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#wrappers) - template_engine - [`cwl`](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#common-workflow-language-cwl-support) - [Module Parameters](https://snakemake.readthedocs.io/en/stable/snakefiles/modularization.html#modules): - Define where and how to import rules when using the `module` directive. - Example: ```snakemake module remote: snakefile: "local.smk" config: {**config, "remote": True} replace_prefix: "local/" prefix: "remote/" use rule * from remote as remote_* ``` - Global Variables: - The following classes are available without explicit import from the snakemake module: - `Path` - `WorkflowError` - Important variables used across workflows include: - snakemake - `rules`: reference rules via `rules.` - workflow - `checkpoints`: access outputs of [checkpoint](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#data-dependent-conditional-execution) rules - [`storage`](https://snakemake.readthedocs.io/en/stable/snakefiles/storage.html#storage-support) - [`access`](https://snakemake.readthedocs.io/en/stable/snakefiles/storage.html#access-pattern-annotation) - [`scatter` and `gather`](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#defining-scatter-gather-processes) - Job Parameters: - These parameters are only available during job execution and should be used within `run` or `shell` blocks - input - output - params - wildcards - threads - resources - log - [`config`](https://snakemake.readthedocs.io/en/stable/snakefiles/configuration.html#configuration) is a dict that contains the configuration values and can be accessed everywhere - Functions: - Various [built-in helper functions](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#helpers-for-defining-rules) are available for use without needing to import them </details> ## TODO - [x] recognize files provided as string after `include:`, `conda`, `snakefile`, and allow quickly jumping to them - [x] add bash-color to docstring in `shell:` block - [ ] Indentation rules (really tricky for some reason) - [ ] Recognize wildcard constraints inside string substitutions: `"{sample,[A-Za-z0-9]+}"` ## Snakemake Support for other Editors - [Vim](https://github.com/snakemake/snakemake/tree/master/misc/vim)