Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snakemake Debugging on Google Cloud
# This is a small script (that typically I copy paste) on a Google Cloud instance
# to set up an environment to mimic a worker. It includes installing snakemake,
# retrieving a package with the working directory (which typically has the
# version of snakemake I aim to develop or debug, and then interactively debugging
# or doing this.
sudo apt-get install -y wget bzip2 ca-certificates gnupg2 git
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sudo chown -R $USER /opt
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda
export PATH=$PATH:/opt/conda/bin
conda install -y -c conda-forge mamba
mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
conda clean --all -y
source activate snakemake
mkdir -p /workdir
sudo chown -R $USER /workdir
cd /workdir
wget -O gls.py https://raw.githubusercontent.com/snakemake/snakemake/master/snakemake/executors/google_lifesciences_helper.py
chmod +x gls.py
# This command needs to be updated with your download archive, there should be an install of snakemake inside
python gls.py download snakemake-testing source/cache/workdir-09bda6e42f79362fe639d893de13495a84c2e2884961a9d828f9f865f33347f5.tar.gz /tmp/workdir.tar.gz
tar -xzvf /tmp/workdir.tar.gz
# Use -e to ensure we install from local directory
pip install -e .[reports,messaging,google-cloud]
pip install ipython
echo "source activate snakemake" > ~/.bashrc
export PATH=/opt/conda/envs/snakemake/bin:${PATH}
# Your custom command will go here, add ipython / other interaction
# into codebase before running!
snakemake snakemake-testing/dirtest/testdir --snakefile Snakefile --force -j --keep-target-files --keep-remote --latency-wait 5 --scheduler greedy --attempt 1 --force-use-threads --max-inventory-time 0 --allowed-rules directory --nocolor --notemp --no-hooks --nolock --default-remote-provider GS --default-remote-prefix snakemake-testing/dirtest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment