Skip to main content

Transform a command series from shournal into Snakemake rules

Project description

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

  • Don't change the working directory during the workflow.
  • Do not use wildcards or variables (in file-paths), otherwise the files in the command string cannot be correctly replaced by {input} or {output}.
  • Stick to basic posix shell syntax

Installation

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)

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shournal-to-snakemake-0.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shournal_to_snakemake-0.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file shournal-to-snakemake-0.1.tar.gz.

File metadata

  • Download URL: shournal-to-snakemake-0.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for shournal-to-snakemake-0.1.tar.gz
Algorithm Hash digest
SHA256 48728703993e8a12f561978243a41a13a2ff8d0018c7fe342bf39efc596a9866
MD5 f0942bf7c34814e33dcb0b7444d86bfa
BLAKE2b-256 8744bb4cf1b219ebdceb307dd582716ceceeabaa4a5c5b9aece43458b96c4a0a

See more details on using hashes here.

File details

Details for the file shournal_to_snakemake-0.1-py3-none-any.whl.

File metadata

  • Download URL: shournal_to_snakemake-0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for shournal_to_snakemake-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20a8e02c4a361e9214005edc9b9f5d4c9dfbac97cfe3321f051af4fd44f24d57
MD5 8298fb30118b630689bd9cd9af6ceb80
BLAKE2b-256 d8fab3312804d7786dcec70499ff9ad64598a05fd7670e8c04bf6199dbde9609

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page