com.rubecula.darwin.domain.genetics
Class Genome_

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.foundation.AuditableList<Gene>
          extended by com.rubecula.darwin.domain.genetics.Genotype_
              extended by com.rubecula.darwin.domain.genetics.Genome_
All Implemented Interfaces:
Basic, CacheSignature, Censusible, Genes, Genome, Genotype, Ploidy, java.lang.Cloneable, java.lang.Iterable<Gene>, java.util.Collection<Gene>, java.util.List<Gene>, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
Direct Known Subclasses:
Genome_Linear

public abstract class Genome_
extends Genotype_
implements Genome

This abstract class provides base definitions for implementers of Genome, the genetic information contained in an Organism belonging to a Taxon. A Genome may contain any number of Genes, though in practice the number is determined by the Genomic which defines this Genome. The structure of Genome is approximately parallel to that of Genomic.
TODO Genome_ extends Genotype_ and many of the uses of Genome_ could actually be narrowed to use Genotype_ instead, especially if fertilization and mutation were done at the Genotype level.

Version:
$Revision: 1.52 $
Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.darwin.domain.genetics.Genotype_
_ploidy, LOG
 
Fields inherited from interface net.sf.tostring0.IToString
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE
 
Fields inherited from interface com.rubecula.darwin.domain.helper.Ploidy
DIPLOID, HAPLOID
 
Constructor Summary
protected Genome_(Genomic genomic, int ploidy)
           
 
Method Summary
 void environmentChanged(Visualizable visualizable)
          Flush the cached phenotype for this genome/population combination.
 boolean equals(java.lang.Object obj)
          Determine equality based on the value of Genotype_.getBases().
 Phenotype express(Colony colony)
          Method to create a new phenotype from a collection of genes by expressing each and every gene, one at a time, using this Expresser.
 Genome fertilize(Genes other)
          Method to fuse this haploid genome with other genome into a new diploid genome.
 Gene getGene(java.lang.String id)
           
 Genomic getGenomic()
           
 boolean getSex()
           
 int hashCode()
          return the hashcode of the bases.
 Genes invert()
          This implementation of invert() assumes that the genome is haploid.
 Genome mutate(Mutator mutator)
          Method to mutate a Genome using a particular mutator.
 
Methods inherited from class com.rubecula.darwin.domain.genetics.Genotype_
addGene, addGene, addGenes, censusMe, clone, doCensus, getBases, getCensusibleChildren, getGene, getIdentifier, getList, getPloidy, getSignature
 
Methods inherited from class com.rubecula.darwin.foundation.AuditableList
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, setList, size, subList, toArray, toArray
 
Methods inherited from class net.sf.tostring0.AToString
toString, toString, toStringBrief, toStringId
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Genotype
addGene, addGene, addGenes, doCensus
 
Methods inherited from interface net.sf.tostring0.IToString
toString, toStringBrief, toStringId
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Ploidy
getPloidy
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Genes
getGene
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Basic
getBases
 
Methods inherited from interface com.rubecula.darwin.domain.helper.CacheSignature
getSignature
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Censusible
censusMe, getCensusibleChildren
 
Methods inherited from interface net.sf.tostring0.Identifiable
getIdentifier
 

Constructor Detail

Genome_

protected Genome_(Genomic genomic,
                  int ploidy)
Parameters:
genomic -
ploidy -
Method Detail

environmentChanged

public void environmentChanged(Visualizable visualizable)
Flush the cached phenotype for this genome/population combination. This must be called for any significant population change, or change to the population's environment. A significant change is one that would result in a different phenotype being returned.

Specified by:
environmentChanged in interface Genome
Parameters:
visualizable - the population which has changed.
See Also:
Genome.environmentChanged(Visualizable)

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Genotype_
Determine equality based on the value of Genotype_.getBases(). Ignore the super-class.

Specified by:
equals in interface java.util.Collection<Gene>
Specified by:
equals in interface java.util.List<Gene>
Overrides:
equals in class Genotype_
See Also:
Object.equals(java.lang.Object)

express

public Phenotype express(Colony colony)
Method to create a new phenotype from a collection of genes by expressing each and every gene, one at a time, using this Expresser. This method may be overwritten by implementers of Expresser but that would be unusual. An example of why you might want to overwrite it would be to allow the expression of several genes together or to express more than one trait from any one gene. The phenotype for any particular population is cached. If the population changes in some significant way, for example a property of its environment changes, the method environmentChanged() should be called.

Specified by:
express in interface Genome
Parameters:
colony - even though generally ignored, it must be a valid population, with an environment that in turns has an environment factory.
Returns:
a Dawkinsian Phenotype filled with the expressed traits.
See Also:
Expresser.express(Colony, Gene[])

fertilize

public Genome fertilize(Genes other)
Method to fuse this haploid genome with other genome into a new diploid genome. In theory, at least, there is no implied ordering of the two gametes. The resulting genome should express as a phenotype regardless of the ordering of the arguments x and y. At meiosis, the ordering of the parents x, y is semi-significant - but the effect should be masked by the seeding of the random number generator for a mating. This and the other gamete must conform to the same Genomic, otherwise, no fertilization can take place. TODO in theory, we could allow this and two other Genes parameters to combine into a triploid result. XXX consider pulling this up into Genotype_.

Specified by:
fertilize in interface Genome
Parameters:
other - the gamete to be fused with this gamete
Returns:
the resulting genome.

getGene

public Gene getGene(java.lang.String id)
Specified by:
getGene in interface Genome
Returns:
the gene whose locus has identifier which matches id (ignoring case).
See Also:
Genome.getGene(java.lang.String)

getGenomic

public Genomic getGenomic()
Specified by:
getGenomic in interface Genome
Returns:
the genomic for this genome

getSex

public boolean getSex()
               throws GeneticsException
Specified by:
getSex in interface Genome
Returns:
the sex of this genome, expressed as a boolean (female is true if I recall).
Throws:
GeneticsException - if this Genome does not contain the sex gene, or it is improperly formed

hashCode

public int hashCode()
Description copied from class: Genotype_
return the hashcode of the bases. We ignore the super method.

Specified by:
hashCode in interface java.util.Collection<Gene>
Specified by:
hashCode in interface java.util.List<Gene>
Overrides:
hashCode in class Genotype_
See Also:
Object.hashCode()

invert

public Genes invert()
This implementation of invert() assumes that the genome is haploid. The resulting genes object is a set of genes of the same length as this genome, but result(i) = complement(gene(N-1-i)) where N is the number of genes. If you need a more complex inversion process, or for some reason, you are inverting non-haploid genomes, you will need to override this.

Specified by:
invert in interface Genome
Returns:
the inverted genome, as a Genes object.
See Also:
Genome.invert()

mutate

public Genome mutate(Mutator mutator)
Description copied from interface: Genome
Method to mutate a Genome using a particular mutator. Implementers of this method should normally return a copy of this Genome, rather than simply a reference (although if the mutator is the identity mutator, it is acceptable to return a reference to the original).

Specified by:
mutate in interface Genome
Parameters:
mutator - the mutator
Returns:
a distinct copy of this Genome, which may or may not be mutated.
See Also:
Genome.mutate(com.rubecula.darwin.domain.helper.Mutator)


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.