com.rubecula.darwin.domain.genetics
Class Genotype_

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_
All Implemented Interfaces:
Basic, CacheSignature, Censusible, Genes, 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_

public abstract class Genotype_
extends AuditableList<Gene>
implements Genotype, java.lang.Cloneable

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 .

Version:
$Revision: 1.48 $
Author:
Robin Hillyard

Field Summary
protected  int _ploidy
          The "ploidy" (or "oid") is the genetic "form" of the this genome.
protected static org.apache.commons.logging.Log LOG
          The logger for this class.
 
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 Genotype_(int ploidy)
          Constructor which creates a Genome instance with the given "ploidy".
 
Method Summary
 boolean addGene(Gene gene)
          Add gene to this Genotype at its end.
 void addGene(int locus, Gene gene)
          Add a Gene to this Genotype at a specific index.
 void addGenes(Genes genes)
          Iteratively call addGene(Gene) for each of the genes provided.
 boolean censusMe(Census census, java.lang.Object context)
          Method to census this object.
 java.lang.Object clone()
           
 void doCensus(FrequencyMap<Allele> alleleFrequencies)
           
 boolean equals(java.lang.Object obj)
          Determine equality based on the value of getBases().
 java.lang.String getBases()
           
 java.util.Collection<? extends Censusible> getCensusibleChildren()
          Method to return a list of censusible children of this object.
 Gene getGene(int locus)
           
 java.lang.String getIdentifier()
           
protected  java.util.Collection<Gene> getList()
           
 int getPloidy()
          The "ploidy" of this Genome.
 java.lang.String getSignature()
           
 int hashCode()
          return the hashcode of the bases.
 
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 net.sf.tostring0.IToString
toString, toStringBrief, toStringId
 
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
 

Field Detail

_ploidy

protected final int _ploidy
The "ploidy" (or "oid") is the genetic "form" of the this genome. It is the number of alleles that are carried at any locus by this genome. Note that an organism has its ploidy determined by its genome. However, gametes of that organism are always haploid.
For a haploid system, the Ode is 1; for a diploid system, the Ode is 2, etc.


LOG

protected static final org.apache.commons.logging.Log LOG
The logger for this class.

Constructor Detail

Genotype_

protected Genotype_(int ploidy)
Constructor which creates a Genome instance with the given "ploidy".

Parameters:
ploidy - the ploidy (haploid, diploid) of the genome.
Method Detail

addGene

public boolean addGene(Gene gene)
Description copied from interface: Genotype
Add gene to this Genotype at its end.

Specified by:
addGene in interface Genotype
Parameters:
gene - the gene to add
Returns:
true.
See Also:
AuditableList.add(net.sf.tostring0.IToString)

addGene

public void addGene(int locus,
                    Gene gene)
Description copied from interface: Genotype
Add a Gene to this Genotype at a specific index.

Specified by:
addGene in interface Genotype
Parameters:
locus -
gene -
See Also:
Genotype.addGene(int, com.rubecula.darwin.domain.helper.Gene)

addGenes

public void addGenes(Genes genes)
Iteratively call addGene(Gene) for each of the genes provided.

Specified by:
addGenes in interface Genotype
Parameters:
genes -
See Also:
Genotype.addGenes(com.rubecula.darwin.domain.helper.Genes)

censusMe

public boolean censusMe(Census census,
                        java.lang.Object context)
Description copied from interface: Censusible
Method to census this object.

Specified by:
censusMe in interface Censusible
Parameters:
census - the census object which will present the results of taking this census
context - an arbitrary object which can be used by the census object to provide appropriate context for this object.
Returns:
true if we should continue censusing this object at deeper levels. If the result is false, then we do not call Censusible.getCensusibleChildren().
See Also:
Censusible.censusMe(com.rubecula.darwin.domain.helper.Census, java.lang.Object)

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

doCensus

public void doCensus(FrequencyMap<Allele> alleleFrequencies)
Specified by:
doCensus in interface Genotype
Parameters:
alleleFrequencies -

equals

public boolean equals(java.lang.Object obj)
Determine equality based on the value of 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 AuditableList<Gene>
See Also:
AuditableList.equals(java.lang.Object)

getBases

public java.lang.String getBases()
Specified by:
getBases in interface Basic
Returns:
a set of bases in the base alphabet of the genome (e.g. "CAGT") which correspond to this genetic object. These bases are used to determine certain mutations and crossover situations.
See Also:
Basic.getBases()

getCensusibleChildren

public java.util.Collection<? extends Censusible> getCensusibleChildren()
Description copied from interface: Censusible
Method to return a list of censusible children of this object.

Specified by:
getCensusibleChildren in interface Censusible
Returns:
either null or an ArrayList of censusible objects.
See Also:
Censusible.getCensusibleChildren()

getGene

public Gene getGene(int locus)
Specified by:
getGene in interface Genes
Parameters:
locus - an integer from 0...
Returns:
the Gene at the specified locus position.
See Also:
Genes.getGene(int)

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
Overrides:
getIdentifier in class AuditableList<Gene>
Returns:
the signature for this TraitMap
See Also:
AuditableList.getIdentifier()

getPloidy

public int getPloidy()
The "ploidy" of this Genome. It may not match that of the Genomic to which the genes belong.

Specified by:
getPloidy in interface Ploidy
Returns:
the "ploidy" which will normally be either Ploidy.HAPLOID, i.e. simple or Ploidy.DIPLOID, i.e. double.
See Also:
Ploidy.getPloidy()

getSignature

public java.lang.String getSignature()
Specified by:
getSignature in interface CacheSignature
Returns:
a "signature" for this object which can be used to form part of a cache key. The signature is similar in a sense to the hash code but typically, it is based more on mutable components of an object than is the hash code.
See Also:
CacheSignature.getSignature()

hashCode

public int hashCode()
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 AuditableList<Gene>
See Also:
AuditableList.hashCode()

getList

protected java.util.Collection<Gene> getList()
Overrides:
getList in class AuditableList<Gene>
Returns:
the actual list as a Collection


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