Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save marcusrussi/25fb5e915689883e198af56769bf5868 to your computer and use it in GitHub Desktop.

Select an option

Save marcusrussi/25fb5e915689883e198af56769bf5868 to your computer and use it in GitHub Desktop.
Install Nextflow on Harvard cluster and do a test run
cd ~
# Get an interactive session. --mem is important otherwise
# you will probably get "OOM-killed" later on
srun --pty -p test --mem=4G --time=120 bash
# Load Java and Conda
module load jdk/1.8.0_172-fasrc01 # This MIGHT not be neccessary, but doesn't hurt..
module load Anaconda3/2019.10
# Add the Bioconda "channels" (~= repositories) to your Conda
# setup. Nextflow is available in Bioconda.
conda config --add channels bioconda
conda config --add channels conda-forge
# Install Nextflow into a Conda environment named "covidestim"
conda create -n covidestim nextflow awscli
# After agreeing to the proposed list of packages to install, wait
# like 10-20 minutes for all the deps to install
# ...
# Initialize your shell to work with Conda
conda init bash
# IMPORTANT: close and re-open your shell. Hit Ctrl-D, then:
srun --pty -p test --mem=4G bash
# Activate the "covidestim" Conda environment
conda activate covidestim
# Verify Nextflow works
nextflow run hello
# After a few seconds, you should get the following output:
# N E X T F L O W ~ version 21.04.0
# Pulling nextflow-io/hello ...
# downloaded from https://github.com/nextflow-io/hello.git
# Launching `nextflow-io/hello` [big_khorana] - revision: e6d9427e5b [master]
# executor > local (4)
# [cd/ea5bd4] process > sayHello (3) [100%] 4 of 4 ✔
# Ciao world!
#
# Bonjour world!
#
# Hola world!
#
# Hello world!
############################################
## Performing an example covidestim run ##
############################################
# Use Ctrl-D to get back to a login node (right now you are
# probably on the interactive partition, which might cause
# job submission issues)
# cd to the high-speed filesystem (/n/holyscratch01)
cd /n/holyscratch01/menzies_lab/Everyone
# make a unique directory to store the run's files
mkdir mwr_covidestim_test01 && cd mwr_covidestim_test01
# Paste the following into a file `runscript.sh` using Vim/etc:
#!/usr/bin/bash
module load Anaconda3/2019.10
conda activate covidestim
# -Run the `master` branch of `dailyFlow`
# -Don't publish to AWS S3
# -Run the HEAD commit of the `master` branch
# -27 processes for the 52 states (+DC,PR)
# -Never use the sampler
# -Run using Slurm and Singularity
# -Use the `master` branch of `covidestim`
# -Run states
# -Results to `results/`
# -Today's date
nextflow run covidestim/dailyFlow \
-r "master" \
--s3pub false \
-latest \
--ngroups 27 \
--alwaysoptimize \
-profile "slurm,states" \
--branch master \
--key state \
--outdir results \
--date "$(date '+%Y-%m-%d')"
#### END FILE! ####
# Run the script for a few hours on the shared partition
sbatch -p shared --time=240 --mem=8G runscript.sh
# Results will eventually be in the `results/` folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment