https://github.com/snakemake/shournal-to-snakemake
https://github.com/snakemake/shournal-to-snakemake
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/snakemake/shournal-to-snakemake
- Owner: snakemake
- License: mit
- Created: 2020-04-11T19:49:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-24T21:11:38.000Z (about 6 years ago)
- Last Synced: 2025-04-17T12:29:35.000Z (about 1 year ago)
- Language: Python
- Size: 17.6 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# shournal-to-snakemake
Transform a command series observed by
[shournal](https://github.com/tycho-kirchner/shournal)
to
[snakemake](https://github.com/snakemake/snakemake)
rules.
[shournal](https://github.com/tycho-kirchner/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](https://github.com/tycho-kirchner/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
### 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)