Home

Awesome

shournal-to-snakemake

Transform a command series observed by shournal to snakemake rules.

shournal tracks read and written files of shell commands. Thus, for each command the input- and output-section of a snakemake rule may be generated. Matched file-paths are automatically replaced in the command string with {input} and {output}.

Basic Usage

After shournal is installed, start a new (by shournal observed) shell session. Within that perform the (shell-based) data analysis of your choice.

Once done, from within the same shell-session, generate the snakemake rules by

shournal -q --output-format json -sid $SHOURNAL_SESSION_ID | shournal-to-snakemake

Toy example

$ SHOURNAL_ENABLE
$ echo stuff > foo
$ cat foo > bar
$ shournal -q --output-format json -sid $SHOURNAL_SESSION_ID | shournal-to-snakemake
rule undefined_1:
    output:
        "foo",
    shell:
        # raw: echo stuff > foo
        "echo stuff > {output}"


rule undefined_2:
    input:
        "foo",
    output:
        "bar",
    shell:
        # raw: cat foo > bar
        "cat {input} > {output}"

General hints

Installation

PyPi

Install from PyPi by executing the following command in a terminal:

pip install shournal-to-snakemake

From Source

Create a wheel directly from source by executing

python3 setup.py sdist bdist_wheel

Install the wheel as usual, e.g. by

pip3 install --user dist/shournal_to_snakemake-VERSION-*.whl

License

Copyright © 2020 Tycho Kirchner (see LICENSE)