|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.tostring0.AToString com.rubecula.darwin.domain.genetics.Genomic_
public abstract class Genomic_
Abstract class implementing base methods for the Genomic
interface.
Field Summary | |
---|---|
protected AuditableList<Chromosome> |
_chromosomes
|
protected Expresser |
expresserCommon
|
protected java.util.Map<Locus,Expresser> |
expressers
|
protected static org.apache.commons.logging.Log |
LOG
The logger for this class. |
Fields inherited from interface com.rubecula.darwin.domain.helper.Ploidy |
---|
DIPLOID, HAPLOID |
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 |
Constructor Summary | |
---|---|
protected |
Genomic_(java.lang.String identifier,
int ploidy,
Meiosis meiosis)
TEST Constructor for a new Genomic_ instance. |
protected |
Genomic_(java.lang.String identifier,
int ploidy,
Meiosis meiosis,
Mutator mutator)
Constructor for a new Genomic_ instance. |
Method Summary | |
---|---|
boolean |
addChromosome(Chromosome chromosome)
Method to add a chromosome at the end of this Genomic. |
void |
addChromosome(int index,
Chromosome chromosome)
Method to add a chromosome at the specified index. |
protected void |
clearChromosomes()
|
Genome |
createGamete(Genes genes)
XXX This is very similar to the way SeedGenome works. |
boolean |
equals(java.lang.Object obj)
|
void |
express(Phenotype phenotype,
Colony colony,
Genes genes)
Standard implementation of express for this Genomic. |
void |
express(Phenotype phenotype,
Genes genes)
Standard implementation of this method simply calls express(Phenotype, Colony, Genes) with null population. |
java.lang.String |
getAlphabet()
Override this method if not using the standard alphabet of bases. |
Chromosome |
getChromosome(int index)
|
java.util.Collection<Chromosome> |
getChromosomes()
Getter/setter typically used by reflection. |
int |
getCount()
|
Expresser |
getExpresser(Locus locus)
Get the expresser for the specific locus. |
java.util.Map<Locus,Expresser> |
getExpressers()
This is a bean property (not part of an interface). |
java.lang.String |
getIdentifier()
|
Locus |
getLocus(int n)
method to step through each chromosome and get the nth locus relative to this genom object. |
int |
getLocusCount()
Get the total number of locus by cycling through the chromosomes. |
Meiosis |
getMeiosis()
XXX |
Mutator |
getMutator()
XXX |
int |
getPloidy()
XXX |
int |
hashCode()
|
Genome |
mutate(Genome genome)
Non-mutating method to mutate this Genome and return a mutated copy. |
void |
normalize(Genome genome,
Genome reference)
Normalize the given genome with respect to the reference genome. |
Expresser |
putExpresser(Locus locus,
Expresser expresser)
Register an expresser. |
void |
setChromosomes(java.util.Collection<Chromosome> chromosomes)
This is the preferred method to set the chromosomes. |
void |
setExpresser(Expresser expresser)
Set the common expresser (for all loci). |
void |
setExpressers(java.util.Map<Locus,Expresser> expressers)
Used by dependency injection: sets the expresser map. |
boolean |
simplify(Genome genome)
Repeatedly invoke the simplify method of the mutator on the genome until there are no further changes. |
Methods inherited from class net.sf.tostring0.AToString |
---|
toString, toString, toStringBrief, toStringId |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient Expresser expresserCommon
protected transient java.util.Map<Locus,Expresser> expressers
protected final transient AuditableList<Chromosome> _chromosomes
protected static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
protected Genomic_(java.lang.String identifier, int ploidy, Meiosis meiosis)
identifier
- the identifier for this Genomic.ploidy
- the ploidy (haploid/diploid/etc).meiosis
- the implementer of Meiosis
.protected Genomic_(java.lang.String identifier, int ploidy, Meiosis meiosis, Mutator mutator)
identifier
- the identifier for this Genomic.ploidy
- the ploidy (haploid/diploid/etc).meiosis
- the implementer of Meiosis
.mutator
- the implementer of Mutator
which will be applied to
all new genomes.Method Detail |
---|
public boolean addChromosome(Chromosome chromosome)
Genomic
addChromosome
in interface Genomic
chromosome
- a chromosome to be inserted into this Genomic.
Genomic.addChromosome(com.rubecula.darwin.domain.helper.Chromosome)
public void addChromosome(int index, Chromosome chromosome)
Genomic
addChromosome
in interface Genomic
index
- the index at which the new object will appear.chromosome
- a chromosome to be inserted into this Genomic.Genomic.addChromosome(int,
com.rubecula.darwin.domain.helper.Chromosome)
public Genome createGamete(Genes genes)
createGamete
in interface Replicator
genes
- the Genome from which the gamete will be created via a process
of meiosis.
Replicator.createGamete(com.rubecula.darwin.domain.helper.Genes)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public void express(Phenotype phenotype, Colony colony, Genes genes)
express
in interface Genomic
phenotype
- the phenotype to which we will add any traits resulting from
the expression of the given genescolony
- the population to which our genome belongs, usually ignored
but referenced if population and/or environment affect gene
expression.genes
- the genes to expressGenomic.express(Phenotype, Colony,
com.rubecula.darwin.domain.helper.Genes)
public void express(Phenotype phenotype, Genes genes)
express(Phenotype, Colony, Genes)
with null population.
TODO consider checking the cache here (although this implementation is
never called other than by unit tests).
express
in interface Genomic
phenotype
- the phenotype to which the expressions will be added.Genomic.express(Phenotype,
com.rubecula.darwin.domain.helper.Genes)
public java.lang.String getAlphabet()
getAlphabet
in interface Genomic
Genomic.getAlphabet()
public Chromosome getChromosome(int index)
getChromosome
in interface Genomic
index
(0..N). Note that
sex chromosomes are never counted in the index. Thus the first
non-sex chromosome in the genomic is at index 0, etc.Genomic.getChromosome(int)
public java.util.Collection<Chromosome> getChromosomes()
Genomic
getChromosomes
in interface Genomic
XXX showIdentifer=false has no effect because it uses an either/or
rule.
public int getCount()
getCount
in interface Countable
public Expresser getExpresser(Locus locus)
getExpresser
in interface Genomic
locus
- the locus (or null) for which we want the expresser
Genomic.getExpresser(com.rubecula.darwin.domain.helper.Locus)
public java.util.Map<Locus,Expresser> getExpressers()
Locus
=> Expresser
for this
Genomic.public java.lang.String getIdentifier()
getIdentifier
in interface net.sf.tostring0.Identifiable
XXX omit=true has no effect because identifiers are not treated like
normal ToString-annotation objects.
public final Locus getLocus(int n)
getLocus
in interface Genomic
n
- which must be greater than or equal to 0 and less than
Genomic.getLocusCount()
.
Genomic.getLocus(int)
public int getLocusCount()
getLocusCount
in interface Genomic
Genomic.getLocusCount()
public Meiosis getMeiosis()
getMeiosis
in interface Genomic
Meiosis
Genomic.getMeiosis()
public Mutator getMutator()
getMutator
in interface Genomic
Genomic.getMutator()
public int getPloidy()
getPloidy
in interface Ploidy
Ploidy.HAPLOID
, i.e.
simple or Ploidy.DIPLOID
, i.e. double.Ploidy.getPloidy()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public Genome mutate(Genome genome)
Genes
.
TODO consider reworking the callers of this method -- the usage is
inconsistent between sexual and asexual situations.
mutate
in interface Genomic
genome
-
this
Genome or a mutated copy.Genomic.mutate(com.rubecula.darwin.domain.helper.Genome)
public void normalize(Genome genome, Genome reference)
normalize
in interface Genomic
genome
- reference
- public Expresser putExpresser(Locus locus, Expresser expresser)
putExpresser
in interface Genomic
Genomic.putExpresser(com.rubecula.darwin.domain.helper.Locus,
com.rubecula.darwin.domain.helper.Expresser)
public void setChromosomes(java.util.Collection<Chromosome> chromosomes)
Genomic
setChromosomes
in interface Genomic
Genomic.setChromosomes(java.util.Collection)
public void setExpresser(Expresser expresser)
setExpresser
in interface Genomic
expresser
- public void setExpressers(java.util.Map<Locus,Expresser> expressers)
expressers
- public boolean simplify(Genome genome)
simplify
in interface Genomic
genome
- the genome to be simplified
TODO consider narrowing genome to Genotype.
Genomic.simplify(Genome)
protected void clearChromosomes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |