-
Notifications
You must be signed in to change notification settings - Fork 0
/
rufus_docker_nonarray.slrm
executable file
·60 lines (50 loc) · 2.09 KB
/
rufus_docker_nonarray.slrm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#$ -cwd
#$ -S /bin/bash
#SBATCH --error=/scratch.global/neis/bakeoff/logs/%x_%j.e
#SBATCH --output=/scratch.global/neis/bakeoff/logs/%x_%j.o
#SBATCH --mail-type=FAIL
#SBATCH [email protected]
#SBATCH --time=24:00:00
#SBATCH -n 40
#SBATCH -N 1
#SBATCH --mem 64G
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
SECONDS=0
refDir=/home/pankrat2/public/resources/GATK4/
cramDir=/scratch.global/neis/bakeoff/${GROUP}/cram/
rufusRefDir=/home/pankrat2/public/resources/RUFUS/
outDir=/scratch.global/neis/bakeoff/${GROUP}/
if [[ $EXCLUSION == "1000G_SNP" ]]; then
EXCLUSION=${rufusRefDir}1000G.snp.RUFUSreference.min45.Jhash
BASE="1000G_SNP/"
else
EXCLUSION=${rufusRefDir}1000G.RUFUSreference.min45.Jhash
fi
echo "Running RUFUS for group ${GROUP} with exclusion file: ${EXCLUSION}. Remaining samples: ${REMAINING_SAMPLES}"
SAMPLE_NUM=${RANK}
while [ ${SAMPLE_NUM} -le ${REMAINING_SAMPLES} ]; do
SAMPLE=$(sed -n "${SAMPLE_NUM}p" /scratch.global/neis/bakeoff/${GROUP}/samples.txt)
if [[ -z $(find ${BASE}${GROUP}/ -name "${SAMPLE}*FINAL.vcf.gz.tbi") && -n $(find ${GROUP}/cram/ -name "${SAMPLE}.recab.cram") ]]; then
echo "Sample ${SAMPLE} does not have vcf index file. Running RUFUS on sample ${SAMPLE}"
outDir=/scratch.global/neis/bakeoff/${BASE}${GROUP}/${SAMPLE}
mkdir -p $outDir
break
else
SAMPLE_NUM=$((SAMPLE_NUM + BATCHSIZE))
fi
done
echo "Running RUFUS on sample ${SAMPLE} starting at $(date)"
singularity run --pwd "$outDir" \
--bind "$refDir" \
--bind "$cramDir" \
--bind "$rufusRefDir" \
--bind "$outDir" \
"docker://ghcr.io/pankratzlab/rufus:master" \
/RUFUS/runRufus.sh -vs -s ${cramDir}${SAMPLE}.recab.cram -cr ${refDir}GRCh38_full_analysis_set_plus_decoy_hla.fa -e ${EXCLUSION} -k 25 -t 40 -r ${refDir}GRCh38_full_analysis_set_plus_decoy_hla.fa
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
echo $ELAPSED