Crankshaft Mutator
A CrankshaftMutator
instance changes a Pose
State
by introducing one or more crankshaft movements: a concerted rotation, by a given axis, around a virtual axis between two Atom
instances.
ProtoSyn.Mutators.CrankshaftMutator
— TypeCrankshaftMutator(angle_sampler::Function, p_mut::AbstractFloat, step_size::AbstractFloat, selection::Opt{AbstractSelection}, inc_last_res::Opt{AbstractSelection})
Return a CrankshaftMutator
instance. This AbstractMutator
is a functor, called with the following signature:
(crankshaft_mutator::CrankshaftMutator)(pose::Pose)
The CrankshaftMutator
AbstractMutator
loops through all pairs of two atoms possible, in the given Pose
. For each pair, if a random number (rand()
) is bellow a given probability of mutation p_mut
, both atoms are selected for a crankshaft movement (therefore a higher p_mut
value applies a larger number of crankshaft movements per call). A crankshaft movement is a concerted rotation around a virtual axis formed between the two selected atoms, by a certain angle given by the angle_sampler
function and multiplied by the step_size
value. The rotation is applied to the region between the two atoms, by travelling the Pose
Graph (See travel_graph
), by calculating and applying a rotation matrix (See rotation_matrix_from_axis_angle
). Note that a new angle for the crankshaft movement is sampled for each selected pair of Atom
instances. If an AbstractSelection
selection
is provided, only the selected Atom
instances are looped over. If an AbstractSelection
selection
is provided, only the selected Atom
instances are looped over. If the given AbstractSelection
selection
is not of selection type Atom
, it will be promoted to this type (using promote
with default aggregator any
). If an AbstractSelection
inc_last_res
is provided, all atoms in this AbstractSelection
and in the last residue considered for the crankshaft movement will be included in the rotation. As an example, for a correct crankshaft movement in peptidic structures, the sidechain of the last residue should also be included in the rotation. In this example, inc_last_res
should be !(an"^CA$|^N$|^C$|^H$|^O$"r)
. Note that the CrankshaftMutator
syncs any pending internal to cartesian coordinate conversion (using the i2c!
method). Requests cartesian to internal coordinates conversion (using request_c2i!
method). Does not sync!
the given Pose
afterwards.
The CrankshaftMutator
AbstractMutator
can also be optionally called using the following signature, in which case only the provided list of Atom
instances will be considered for the application of this AbstractMutator
.
(crankshaft_mutator::CrankshaftMutator)(pose::Pose, atoms::Vector{Atom})
Fields
angle_sampler::Function
- Should return aFloat
angle value (in radians). Is called with no input arguments;p_mut::AbtractFloat
- Compared against arand()
call, applies this Mutator toAtom
instance pairs whererand() < p_mut
;step_size::AbstractFloat
- Multiplies the sampled angle by this value;selection::Opt{AbstractSelection}
- If given, this Mutator will only loop over the selectedAtom
instances;inc_last_res::Opt{AbstractSelection}
- If given, all atoms in this Mutator and in the last residue considered for the crankshaft movement will be included in the rotation.
See also
Examples
julia> ProtoSyn.Mutators.CrankshaftMutator(randn, 1.0, 1.0, nothing, nothing)
⚯ Crankshaft Mutator:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | angle_sampler | Function randn |
| 2 | p_mut | 1.0000 |
| 3 | step_size | 1.0000 |
+----------------------------------------------------------------------+
○ Selection: Not Set
○ Include on last residue: Not Set
julia> ProtoSyn.Mutators.CrankshaftMutator(randn, 0.01, 1.0, an"CA", !(an"^CA$|^N$|^C$|^H$|^O$"r))
⚯ Crankshaft Mutator:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | angle_sampler | Function randn |
| 2 | p_mut | 0.0100 |
| 3 | step_size | 1.0000 |
+----------------------------------------------------------------------+
● Selection: Set
└── FieldSelection › Atom.name = CA
● Include on last residue: Set
└── UnarySelection ❯ ! "not" (Atom)
└── FieldSelection › Atom.name = r"^CA$|^N$|^C$|^H$|^O$"
Figure 1 | A schematic representation of a CrankshaftMutator
instance. In this example, the selection an"CA"
selects only pairs of carbon alpha Atom
instances. For each pair of Atom
instances possible, a random number (obtained by calling rand()
) is compared against the CrankshaftMutator
.p_mut
field. If the random number is lower, the current Atom
instance pair is selected for a crankshaft movement. A high value for p_mut
therefore translates into a higher number of crankshaft rotations in a single call to the CrankshaftMutator
. As a general rule, using a p_mut
value of 2/N(N-1)
will result in 1 rotation per call of the CrankshaftMutator
, on average (where N
is the number of atoms in the Pose
or number of selected atoms by selection
). A crankshaft movement is a concerted rotation of all Atom
instances in the Graph between the two selected Atom
instances, around an axis formed between the two selected Atom
instances. The angle of the rotation is calculates from the CrankshaftMutator
.angle_sampler
call (with no input arguments), multiplied by CrankshaftMutator
.step_size
.