Is it possible to integrate shell scripts in snakemake
1
0
Entering edit mode
6 weeks ago
iibrams07 • 0

Hello,

I need to integrate as inputs/outputs scripts written in python, R as well as shell scripts. I also would like to add to this list jupyter notebooks in constructing modular pipelines. While I found in the documentation about snakemake that some of this is possible, I did not find a clear indication as of the use of shell scripts inside the snakemake code. I also found that snake make integrates shell commands.

My questions are: Can snakemake integrate shell scripts in building bioinformatics pipelines? Can nextflow integrate it and other scripts (and jupyter notebooks) as well?

I have no experience in using snakemake or nextflow but willing to do so in future.

Many thanks.

Bioinformatics • 292 views
1
Entering edit mode

well each script/shell section of a nextflow or a snakemake is a kind of shell script itself... for example if your script hello.sh is

#!/bin/bash
echo Hello


in nextflow you could write

script:

/path/to/hello.sh > output.txt



or

script:

echo Hello  > output.txt


1
Entering edit mode
6 weeks ago
lily ▴ 70

Sure, you can easily run your shell scripts in Snakemake.

A rule can, for example, look like the following:

rule shell_rule:
input: "path/to/input"
output: "path/to/output"
shell: "my_shell.sh {input} {output}"


You just have to make sure / adjust your scripts such that they handle the input and output files accordingly.