Package org.biojavax.ga.functions
Class AbstractMutationFunction
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.ga.functions.AbstractMutationFunction
-
- All Implemented Interfaces:
Changeable
,MutationFunction
- Direct Known Subclasses:
SimpleMutationFunction
,SwapMutationFunction
public abstract class AbstractMutationFunction extends AbstractChangeable implements MutationFunction
Abstract implementation ofMutationFunction
all custom implementations should inherit from here.- Since:
- 1.5
- Version:
- 1.0
- Author:
- Mark Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojavax.ga.functions.MutationFunction
MutationFunction.NoMutation
-
-
Field Summary
-
Fields inherited from interface org.biojavax.ga.functions.MutationFunction
DEFAULT_MUTATION_PROBS, MUTATION_PROBS, MUTATION_SPECTRUM, NO_MUTATION
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMutationFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
getMutationProbs()
OrderNDistribution
getMutationSpectrum()
void
setMutationProbs(double[] mutationProbs)
Set the probability of a mutation occuring at a certain position Position 0 in the array corresponds to the probability of the first residue ofseq
mutating.void
setMutationSpectrum(OrderNDistribution mutationSpectrum)
Sets theDistribution
ofSymbols
that will be selected from when a mutation occurs.-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojavax.ga.functions.MutationFunction
mutate
-
-
-
-
Constructor Detail
-
AbstractMutationFunction
protected AbstractMutationFunction()
-
-
Method Detail
-
setMutationProbs
public final void setMutationProbs(double[] mutationProbs) throws ChangeVetoException
Description copied from interface:MutationFunction
Set the probability of a mutation occuring at a certain position Position 0 in the array corresponds to the probability of the first residue ofseq
mutating. If the length of the array defined ingetMutationProbs()
is shorter than the length of the sequence the default behaivour of implementations will be to apply the last probability to each subsequence residue. A single member array will mutate all bases with equal probability.- Specified by:
setMutationProbs
in interfaceMutationFunction
- Parameters:
mutationProbs
- an array of double values representing mutation probabilities- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
getMutationProbs
public final double[] getMutationProbs()
- Specified by:
getMutationProbs
in interfaceMutationFunction
-
setMutationSpectrum
public final void setMutationSpectrum(OrderNDistribution mutationSpectrum) throws ChangeVetoException
Description copied from interface:MutationFunction
Sets theDistribution
ofSymbols
that will be selected from when a mutation occurs. AnOrderNDistribution
is used so that you can model a situation where the identity of the 'mutant'Symbol
is dependent on the originalSymbol
. The primary use is to preventSymbols
mutating to themselves. Another use would be to model transitions and transversions.- Specified by:
setMutationSpectrum
in interfaceMutationFunction
- Parameters:
mutationSpectrum
- the Distribution of 'mutant' bases to choose from.- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
getMutationSpectrum
public final OrderNDistribution getMutationSpectrum()
- Specified by:
getMutationSpectrum
in interfaceMutationFunction
- Returns:
- null if the Distribution has not been set.
-
-