Package pygene :: Module organism :: Class MendelOrganism
[show private | hide private]
[frames | no frames]

Type MendelOrganism

object --+        
         |        
PGXmlMixin --+    
             |    
  BaseOrganism --+
                 |
                MendelOrganism


Classical Mendelian genetic organism

Contains a pair of genes for each gene in the genome

Organisms contain a set of pairs of genes, where the genes of each pair must be of the same type.

Class variables (to override) are: Python operators supported:
Method Summary
  __init__(self, gamete1, gamete2, **kw)
Initialises this organism from either two gametes, or from a set of named gene keywords
  __getitem__(self, item)
allows shorthand for querying the phenotype of this organism
  copy(self)
returns a deep copy of this organism
  dump(self)
Produce a detailed human-readable report on this organism, its genotype and phenotype
  mate(self, partner)
Mates this organism with another organism to produce two entirely new organisms via mendelian crossover
  mutate(self)
Implement the mutation phase, invoking the stochastic mutation method on each component gene
  phenotype(self, geneName)
Returns the phenotype resulting from a given gene, OR the total phenotype resulting from all the genes
  split(self)
Produces a Gamete object from random splitting of component gene pairs
  xmlDumpSelf(self, doc, parent)
Dumps out this object's contents into an xml tree
    Inherited from BaseOrganism
  __add__(self, partner)
Allows '+' operator for sexual reproduction
  __cmp__(self, other)
Convenience method which invokes duel
  __repr__(self)
Delivers a minimal string representation of this organism.
  duel(self, opponent)
Duels this organism against an opponent
  fitness(self)
Return the fitness level of this organism, as a float
  xmlDumpAttribs(self, elem)
Dump out the custom attributes of this organism
    Inherited from PGXmlMixin
  xmlDump(self, fileobj)
Dumps out the population to an open file in XML format.
  xmlDumpClass(self, tag)
dumps out class information
  xmlDumps(self)
dumps out to xml, returning a string of the raw generated xml
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
dict genome = {}
bool mutateOneOnly = False

Method Details

__init__(self, gamete1=None, gamete2=None, **kw)
(Constructor)

Initialises this organism from either two gametes, or from a set of named gene keywords

Arguments:
  • gamete1, gamete2 - a pair of gametes from which to take the genes comprising the new organism. May be omitted.
Keywords:
  • keyword names are gene names within the organism's genome, and values are either:
    • a tuple containing two instances of a Gene subclass, or
    • a Gene subclass (in which case the class will be instantiated twice to form a random gene pair)
Any gene names in the genome, which aren't given in the constructor keywords, will be added as random instances of the respective gene class. (Recall that all Gene subclasses can be instantiated with no arguments to create a random valued gene).
Overrides:
__builtin__.object.__init__

__getitem__(self, item)
(Indexing operator)

allows shorthand for querying the phenotype of this organism

copy(self)

returns a deep copy of this organism

dump(self)

Produce a detailed human-readable report on this organism, its genotype and phenotype
Overrides:
pygene.organism.BaseOrganism.dump

mate(self, partner)

Mates this organism with another organism to produce two entirely new organisms via mendelian crossover
Overrides:
pygene.organism.BaseOrganism.mate

mutate(self)

Implement the mutation phase, invoking the stochastic mutation method on each component gene

Does not affect this organism, but returns a mutated copy of it
Overrides:
pygene.organism.BaseOrganism.mutate

phenotype(self, geneName=None)

Returns the phenotype resulting from a given gene, OR the total phenotype resulting from all the genes

tries to invoke a child class' method called 'phen_<name>'

split(self)

Produces a Gamete object from random splitting of component gene pairs

xmlDumpSelf(self, doc, parent)

Dumps out this object's contents into an xml tree

Arguments:
  • doc - an xml.dom.minidom.Document object
  • parent - an xml.dom.minidom.Element parent, being the node into which this node should be placed
Overrides:
pygene.organism.BaseOrganism.xmlDumpSelf

Class Variable Details

genome

Type:
dict
Value:
{}                                                                     

mutateOneOnly

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Mon Dec 12 14:37:12 2005 http://epydoc.sf.net