-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_stochastics.py
More file actions
64 lines (49 loc) · 1.62 KB
/
plot_stochastics.py
File metadata and controls
64 lines (49 loc) · 1.62 KB
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import stochastic as st
ep = np.arange(0.1,0.8, 0.1)#np.arange(0.05, 0.4, 0.05)
ks = range(10,51,1)
g = 10000
n = 5000
r = 100
def plot_expected_correct_kmers():
x = ks
ys = []
for e in ep:
ys.append([max(0, st.expected_number_of_correct_kmers_at_position(g, r, n, k, e)) for k in ks])
for i in range(len(ep)):
plt.plot(x,ys[i], label = "correct kmers, p = "+str(ep[i]))
plt.legend(loc=1)
plt.xlabel("k")
plt.ylabel("Expected number of k-mers at each position")
plt.show()
def plot_average_number_of_kmers_with_errors():
x = range(14,31,1)
ys = []
zs = []
for e in ep:
ys.append([max(0, st.average_number_of_kmers_with_exactly_identical_errors(g, r, n, k, e)) for k in x])
zs.append([max(0, st.expected_number_of_correct_kmers_at_position(g, r, n, k, e)) for k in x])
for i in range(len(ep)):
plt.plot(x,ys[i], label = "incorrect kmers, p = "+str(ep[i]))
for i in range(len(ep)):
plt.plot(x,zs[i], linestyle="--", label = "correct kmers, p = "+str(ep[i]))
plt.legend(loc=1)
plt.xlabel("k")
plt.ylabel("expected or average number")
#plt.ylabel("Expected avg. number of identical kmers with errors")
plt.show()
def plot_expected_number_of_kmers():
x = ks
ys = []
for e in ep:
ys.append([max(0, st.expected_number_of_kmers(g, r, n, k, e)) for k in ks])
for i in range(len(ep)):
plt.plot(x,ys[i], label = "number of kmers, error_percentage = "+str(ep[i]))
plt.legend(loc=1)
plt.xlabel("k")
plt.ylabel("Expected total number of different k-mers")
plt.show()
plot_average_number_of_kmers_with_errors()