Skip to content

Commit

Permalink
Add SLURM cluster stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
colinbrislawn committed Aug 4, 2023
1 parent d0a6be0 commit 48208ee
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ snakemake --cores 8 --use-conda --resources mem_mb=10000

This takes about 15 hours on my machine

<details>
<summary>Run on a slurm cluster:</summary>

More specifically, The University of Florida HiPerGator supercomputer,
with access generously provided by the [Kawahara Lab](https://www.floridamuseum.ufl.edu/kawahara-lab/)!

```bash
screen # We connect to a random login node, so we may not be able...
screen -r # to reconnect with this later on.

snakemake --jobs 12 --slurm \
--use-envmodules --rerun-incomplete --latency-wait 10 \
--default-resources slurm_account=kawahara slurm_partition=hpg-milan

```

</details>

Reports:

```bash
Expand Down
4 changes: 3 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ q2v: "2023.5"
# Get full file from from https://github.com/qiime2/environment-files
# Or specify name of already installed Qiime2 environment
q2env: "qiime2-2023.5"
# Or load a pre-installed module
q2mod: "qiime2/2023.5"

# UNITE Major version listed in file names
version: "ver9"
# UNITE Publication version listed in the file names
date: "29.11.2022"
date: "25.07.2023"

# UNITE Precluster percentage
cluster:
Expand Down
17 changes: 12 additions & 5 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ from snakemake.io import glob_wildcards, expand

configfile: "config/config.yaml"

# Prevents the 'download' rule from running on worker nodes
localrules: all, download

# load and set conda envs and modules from the config
Q2CONDA = config["q2env"]
Q2MOD = config["q2mod"]

GOALS = expand("results/unite_{ver}_{id}_{type}{date}-Q2-{q2v}.qza",
ver=config["version"],
id=config["cluster"],
Expand All @@ -15,7 +22,6 @@ GOALS = expand("results/unite_{ver}_{id}_{type}{date}-Q2-{q2v}.qza",
q2v=config["q2v"]
)
# print(GOALS)
Q2CONDA = config["q2env"]

rule all:
input:
Expand All @@ -29,11 +35,8 @@ checkpoint download: # This is not proper snakemake. I can't get my tuples to wo
#tax=temp("downloads/sh_taxonomy_qiime_{ver}_{id}_{type}{date}_dev.txt")
# Note the messy wildcards in rule.reformat_seqs and rule.import_tax this requires
dir=directory("downloads/")
# conda: # TODO: troubleshoot this and pin wget and tar versions
# "envs/unix.yaml"
log: "logs/downloads.log"
conda: "envs/unix-tools.yaml"
threads: 1000
shell:
"""
mkdir -p downloads
Expand Down Expand Up @@ -74,6 +77,7 @@ rule import_seqs:
output: temp("results/sh_refs_qiime_{ver}_{id}_{type}{date}_dev.qza")
log: "logs/import_seqs_{ver}_{id}_{type}{date}.log"
conda: Q2CONDA
envmodules: Q2MOD
shell: "qiime tools import --type FeatureData[Sequence] \
--input-path {input} \
--output-path {output}"
Expand All @@ -83,6 +87,7 @@ rule import_tax:
output:temp("results/sh_taxa_qiime_{ver}_{id}_{type}{date}_dev.qza")
log: "logs/import_taxa_{ver}_{id}_{type}{date}.log"
conda: Q2CONDA
envmodules: Q2MOD
shell: "qiime tools import --type FeatureData[Taxonomy] \
--input-format HeaderlessTSVTaxonomyFormat \
--input-path {input}/sh_taxonomy_qiime_{wildcards.ver}_{wildcards.id}_{wildcards.type}{wildcards.date}_dev.txt \
Expand All @@ -95,9 +100,11 @@ rule train:
output: protected("results/unite_{ver}_{id}_{type}{date}-Q2-{q2v}.qza")
log: "logs/train_{ver}_{id}_{type}{date}-Q2-{q2v}.log"
conda: Q2CONDA
envmodules: Q2MOD
benchmark: "logs/train_{ver}_{id}_{type}{date}-Q2-{q2v}.tsv"
resources:
mem_mb=9000
mem_mb=300*1000, # slurm wants plenty of memory
runtime="90h" # hopefully not
shell: "qiime feature-classifier fit-classifier-naive-bayes \
--p-classify--chunk-size 10000 \
--i-reference-reads {input.ref} \
Expand Down

0 comments on commit 48208ee

Please sign in to comment.