Package com.actelion.research.chem
Class Mutator
- java.lang.Object
-
- com.actelion.research.chem.Mutator
-
public class Mutator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
MUTATION_ANY
static int
MUTATION_GROW
static int
MUTATION_KEEP_SIZE
static int
MUTATION_SHRINK
-
Constructor Summary
Constructors Constructor Description Mutator(AtomTypeList atomTypeList)
Creates a new Mutator that calculates probabilities of individual mutations from a given atom type list.Mutator(java.lang.String filename)
Creates a new Mutator that calculates probabilities of individual mutations from a given atom type file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.ArrayList<Mutation>
generateMutationList(StereoMolecule mol, int mutationType, boolean regulateSize)
Creates a list of possible mutations and their probabilitiesStereoMolecule[]
getMutatedSet(StereoMolecule mol, int mutationType, boolean regulateSize, int count)
java.util.ArrayList<Mutation>
mutate(StereoMolecule mol)
Does an in-place mutation of the molecule allowing any kind of mutation at any of the molecules non-selected atoms aiming for 4-24 non-H atoms with an optimum of 9 atoms.java.util.ArrayList<Mutation>
mutate(StereoMolecule mol, int mutationType, boolean regulateSize)
Does an in-place mutation of the molecule allowing the defined mutation kinds at any of the molecules unselected atoms.void
mutate(StereoMolecule mol, java.util.ArrayList<Mutation> mutationList)
Selects a likely mutation from the list, performs the mutation and removes it from the list.void
performMutation(StereoMolecule mol, Mutation mutation)
Performs the given mutation on the molecule, updates atom coordinates, and updates stereo bonds to reflect lost or new stereo centers.void
printMutationList(java.util.ArrayList<Mutation> mutationList, boolean sortByPriority)
void
setBiasProvider(MutationBiasProvider mbp)
void
setGrowBoost(double boost)
void
setPreferredSize(int minAtoms, int preferredAtoms, int maxAtoms)
-
-
-
Field Detail
-
MUTATION_GROW
public static final int MUTATION_GROW
- See Also:
- Constant Field Values
-
MUTATION_SHRINK
public static final int MUTATION_SHRINK
- See Also:
- Constant Field Values
-
MUTATION_KEEP_SIZE
public static final int MUTATION_KEEP_SIZE
- See Also:
- Constant Field Values
-
MUTATION_ANY
public static final int MUTATION_ANY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Mutator
public Mutator(java.lang.String filename)
Creates a new Mutator that calculates probabilities of individual mutations from a given atom type file. For every potential mutation the algorithm calculates a probability considering the frequencies of broken and formed atom types during the conversion.
If no type list is given, all possible mutations are considered equally likely.
New type files can be created from an sdf or dwar file like this:
new AtomTypeList("/somepath/chembl14.dwar", AtomTypeCalculator.cPropertiesForMutator).writeTypeFile("/somepath/chembl14.typ");
This would cause a file /somepath/chembl14.typ to be created with the statistics taken from chembl14.dwar.- Parameters:
filename
- null or name of a atomTypeList file ('*.typ')
-
Mutator
public Mutator(AtomTypeList atomTypeList)
Creates a new Mutator that calculates probabilities of individual mutations from a given atom type list. For every potential mutation the algorithm calculates a probability considering the frequencies of broken and formed atom types during the conversion.
If no type list is given, all possible mutations are considered equally likely.
New type files can be created from an sdf or dwar file like this:
new AtomTypeList().create("/somepath/chembl14.dwar", AtomTypeCalculator.cPropertiesForMutator);
This would cause a file /somepath/chembl14.typ to be created with the statistics taken from chembl14.dwar. Instantiating multiple Mutator objects from the same AtomTypeList is thread-safe.- Parameters:
atomTypeList
- null or name of a atomTypeList file ('*.typ')
-
-
Method Detail
-
setBiasProvider
public void setBiasProvider(MutationBiasProvider mbp)
-
setGrowBoost
public void setGrowBoost(double boost)
-
setPreferredSize
public void setPreferredSize(int minAtoms, int preferredAtoms, int maxAtoms)
-
getMutatedSet
public StereoMolecule[] getMutatedSet(StereoMolecule mol, int mutationType, boolean regulateSize, int count)
-
mutate
public java.util.ArrayList<Mutation> mutate(StereoMolecule mol)
Does an in-place mutation of the molecule allowing any kind of mutation at any of the molecules non-selected atoms aiming for 4-24 non-H atoms with an optimum of 9 atoms.- Parameters:
mol
-- Returns:
- list of all not-used mutations or null if no mutation was done because no possible mutation was found
-
mutate
public java.util.ArrayList<Mutation> mutate(StereoMolecule mol, int mutationType, boolean regulateSize)
Does an in-place mutation of the molecule allowing the defined mutation kinds at any of the molecules unselected atoms.- Parameters:
mol
-mutationType
- MUTATION_ANY, MUTATION_GROW, MUTATION_KEEP_SIZE, or MUTATION_SHRINK or other combination of allowed mutations typesregulateSize
- whether to regulate the molecule size within 4 to 24 non-H atoms or what was defined by setPreferredSize()- Returns:
- list of all not-used mutations or null if no mutation was done because no possible mutation was found
-
mutate
public void mutate(StereoMolecule mol, java.util.ArrayList<Mutation> mutationList)
Selects a likely mutation from the list, performs the mutation and removes it from the list. If the mutation list is empty, then no mutation is performed.- Parameters:
mol
-mutationList
-
-
generateMutationList
public java.util.ArrayList<Mutation> generateMutationList(StereoMolecule mol, int mutationType, boolean regulateSize)
Creates a list of possible mutations and their probabilities- Parameters:
mol
-mutationType
- MUTATION_ANY, MUTATION_GROW, MUTATION_KEEP_SIZE, or MUTATION_SHRINK or other combination of allowed mutations typesregulateSize
- if true keeps non-H atoms between 4 and 24 with an optimum at 9 or what was defined by setPreferredSize().
-
performMutation
public void performMutation(StereoMolecule mol, Mutation mutation)
Performs the given mutation on the molecule, updates atom coordinates, and updates stereo bonds to reflect lost or new stereo centers.- Parameters:
mol
-mutation
-
-
printMutationList
public void printMutationList(java.util.ArrayList<Mutation> mutationList, boolean sortByPriority)
-
-