-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAIsim_NeutralInversion.py
52 lines (41 loc) · 1.51 KB
/
SAIsim_NeutralInversion.py
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
# Script created for running with Condor, to take in effect magnitudes and model the change in frequency
# of multiple variably linked alleles in an otherwise undifferentiable background
import sys
import SAIsim as sim
import numpy as np
invMutPower = float(sys.argv[1])
replicateNum = int(sys.argv[2])
size = 1000
numGens = 20000
# numGens = 100
recordEveryN = 10
# For generating a SAIsim population object
# Relies on some parameter defaults in SAIpop ()
def genInvMutPop(invMutPower,size):
# Parameters as described in general de novo simulator script, most parameters will not be used
mutRate = .1
mutRateInv = np.power(10,invMutPower)
mutEffectDiffSD = .2
minInvLen = .1
conversionRate = 10.0**-2.0
recombRate = 1
encounterNum = 100 #USED
# encounterNum = 20 #USED
choiceNoiseSD = .5 #USED
invRecBuffer = .1
# Generate the population
pop = sim.SAIpop(size, mutRate, mutRateInv, mutEffectDiffSD, minInvLen, conversionRate, recombRate,\
encounterNum, choiceNoiseSD, invRecBuffer, willMutate = False, willMutInv = True,\
willConvert = False)
return pop
# Run the Simulation
pop = genInvMutPop(invMutPower,size)
pop.recordNthInNGens(recordEveryN,numGens)
# pop.recordNthInNStopWhenFixed(recordEveryN,numGens)
# Record Relevant Output
invMutStr = repr(invMutPower)+'0'*(4-len(repr(invMutPower)))
repNumStr = '0'*(3-len(str(replicateNum)))+str(replicateNum)
invFileName = 'iMP'+invMutStr+'n'+repNumStr
pop.writeInvCharTable(invFileName+'Char.txt')
pop.writeAllInvFreqTable(invFileName+'Count.txt')
# pop.printGenomes()