Commit 756a44aa authored by Carlos GO's avatar Carlos GO
Browse files

increasing energy

parent dd187c0f
......@@ -162,7 +162,8 @@ def mutate(rna, mutation_rate):
#if adaptive mutation rate, mutation rate is a function of stability.
if mutation_rate == -1:
sig = lambda e: 1 / (1 + np.exp(-e/10))
# sig = lambda e: 1 / (1 + np.exp(-e/10))
sig = lambda x: 1 / (6 + 200 * np.exp(x/10))
mutation_rate = sig(rna.energy)
pass
......@@ -324,4 +325,4 @@ def start(generations=20, size=10, length=50, fit='energy', gc=0.5,\
if __name__ == "__main__":
start(mutation_rate=-1,verbose=True, generations=1000, size=1000, runs=20,\
dest="maternal_50_a10.csv", procs=10)
dest="maternal_50_b10.csv", procs=10)
......@@ -12,12 +12,12 @@ def structure_info(df, sse='multi'):
"""
df[sse] = df['structure'].apply(lambda x: loop_counter(x)[sse])
return df
def mean_stats(dfs):
return pd.concat(list(dfs)).groupby('mutations').mean()
def mean_stats(dfs, mode='mutations'):
return pd.concat(list(dfs)).groupby(mode).mean()
def struc_plot(dfs, sse='multi'):
def struc_plot(dfs, sse='multi', mode='mutations'):
dfs = (structure_info(df) for df in dfs)
strucs = pd.concat(dfs).groupby('mutations').mean()
strucs = pd.concat(dfs).groupby(mode).mean()
print(strucs)
sse_mean = strucs[sse]
sns.tsplot(sse_mean)
......@@ -32,7 +32,7 @@ def mut_plot():
plt.show()
if __name__ == "__main__":
path = "maternal_50_adaptive_0.csv"
dfs = (pd.read_csv(f"maternal_50_a10_{i}.csv") for i in range(20))
struc_plot(dfs, sse='multi')
dfs = (pd.read_csv(f"adaptive_run/maternal_50_a10_{i}.csv") for i in range(20))
struc_plot(dfs, sse='multi', mode='generations')
# mut_plot()
pass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment