forked from MaselLab/MutationLoad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_local.sh
122 lines (103 loc) · 2.97 KB
/
bash_local.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
#!/bin/bash
#SBATCH --job-name-MutationLoad
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --mem=1gb
#SBATCH --time=00:01:00
#SBATCH --partition=standard
#SBATCH --account=masel
pwd; hostname; date
module load gsl/2.6
#Mutationload variables
timeSteps=50000
initialPopsize=2000
mud=4.0
chromosomesize=50
numberofchromosomes=23
bentodelrateratio=0.25
sb=0.5
#0 for point; 1 for exponential; and 2 for uniform
bendist=0
#0 for root; 1 for single
typeofrun=1
slope=0
seed=57
K=20000
#0 for relative; 1 for absolute
fitnesstype=0
r=0.98
i_init=400
s=0.01
tskit=0
#0 for runs without modular epistasis; 1 for runs with modular epistasis
modularepis=0
elementsperl=0
#This ratio should be between 1 and 10
SdtoSbratio=1
Sbname="1.0000"
#0 for point; 1 for exponential
deldist=0
rawfilesize=10000
redinK=0
fixcalc=0
if [ $fitnesstype -eq 0 ]
then
fitnessstring="relative_"
elif [ $fitnesstype -eq 1 ]
then
fitnessstring="absolute_"
fi
if [ $tskit -eq 0 ]
then
tskitstring="OFF_"
elif [ $tskit -eq 1 ]
then
tskitstring="ON_"
fi
if [ $bendist -eq 0 ]
then
bendiststring="point_"
elif [ $bendist -eq 1 ]
then
bendiststring="exponential_"
elif [ $bendist -eq 2 ]
then
bendiststring="uniform_"
fi
if [ $deldist -eq 0 ]
then
deldiststring="point_"
elif [ $deldist -eq 1 ]
then
deldiststring="exponential_"
fi
#mub is written as a formated double in mutation load program
mub=$(echo "$mud * $bentodelrateratio" | 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"tskit_"$tskitstring"r_"$r"_iinit_"$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"tskit_"$tskitstring"elementsperlb_"$elementsperl"_r_"$r"_iinit_"$i_init"_s_"$s"_K_"$K"_deldist_"$deldiststring"bendist_"$bendiststring"mub_"$mub"_chromnum_"$numberofchromosomes"_N0_"$initialPopsize"_mud_"$mud"_L_"$chromosomesize"_seed_"$seed"/"
fi
file1='popsnapshotfor_Sb_'$Sbname'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"
./mutationload $timeSteps $initialPopsize $mud $chromosomesize $numberofchromosomes $bentodelrateratio $sb $bendist $typeofrun $slope $seed $K $fitnesstype $r $i_init $s $tskit $modularepis $elementsperl $snapshot $file1 $SdtoSbratio $deldist $rawfilesize $redinK $fixcalc
#$snapshot $directory$file1
echo $directory$file1
echo $SECONDS
echo "end of mutationload program"
gzip $directory$file1