com.rubecula.darwin.domain.helper
Interface Locus

All Superinterfaces:
net.sf.tostring0.Identifiable, net.sf.tostring0.IToString, Progenitor
All Known Implementing Classes:
Locus_, Locus_Random, Locus_Sex, Locus_Triversian, Locus_TS

public interface Locus
extends net.sf.tostring0.IToString, Progenitor, net.sf.tostring0.Identifiable

Defines a Locus at which one of several Alleles may appear. The set of possible alleles is backed by a HashSet so that ordering is not important.

Version:
$Revision: 1.10 $
Author:
Robin Hillyard

Field Summary
static java.lang.String ID_SEX
           
 
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
 
Method Summary
 java.lang.String add(Allele allele, int frequency)
          Method to add an allele to this locus.
 java.lang.String addAllele(Allele allele)
          Method to add an allele to this locus.
 Allele getAllele(java.lang.String key)
           
 java.util.Map<java.lang.String,Allele> getAlleleMap()
           
 java.util.Collection<Allele> getAlleleValues()
           
 Chromosome getChromosome()
           
 java.lang.String getKey(Allele allele)
           
 Progenitor getParent()
           
 Locus getPolygenic()
           
 boolean isLegal(java.lang.String allele)
          Method to determine if this Locus may contain allele with a non-zero frequency
 Gene makeGene(java.lang.String... keys)
          Make a gene with the alleles specified by the variable number of allele indexes.
 java.lang.String pickAllele()
          Method to randomly pick an allele from the set of possible alleles, and chosen according to the frequencies specified for each allele.
 void setParent(Progenitor chromosome)
           
 int size()
           
 
Methods inherited from interface net.sf.tostring0.IToString
toString, toStringBrief, toStringId
 
Methods inherited from interface net.sf.tostring0.Identifiable
getIdentifier
 

Field Detail

ID_SEX

static final java.lang.String ID_SEX
See Also:
Constant Field Values
Method Detail

add

java.lang.String add(Allele allele,
                     int frequency)
Method to add an allele to this locus.

Parameters:
allele - An allele which can possibly appear at this locus.
frequency - The relative frequency with which this allele appears at this locus in the gene pool. This is used when seeding a population.
Returns:
the key of the new allele.

addAllele

java.lang.String addAllele(Allele allele)
Method to add an allele to this locus.

Parameters:
allele - An allele which can possibly appear at this locus.
Returns:
the key of the newly added allele.

getAllele

Allele getAllele(java.lang.String key)
Parameters:
key -
Returns:
the allele from this locus corresponding to key.

getAlleleMap

java.util.Map<java.lang.String,Allele> getAlleleMap()
Returns:
the map of alleles for this locus. Getter/setter typically used by reflection.

getAlleleValues

java.util.Collection<Allele> getAlleleValues()
Returns:
a list of allele values for this locus.

getChromosome

Chromosome getChromosome()
Returns:
the Chromosome to which this locus belongs.

getKey

java.lang.String getKey(Allele allele)
Parameters:
allele - the key for this allele.
Returns:
result of invoking List.indexOf(Object) on the #list with the parameter allele. Will return -1 if the allele is not found.

getParent

Progenitor getParent()
Returns:
the owning Chromosome for a non-polygenic locus (or the first such), otherwise get the polygenic locus which in turn points to this one.

getPolygenic

Locus getPolygenic()
Returns:
either another locus, with which this locus is polygenic, or null. The target polygenic locus is itself not directly "owned" by the chromosome. Instead its parent is this Locus.

isLegal

boolean isLegal(java.lang.String allele)
Method to determine if this Locus may contain allele with a non-zero frequency

Parameters:
allele - the key to the allele
Returns:
true if locus contains allele and frequency is greater than 0

makeGene

Gene makeGene(java.lang.String... keys)
Make a gene with the alleles specified by the variable number of allele indexes.

Parameters:
keys - variable number (according to the ploidy) of keys designating which alleles will make up this locus.
Returns:
the new Gene.

pickAllele

java.lang.String pickAllele()
Method to randomly pick an allele from the set of possible alleles, and chosen according to the frequencies specified for each allele.

Returns:
the index of a randomly chosen legal allele for this locus.

setParent

void setParent(Progenitor chromosome)
Parameters:
chromosome -

size

int size()
Returns:
the number of alleles in this Locus


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