create's People
create's Issues
다인자 유전 시뮬레이터
import random
import matplotlib.pyplot as plt
indi1 = [0, 0, 0]
indi1[0] = ['A', 'a']
indi1[1] = ['B', 'b']
indi1[2] = ['C', 'c']
indi2 = [0, 0, 0]
indi2[0] = ['A', 'a']
indi2[1] = ['B', 'b']
indi2[2] = ['C', 'c']
accumulate_data = []
def Inheritance():
son = [0, 0, 0, 0, 0, 0]
ac = [0, 0, 0, 0, 0, 0]
for r in range(0, 6):
d = random.randint(0, 1)
ac[r] = d
son[0] = indi1[0][ac[0]]
son[1] = indi2[0][ac[1]]
son[2] = indi1[1][ac[2]]
son[3] = indi2[1][ac[3]]
son[4] = indi1[2][ac[4]]
son[5] = indi2[2][ac[5]]
print(son[0] + "" + son[1] + son[2] + "" + son[3] + son[4] + "" + son[5], end = ' - ')
data = 6 - ac[0] - ac[1] - ac[2] - ac[3] - ac[4] - ac[5]
accumulate_data.append(data)
for t in range(0, 64):
Inheritance()
def draw_standard():
y = [1, 6, 15, 20, 15, 6, 1]
x = range(len(y))
plt.bar(x, y, width=0.7, color="red")
plt.title('standard Model')
plt.ylabel('ratio')
plt.xlabel('Relative number of dominant genes')
plt.show()
def draw_model():
d_0 = 0
d_1 = 0
d_2 = 0
d_3 = 0
d_4 = 0
d_5 = 0
d_6 = 0
stack = 1
for y in accumulate_data:
if y == 0:
d_0 += stack
elif y == 1:
d_1 += stack
elif y == 2:
d_2 += stack
elif y == 3:
d_3 += stack
elif y == 4:
d_4 += stack
elif y == 5:
d_5 += stack
elif y == 6:
d_6 += stack
tt = [d_0, d_1, d_2, d_3, d_4, d_5, d_6]
xx = range(len(tt))
plt.bar(xx, tt, width=0.7, color="blue")
plt.title('simulation Model')
plt.ylabel('ratio')
plt.xlabel('Relative number of dominant genes')
plt.show()
draw_standard()
draw_model()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.