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.
- Syntax definitions based on Python, with added Snakemake keywords
- Language rules based on Python
- Snippets
Example taken from Snakemake documentation.
[Keywords and Functions](src/keywords.yaml)
-
Configurations
- these keywords specified in the format
<keyword>: <values>
within a snakefile. - for example:
configfile: "config.yaml" onsuccess: print("All jobs finished successfully.") include: "workflow/report.smk"
- these keywords specified in the format
-
rule <rulename>:
defines a rule with its parameters, followed by an indented body- [
checkpoint <rulename>:
] is a special type ofrule
that allows dynamic determination of workflow steps based on its output. module <modulename>:
declares a module repository from which rules can be importedsubworkflow
is now deprecated
-
Rule Parameters
-
- Define where and how to import rules when using the
module
directive. - Example:
module remote: snakefile: "local.smk" config: {**config, "remote": True} replace_prefix: "local/" prefix: "remote/" use rule * from remote as remote_*
- Define where and how to import rules when using the
-
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 viarules.<rulename>
- workflow
checkpoints
: access outputs of checkpoint rulesstorage
access
scatter
andgather
- The following classes are available without explicit import from the snakemake module:
-
Job Parameters:
- These parameters are only available during job execution and should be used within
run
orshell
blocks- input
- output
- params
- wildcards
- threads
- resources
- log
config
is a dict that contains the configuration values and can be accessed everywhere
- These parameters are only available during job execution and should be used within
-
Functions:
- Various built-in helper functions are available for use without needing to import them
- recognize files provided as string after
include:
,conda
,snakefile
, and allow quickly jumping to them - 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]+}"