- Julia 74.8%
- Shell 25.2%
| bzip-sam.jl | ||
| bzip-sam.sh | ||
| fq2bam.jl | ||
| fq2bam.sh | ||
| gzip-all.sh | ||
| nfclean.jl | ||
| README.md | ||
| sra-download-status.jl | ||
| sra-download.jl | ||
| sra-download.sh | ||
| xzconvert | ||
| xzconvert.jl | ||
SLURM scripts
Paired bash/julia scripts for running sbatch commands.
Typically, bash script will take the form of
an sbatch array, where the array number
indexes a list (from ls on a directory or a txt file), that number will be passed to a julia script that reads the list and pulls the file.
Sbatch options
Header options
#!/bin/bash -l
#SBATCH --time=00-04:00:00 #requested time (DD-HH:MM:SS)
#SBATCH -p batch,preempt #running on "batch" or "preempt" partition, wherever resource is available first
#SBATCH -N 1 #1 nodes #for many shared-memory programs,please leave -N as 1.
#SBATCH -c 12 # c for cpu, n is for MPI style jobs
#SBATCH --mem=32g # RAM total for the number of cpus requested
#SBATCH --output %A_%a.out # %A is array ID %a is task index -- stdout and stderr to same file
#SBATCH --mail-type=END,FAIL,TIME_LIMIT_90 #email options
#SBATCH --mail-user=kbonha01@tufts.edu
Running
Using Shell variables to capture variation can be useful.
Eg for xzconvert, I had 4 different batches/directories.
I ran with RUN=2; sbatch... to do the 2nd batch.
Pre-generating file lists for inputs is also useful.
Results from fd include full paths, so eg fd -e .fastq.gz . batch1/ > batch1.txt
will give a file list.
include the run number as a variable passed to julia script, eg
# headers...
julia xzconvert.jl "$1" "$SLURM_ARRAY_TASK_ID"
Here, the $1 is the first argument passed to the script in the sbatch call,
and $SLURM_ARRAY_TASK_ID comes from the array argument,
eg
RUN=2; sbatch --array=1-$(wc -l < "run$RUN.txt") ./xzconvert "$RUN"
means that --array will make a separate job for 1 to the number of files
in run2.txt**, and "2" will be passed as the $1 inside the bash script.
If the julia script starts with
i_run = ARGS[1]
i_file = parse(Int,ARGS[2])
Then i_run here will be 2 and i_file will be the array task number.
Then
allfiles = readlines("run$(i_run).txt")
oldfile = allfiles[i_file]
will read the text file and select the index associates with the task ID.
**NOTE: the HPC has an upper limit (2000) on total number of array tasks, and on the number of simultaneous jobs (1000). Be sure to split up batches or use offsets appropriately. See here for more details.
Use %N at the end of the array specification to limit the number
of simultaneous jobs submitted. Eg --array=1-100%20 will sumbit 100 jobs,
but only 20 at a time.