I have followed the Snakemake best practices here to create a workflow, where different steps activate different Conda environments. For example, a rule that collects statistics:
rule per_samp_stats:
input:
ref_path='/labs/jandr/walter/tb/data/refs/{ref}.fa',
bam='results/{batch}/{samp}/bams/{samp}_{mapper}_{ref}_sorted.bam'
log:
'results/{batch}/{samp}/stats/{samp}_{mapper}_{ref}_cov_stats.log'
conda: 'envs/picard.yaml'
params:
prefix='results/{batch}/{samp}/stats/{samp}'
shell:
'''
{config[scripts_dir]}cov_stats.sh {input.ref_path}
'''
I am running into the error:
# CreateCondaEnvironmentException:
# Could not create conda environment from /oak/stanford/scg/lab_xx/xx/tb/mtb_tgen/workflow/envs/mtb.yaml:
# Command:
# mamba env create --quiet --file "/oak/stanford/scg/lab_xx/xx/tb/mtb_tgen/.snakemake/conda/5b3e765eb8210c23d169553fd7853814.yaml" --prefix "/oak/stanford/scg/lab_xx/xx/tb/mtb_tgen/.snakemake/conda/5b3e765eb8210c23d169553fd7853814"
# Output:
# Preparing transaction: ...working... done
# Verifying transaction: ...working... failed
#
# PaddingError: Placeholder of length '80' too short in package /oak/stanford/scg/lab_xx/xx/tb/mtb_tgen/.snakemake/conda/5b3e765eb8210c23d169553fd7853814/bin/Rscript.
# The package must be rebuilt with conda-build > 2.0.
I'm wondering if you have suggestions how to deal with this; the problem seems to occur because of the long full path to the location where Snakemake rebuilds the environment to run a specific rule. Any help would be fantastic. Thank you!