Skip to content

Instantly share code, notes, and snippets.

@philippbayer
Last active March 23, 2023 09:47
Show Gist options
  • Save philippbayer/3ed991c27dffda6bb8619f3e235d03fa to your computer and use it in GitHub Desktop.
Save philippbayer/3ed991c27dffda6bb8619f3e235d03fa to your computer and use it in GitHub Desktop.
#!/bin/bash -l
# SLURM directives
#
# This is an array job with four subtasks
#SBATCH --job-name=align
#SBATCH --time=12:00:00
#SBATCH --cpus-per-task=1
#SBATCH --partition=work
#SBATCH --mem=50G
#SBATCH --output=named_array-%j.log
#SBATCH --array=0-3
#SBATCH --error=err-%j.log
# Generic SLURM commands
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --clusters=setonix
#SBATCH --account=pawsey0390
#SBATCH --mail-type=ALL
#SBATCH --export=NONE
#Do not edit the echo sections
echo "All jobs in this array have:"
echo "- SLURM_ARRAY_JOB_ID=${SLURM_ARRAY_JOB_ID}"
echo "- SLURM_ARRAY_TASK_COUNT=${SLURM_ARRAY_TASK_COUNT}"
echo "- SLURM_ARRAY_TASK_MIN=${SLURM_ARRAY_TASK_MIN}"
echo "- SLURM_ARRAY_TASK_MAX=${SLURM_ARRAY_TASK_MAX}"
echo "This job in the array has:"
echo "- SLURM_JOB_ID=${SLURM_JOB_ID}"
echo "- SLURM_ARRAY_TASK_ID=${SLURM_ARRAY_TASK_ID}"
# alter the following line to suit your files. It will grab all files matching whatever regular expression you provide.
FILES=($(\ls *1.fq.gz))
# grabs our filename from a directory listing
FILENAME=${FILES[$SLURM_ARRAY_TASK_ID]}
SECOND=${FILENAME/1.fq/2.fq}
echo "My input file is ${FILENAME}"
conda activate hisat
srun hisat2 -x P_australis_genome_bigger1kbp.fasta -1 ${FILENAME} -2 ${SECOND} -p 64 -S ${FILENAME}.sam 2> ${FILENAME}_err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment