python-snakemake-skeleton
python-snakemake-skeleton copied to clipboard
A skeleton repository for Snakemake pipepline(s) and a python command-line toolkit.
trafficstars
A skeleton repository for Snakemake pipepline(s) and a python command-line toolkit.
Why this repo?
This the starting point for Fulcrum Genomics projects that contain Snakemake pipelines and a python toolkit.
This repo contains the following, in no particular order:
- a hello world snakefile in
src/snakemake/hello_world.smk- this uses the
onerrordirective to better display rule errors, in particular the last file lines of the rule's log
- this uses the
- a python toolkit (
clien-tools) insrc/python/pyclient- uses
defoptfor arg parsing - has custom logging in
core/logging.py - has utility methods to support the above
onerrorsnakemake directive inpipeline/snakemake_utils.py - has a unit test to ensure the above snakefile is runnable and generally executes the expected rules in
tests/test_hello_world.py. This also includes a utility method to support running and verifying snakemake intests/util.py - supports multiple sub-commands in
tools/__main__.pywith some nice logging when a tool fails - a little hello world tool in
tools/hello_world.py
- uses
Modifying this repo for a new client
This repo is a skeleton for Snakemake pipelines and a Python toolkit.
- [ ] Modify
setup.py - [ ] update
conda-requirements-minimal.txtwith minimal requirements for theclient-toolstoolkit - [ ] update
conda-requirements-test.txtwith minimal requirements for theclient-toolsunit testing - [ ] update
pip-requirements.txtwith minimal requirements for theclient-tools(prefer conda) - [ ] update
src/python/pyclientsource code (search for terms:PYCLIENT,pyclient,client-tools
Install client-tools
-
Create the
pyclientconda environment
mamba create -n pyclient \
--override-channels -y \
-c bioconda -c conda-forge -c defaults \
--file conda-requirements-minimal.txt \
--file conda-requirements-test.txt
- Activate the
pyclientconda environment
conda activate pyclient
- Install all non-conda dependencies via pip
pip install -r pip-requirements.txt
- Install
pyclient(in developer mode)
python setup.py develop
- Validate the install via the help message
client-tools -h
- Validate the snakemake install
snakemake --snakefile src/snakemake/hello_world.smk -j 1