2""" @brief Definition of genes as DNA segments having semantics.
"""
4#============================================================================#
5# EVOLIFE http://evolife.telecom-paris.fr Jean-Louis Dessalles
21if __name__ ==
'__main__': sys.path.append(
'../..')
28 """ Actual gene (semantic segment on DNA) with intensity
29 A Gene also knows its locus (position in the list of genes,
as defined
in genetic map)
32 def __init__(self, gene_locus, intensity = 0):
33 """ A gene knows its intensity and its locus (position in the list of genes, as defined in genetic map)
40 return ' L' + str(self.
locus) +
': ' +
' ('+ str(self.
intensity) +
')'
43 """ class Genome: list of genes carried by individuals
46 def __init__(self, Scenario):
54 """ gene values are read from DNA and stored in Genes
59 self.
genome[locus].intensity = self.read_DNA(b1, b2, coding=coding)
62 """ absolute intensity addressed trough name
67 """ relative intensity (between 0 and 100) addressed through name
72 """ absolute intensity addressed trough locus
74 return self.
genome[locus].intensity
77 """ relative intensity (between 0 and 100) addressed through locus
82 """ returns all gene relative values - useful for statistics and display
87 return ' || '.join([g.__str__()
for g
in self.
genome])
90if __name__ ==
"__main__":
93 print(Genome.__doc__ +
'\n')
96 print(DNA.__str__(GG))
102__author__ =
'Dessalles'
class DNA: individuals' 'DNA' defined as a string of bits
Actual gene (semantic segment on DNA) with intensity A Gene also knows its locus (position in the lis...
class Genome: list of genes carried by individuals
def update(self)
gene values are read from DNA and stored in Genes
def locus_relative_value(self, locus)
relative intensity (between 0 and 100) addressed through locus
def signature(self)
returns all gene relative values - useful for statistics and display
def gene_value(self, name)
absolute intensity addressed trough name
def locus_value(self, locus)
absolute intensity addressed trough locus
def gene_relative_value(self, name)
relative intensity (between 0 and 100) addressed through name
Genomes in EVOLIFE are defined as a binary strings.