https://github.com/fritzbayer/snakemake-with-r
Simple template for running snakemake with R
https://github.com/fritzbayer/snakemake-with-r
r-workflow snakemake snakemake-pipeline snakemake-workflow
Last synced: 9 months ago
JSON representation
Simple template for running snakemake with R
- Host: GitHub
- URL: https://github.com/fritzbayer/snakemake-with-r
- Owner: fritzbayer
- Created: 2022-03-15T17:01:47.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T12:12:55.000Z (over 3 years ago)
- Last Synced: 2025-04-09T10:45:30.713Z (about 1 year ago)
- Topics: r-workflow, snakemake, snakemake-pipeline, snakemake-workflow
- Language: R
- Homepage:
- Size: 35.2 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple template for running snakemake with R
The following terminal commands can be used to execute this demo script.
Step 1: Activate conda and snakemake
```{r eval=FALSE}
$ conda activate base
$ conda activate snakemake
```
Step 2: Download the snakemake-with-R folder and change directory accordingly
```{r eval=FALSE}
$ cd /path/to/snakemake-with-R
```
The folder `snakemake-with-R` contains the `Snakefile`, which contains the snakemake rules from which we can execute our R scripts. The folder `scr` contains two R scripts that show two different ways how variables can be passed between R and snakemake. The folder `data` contains a simple vector that is multiplied by the snakemake rules.
Step 3: Execute R scripts in the snakemake rules
First, you can perform a dry run of Snakemake with:
```{r eval=FALSE}
$ snakemake -n
```
For the two different ways how variables can be passed between R and snakemake, there are two different Snakemake rules. You can execute them as follows:
```{r eval=FALSE}
$ snakemake --cores 1 simple_test_rule
```
or
```{r eval=FALSE}
$ snakemake --cores 1 test_rule
```
The output is a simple multplication of the imput vector.
From here, you can make your workflow arbitrarily complex - enjoy.