This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it possible to integrate shell scripts in snakemake

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.

snakemake

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 answer

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.

Log in to answer this question.