Commit 76a55a0e authored by Carlos GO's avatar Carlos GO
Browse files

merged

parents d88f4bc5 756a44aa
......@@ -162,7 +162,12 @@ def mutate(rna, mutation_rate):
#if adaptive mutation rate, mutation rate is a function of stability.
if mutation_rate == -1:
<<<<<<< HEAD
sig = lambda e: 1 / (3 + np.exp(-e/15))
=======
# sig = lambda e: 1 / (1 + np.exp(-e/10))
sig = lambda x: 1 / (6 + 200 * np.exp(x/10))
>>>>>>> 756a44aaf893605bb016d1b69222e9e0116c05c9
mutation_rate = sig(rna.energy)
pass
......@@ -324,4 +329,5 @@ 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_a15.csv", procs=10)
:x
:x
......@@ -12,17 +12,13 @@ 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)
# dfs = (structure_info(df, sse='stack') for df in dfs)
# dfs = (structure_info(df, sse='internal') for df in dfs)
# strucs = pd.concat(dfs).groupby('generation').mean()
# strucs.to_csv("adapt_gen_15.csv")
# print(strucs)
strucs = pd.read_csv("adapt_mut_15.csv")
strucs = pd.concat(dfs).groupby(mode).mean()
print(strucs)
sse_mean = strucs[sse]
sns.tsplot(sse_mean)
plt.xlabel("Mutations")
......@@ -41,7 +37,7 @@ def mut_plot():
plt.show()
if __name__ == "__main__":
path = "maternal_50_adaptive_0.csv"
dfs = (pd.read_csv(f"maternal_50_a15_{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