-
Notifications
You must be signed in to change notification settings - Fork 6
/
bash_hpc_array_bigN.sh
132 lines (111 loc) · 3.45 KB
/
bash_hpc_array_bigN.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
#SBATCH --output=job%A_%a.out
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --time=220:00:00
#SBATCH --partition=standard
#SBATCH --account=masel
#SBATCH --array=0-12
arrayuds=(0.1 0.5 1 2 3 4 5 6 7 8 9 10)
#Mutationload variables
timeSteps=100000
initialPopsize=2000
mud=${arrayuds[$SLURM_ARRAY_TASK_ID]}
chromosomesize=200
numberofchromosomes=23
bentodelratio=0
sb=1
#0 for point; 1 for exponential; and 2 for uniform
bendist=1
#0 for root sb; 1 for single; 2 for root Ncrit
typeofrun=1
slope=0
seed=24
K=20000
#0 for relative; 1 for absolute
fitnesstype=0
r=0.98
i_init=400
s=0.01
#0 for runs without modular epistasis; 1 for runs with modular epistasis
modularepis=0
elementsperl=0
#0 for no tskit; 1 for tskit on; 2 for tskit on after burnin
tskitstatus=2
SdtoSbratio=0.029
#0 for Kim et al., 1 for exponential, 2 for point
deldist=1
#rawdata file size in datapoints
rawdatafilesize=10
#change in carrying capacity, type in the difference in popsize
redinmaxpopsize=0
#status of fixation calculation; 0 for OFF; 1 for ON
calcfixation=0
if [ $fitnesstype -eq 0 ]
then
fitnessstring="relative_"
elif [ $fitnesstype -eq 1 ]
then
fitnessstring="absolute_"
fi
if [ $bendist -eq 0 ]
then
bendiststring="point_"
elif [ $bendist -eq 1 ]
then
bendiststring="exponential_"
elif [ $bendist -eq 2 ]
then
bendiststring="uniform_"
fi
if [ $tskitstatus -eq 0 ]
then
tskitstatusstring="OFF_"
elif [ $tskitstatus -eq 1 ]
then
tskitstatusstring="ON_"
elif [ $tskitstatus -eq 2 ]
then
tskitstatusstring="ON_AFTER_BURNIN_"
fi
if [ $deldist -eq 0 ]
then
deldiststring="kim_"
elif [ $deldist -eq 1 ]
then
deldiststring="exponential_"
elif [ $deldist -eq 2]
then
deldiststring="point_"
fi
#mub is written as a formated double in mutation load program
mub=$(echo "$mud * $bentodelratio" | bc -l)
mub=$(printf "%.4f" $mub)
#creates 2 strings; directory refers to the folder where data for the specified parameters will be stored; file is the snapshot of the simulation at its end.
if [ $modularepis -eq 0 ]
then
directory="datafor_"$fitnessstring"tskitstatus_"$tskitstring"r_"$r"_i_init"$i_init"_s_"$s"_K_"$K"_deldist_"$deldiststring"bendist_"$bendiststring"_mub_"$mub"_chromnum_"$numberofchromosomes"_N0_"$initialPopsize"_mud_"$mud"_L_"$chromosomesize"seed_"$seed"/"
elif [ $modularepis -eq 1 ]
then
directory="datafor_"$fitnessstring"tskitstatus_"$tskitstring"elementsperlb_"$elementsperl"_r_"$r"_i_init"$i_init"_s_"$s"_K_"$K"_deldist_"$deldiststring"_bendist_"$bendiststring"_mub_"$mub"_chromnum_"$numberofchromosomes"_N0_"$initialPopsize"_mud_"$mud"_L_"$chromosomesize"seed_"$seed"/"
fi
printf "directory path is %s \n" "$directory"
file1="popsnapshotfor_popsize_"$initialPopsize"_tskitstatus_"$tskitstatusstring"mub_"$mub".txt"
#checks if a previous snapshot of the simulation exist. Snapshots are saved as compressed files (.gz) to save space
prevsim=$([ -f $directory$file1".gz" ] && echo 1 || echo 0)
if [ $prevsim -eq 0 ]
then
snapshot=0
elif [ $prevsim -eq 1 ]
then
gzip -d $directory$file1".gz"
snapshot=1
fi
SECONDS=0
echo "start of mutationload program"
# run mutationload program with arguments
./mutationload $timeSteps $initialPopsize $mud $chromosomesize $numberofchromosomes $bentodelratio $sb $bendist $typeofrun $slope $seed $K $fitnesstype $r $i_init $s $tskitstatus $modularepis $elementsperl $snapshot $file1 $SdtoSbratio $deldist $rawdatafilesize $redinmaxpopsize $calcfixation
echo $SECONDS
echo "end of mutationload program"
#$snapshot $directory$file1
gzip $directory$file1