Package org.biojavax.ga.functions
Class MutationFunction.NoMutation
- java.lang.Object
-
- org.biojavax.ga.functions.MutationFunction.NoMutation
-
- All Implemented Interfaces:
Changeable
,MutationFunction
- Enclosing interface:
- MutationFunction
public static final class MutationFunction.NoMutation extends Object implements MutationFunction
Place Holder class that doesn't mutate its SymbolLists
- 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 Constructor Description NoMutation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener cl)
Add a listener that will be informed of all changes.void
addChangeListener(ChangeListener cl, ChangeType ct)
Add a listener that will be informed of changes of a given type.double[]
getMutationProbs()
OrderNDistribution
getMutationSpectrum()
boolean
isUnchanging(ChangeType ct)
A particular ChangeType can never be raised by this Changeable.SymbolList
mutate(SymbolList syml)
Produces a new SymbolList by mutation.void
removeChangeListener(ChangeListener c)
Remove a listener that was interested in all types of changes.void
removeChangeListener(ChangeListener cl, ChangeType ct)
Remove a listener that was interested in a specific types of changes.void
setMutationProbs(double[] muts)
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 odn)
Sets theDistribution
ofSymbols
that will be selected from when a mutation occurs.
-
-
-
Constructor Detail
-
NoMutation
public NoMutation()
-
-
Method Detail
-
getMutationProbs
public double[] getMutationProbs()
- Specified by:
getMutationProbs
in interfaceMutationFunction
-
getMutationSpectrum
public OrderNDistribution getMutationSpectrum()
- Specified by:
getMutationSpectrum
in interfaceMutationFunction
- Returns:
- null if the Distribution has not been set.
-
mutate
public SymbolList mutate(SymbolList syml)
Description copied from interface:MutationFunction
Produces a new SymbolList by mutation. Each position i in the SymbolListseq
is mutated with probabilitygetMutationProbs[i]
. The new residue is selected at random from theDistribution mutation
. The use of an array of probabilities allows the modelling of mutational hotspots. 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:
mutate
in interfaceMutationFunction
- Parameters:
syml
- the sequence to mutate- Returns:
- The mutated sequence.
-
setMutationProbs
public void setMutationProbs(double[] muts) 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:
muts
- an array of double values representing mutation probabilities- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
setMutationSpectrum
public void setMutationSpectrum(OrderNDistribution odn) 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:
odn
- the Distribution of 'mutant' bases to choose from.- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
isUnchanging
public boolean isUnchanging(ChangeType ct)
Description copied from interface:Changeable
A particular ChangeType can never be raised by this Changeable.
If this returns true, then it is guaranteed that change events of this type (and all child types) can never under any circumstances be fired by this Changeable instance. If it returns false, that does not mean that this type of event will or even can be raised, but that it is worth registering listeners incase.
- Specified by:
isUnchanging
in interfaceChangeable
- Parameters:
ct
- the ChangeType to check- Returns:
- true if ChangeEvents of this type are guaranteed to never be fired
-
removeChangeListener
public void removeChangeListener(ChangeListener c)
Description copied from interface:Changeable
Remove a listener that was interested in all types of changes.- Specified by:
removeChangeListener
in interfaceChangeable
- Parameters:
c
- a ChangeListener to remove
-
addChangeListener
public void addChangeListener(ChangeListener cl)
Description copied from interface:Changeable
Add a listener that will be informed of all changes.- Specified by:
addChangeListener
in interfaceChangeable
- Parameters:
cl
- the ChangeListener to add
-
addChangeListener
public void addChangeListener(ChangeListener cl, ChangeType ct)
Description copied from interface:Changeable
Add a listener that will be informed of changes of a given type.- Specified by:
addChangeListener
in interfaceChangeable
- Parameters:
cl
- the ChangeListenerct
- the ChangeType it is to be informed of
-
removeChangeListener
public void removeChangeListener(ChangeListener cl, ChangeType ct)
Description copied from interface:Changeable
Remove a listener that was interested in a specific types of changes.- Specified by:
removeChangeListener
in interfaceChangeable
- Parameters:
cl
- a ChangeListener to removect
- the ChangeType that it was interested in
-
-