Extensions use Snakemake format to define how files are processed. A complete extension usually requires three components:
- Rules File (
.smk): Defines the workflow logic, including target rules (the desired outputs) and runner rules (the actual execution steps). - Configuration (
config.yml): Defines parameters required by your rules. - Environment (
envs/*.yml): Specifies the Conda environment needed to run the tool.
Example: Adding a tool (AwesomeTool)
To add a tool that takes input FASTQ files and a database to produce an output, your .smk file would look like this:
AWESOME_FP = CLASSIFY_FP / 'awesome'
rule all_awesome_tool:
input:
expand(AWESOME_FP / "{sample}.awesome", sample=Samples.keys())
rule run_awesome_tool:
input:
r1 = QC_FP / "decontam" / "{sample}_1.fastq.gz",
r2 = QC_FP / "decontam" / "{sample}_2.fastq.gz",
db = Cfg['all']['awesome_db']
output:
AWESOME_FP / "{sample}.awesome"
conda:
"awesome_env.yaml"
shell:
"""
AwesomeTool -i {input.r1} -d {input.db} -o {output}
"""
Configuration and Environment
Update your config.yml to include the new parameters:
sbx_awesome_tool:
awesome_db: /path/to/awesome_db
And define the Conda environment in envs/sbx_awesome_tool_env.yml:
name: awesome_env
channels:
- bioconda
- conda-forge
dependencies:
- awesome_tool