https://github.com/jjjermiah/snakemake-pixi-template
A basic template to get started with Snakemake using Pixi
https://github.com/jjjermiah/snakemake-pixi-template
pixi snakemake
Last synced: 3 months ago
JSON representation
A basic template to get started with Snakemake using Pixi
- Host: GitHub
- URL: https://github.com/jjjermiah/snakemake-pixi-template
- Owner: jjjermiah
- License: mit
- Created: 2024-04-04T21:04:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-11T19:46:14.000Z (over 1 year ago)
- Last Synced: 2025-06-09T14:53:51.700Z (4 months ago)
- Topics: pixi, snakemake
- Language: Python
- Homepage:
- Size: 158 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snakemake-pixi-template
This is a template repository for snakemake workflow with pixi as a package manager.
It is based on the [pixi](https://prefix.dev/blog/pixi_a_fast_conda_alternative).## Idea
Traditionally, I would use Conda to create my environments and manage my packages.
However the added step of making sure my environment.yml file is up to date is a bit of a hassle.```bash
conda env create -f environment.yml -n snakemake
conda activate snakemake
```Instead, I can use pixi to manage my packages and create a `pixi.lock` file that will be used to create the environment.
```bash
pixi install
```This makes sure that the lock is synchronized and version controlled.
## Usage
To add packages to the `default` environment:
```bash
pixi add pandas
```### To run a command in the environment
```bash
pixi run snakemake --dryrun
```### Enter into the environment
```bash
pixi shell# Exit the environment using "exit"
```### Pixi Tasks
Pixi also allows defining tasks for common tasks. This is done in the [pyproject.toml](pyproject.toml) file.```toml
[tool.pixi.tasks]
dryrun = "snakemake --dry-run"
snake = "snakemake --cores 1"
```This allows me to run `pixi run dryrun` to see what snakemake would do and `pixi run snake` to run snakemake.
A common task I like to do is creating the dags regularly and including them in my README.
This can then be automated with the task.```toml
dag = "snakemake -F --dag | dot -Tsvg > resources/dag.svg"
rulegraph = "snakemake -F --rulegraph | dot -Tsvg > resources/rulegraph.svg"
filegraph = "snakemake -F --filegraph | dot -Tsvg > resources/filegraph.svg"
graphs = { depends_on = ["dag", "rulegraph", "filegraph"] }
```Running `pixi run graphs` will create the three graphs and save them in the resources folder.
This way, they are automatically updated below in this README.#### DAG

#### Rulegraph

#### Filegraph
