Package org.biojavax.ga.functions
Interface MutationFunction
-
- All Superinterfaces:
Changeable
- All Known Implementing Classes:
AbstractMutationFunction
,MutationFunction.NoMutation
,SimpleMutationFunction
,SwapMutationFunction
public interface MutationFunction extends Changeable
A class that mutates a
SymbolList
- Since:
- 1.5
- Version:
- 1.0
- Author:
- Mark Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MutationFunction.NoMutation
Place Holder class that doesn't mutate its SymbolLists
-
Field Summary
Fields Modifier and Type Field Description static double[]
DEFAULT_MUTATION_PROBS
static ChangeType
MUTATION_PROBS
static ChangeType
MUTATION_SPECTRUM
static MutationFunction
NO_MUTATION
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double[]
getMutationProbs()
OrderNDistribution
getMutationSpectrum()
SymbolList
mutate(SymbolList seq)
Produces a new SymbolList by mutation.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 interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
DEFAULT_MUTATION_PROBS
static final double[] DEFAULT_MUTATION_PROBS
-
MUTATION_PROBS
static final ChangeType MUTATION_PROBS
-
MUTATION_SPECTRUM
static final ChangeType MUTATION_SPECTRUM
-
NO_MUTATION
static final MutationFunction NO_MUTATION
-
-
Method Detail
-
mutate
SymbolList mutate(SymbolList seq) throws IllegalAlphabetException, ChangeVetoException, IllegalSymbolException
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.- Parameters:
seq
- the sequence to mutate- Returns:
- The mutated sequence.
- Throws:
IllegalAlphabetException
- If themutationSpectrum Distribution
is not emitting Symbols from the sameAlphabet
asseq
.IllegalSymbolException
- if themutationSpectrum Distribution
is not conditioned with the sameAlphabet
as theseq Alphabet
.ChangeVetoException
- ifseq
is unmodifiable
-
setMutationProbs
void setMutationProbs(double[] mutationProbs) throws ChangeVetoException
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.- Parameters:
mutationProbs
- an array of double values representing mutation probabilities- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
getMutationProbs
double[] getMutationProbs()
-
setMutationSpectrum
void setMutationSpectrum(OrderNDistribution mutationSpectrum) throws ChangeVetoException
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.- Parameters:
mutationSpectrum
- the Distribution of 'mutant' bases to choose from.- Throws:
ChangeVetoException
- if a ChangeListener vetoes the change.
-
getMutationSpectrum
OrderNDistribution getMutationSpectrum()
- Returns:
- null if the Distribution has not been set.
-
-