WayScience / CytoSnake

Orchestrating high-dimensional cell morphology data processing pipelines
https://cytosnake.readthedocs.io
Creative Commons Attribution 4.0 International
3 stars 3 forks source link

Make `mamba` as Snakeamke's default environment manager #34

Closed axiomcura closed 1 year ago

axiomcura commented 1 year ago

issue

One of the common issues of using conda as environment manger is that it takes a considerable amount of time to create an environment.

It seems that the snakemake developers favors mamba as their environment manager.

potential approach

Since we have base configuration file, users can either select mamba or conda as their environment manger. It will look something like this.

# in configuration.yaml
env_mamanger: mamba

we can use snakemake's api to overwrite the default configs when executing a workflow by using the config parameter. According to the documentation:

config (dict) – override values for workflow config

Therefore we can implement something like this:

import yaml
import snakemake 

# load base configs
config_file = "configuration.yaml"
with open(config_file, 'r') as f:
    configs = yaml.safe_load(f)

# create dictioanry to overwrite default settings
custom_configs = { "conda_create_call" : configs[env_manager]}

# executing workflow 
snakemake.snakemake("workflow.smk", cores=3, config=custom_configs}

The implementation above ensures that your complete workflow is now using mamba to generate environments instead of conda

NOTE: This idea is subject to change!

axiomcura commented 1 year ago

This has been added in #45