rhysnewell / aviary

A hybrid assembly and MAG recovery pipeline (and more!)
GNU General Public License v3.0
81 stars 12 forks source link

--use-conda versus --conda-frontend #180

Closed bglindner closed 10 months ago

bglindner commented 10 months ago

Hey bird enthusiasts,

Long time listener, first time caller; thanks for the great tool!

The help text for aviary suggests that the default for --conda-frontend is mamba but when examining recent run logs, it looks like --use-conda is passed directly to snakemake. Were I to explicitly pass mamba as the conda frontend would this conflict? Sorry if this is a silly question -- I'm not a snakemake user except by proxy in this instance.

Cheers,

Blake

rhysnewell commented 10 months ago

Hi Blake,

I think this just comes down to snakemake having some confusingly named parameters, but I understand why they are named the way they are. Looking at the snakemake docs on conda usage:

CONDA:
  --use-conda           If defined in the rule, run job in a conda environment. If this flag is not set, the conda directive is ignored. (default: False)
  --conda-not-block-search-path-envvars
                        Do not block environment variables that modify the search path (R_LIBS, PYTHONPATH, PERL5LIB, PERLLIB) when using conda environments. (default: False)
  --list-conda-envs     List all conda environments and their location on disk. (default: False)
  --conda-prefix DIR    Specify a directory in which the 'conda' and 'conda-archive' directories are created. These are used to store conda environments and their archives, respectively. If not supplied, the value is set to
                        the '.snakemake' directory relative to the invocation directory. If supplied, the `--use-conda` flag must also be set. The value may be given as a relative path, which will be extrapolated to the
                        invocation directory, or as an absolute path. The value can also be provided via the environment variable $SNAKEMAKE_CONDA_PREFIX. (default: None)
  --conda-cleanup-envs  Cleanup unused conda environments. (default: False)
  --conda-cleanup-pkgs [{tarballs,cache}]
                        Cleanup conda packages after creating environments. In case of 'tarballs' mode, will clean up all downloaded package tarballs. In case of 'cache' mode, will additionally clean up unused package
                        caches. If mode is omitted, will default to only cleaning up the tarballs. (default: None)
  --conda-create-envs-only
                        If specified, only creates the job-specific conda environments then exits. The `--use-conda` flag must also be set. (default: False)
  --conda-frontend {conda,mamba}
                        Choose the conda frontend for installing environments. Mamba is much faster and highly recommended. (default: mamba)

The --use-conda flag is just used to indicate to snakemake that we would like to use the conda environments when running rules we have setup in aviary. The --conda-frontend parameter then decides which type of conda installer to use, the default in snakemake has been set to mamba automatically which is cool.

So in aviary, we pass both --use-conda to activate the use of conda and --conda-frontend (kind of superfluously, now) to indicate the usage of mamba

Cheers, Rhys