-
Notifications
You must be signed in to change notification settings - Fork 0
/
cand_gene.sh
40 lines (29 loc) · 941 Bytes
/
cand_gene.sh
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
#!/bin/bash
# Loop over QTL and perform candidate gene analysis
while getopts "m:" OPTION
do
case "$OPTION" in
m) mode=$OPTARG
esac
done
if [ -z "$mode" ]; then mode="bash"; fi # default mode is bash
if [ "$mode" != "bash" ] && [ "$mode" != "slurm" ]; then
echo "ERROR: -m flag must be set to \"bash\" or \"slurm\""
exit
fi
mkdir -p results
mkdir -p results/summary
mkdir -p results/vardata
mkdir -p logs
qtls=("Qpa1" "Qpa2" "Qpa3" "Qpa4" "Qpa5" "Qpa6" "Qpa7" "Qpa8")
for qtl in ${qtls[@]}; do
vcf=$(find VCFs -name "$qtl*" | tr "\n" ",")
if [ $mode == "slurm" ]; then
logfile="logs/${qtl}.out"
sbatch --mem=10G -t 4:00:00 --output=${logfile} --wrap="module add r; Rscript cand_gene_analysis.R --args --vcf=${vcf} --prefix=${qtl}"
fi
if [ $mode == "bash" ]; then
logfile="logs/${qtl}.log"
nohup Rscript cand_gene_analysis.R --args --vcf=${vcf} --prefix=${qtl} > ${logfile} 2>&1 < /dev/null &
fi
done