Dihedral Mutator
A DihedralMutator
instance changes a Pose
State
by introducing one or more dihedral rotations.
ProtoSyn.Mutators.DihedralMutator
— TypeDihedralMutator(angle_sampler::Function, p_mut::AbstractFloat, step_size::AbstractFloat, selection::Opt{AbstractSelection})
Return a new DihedralMutator
instance. This AbstractMutator
is a functor, called with the following signature:
(dihedral_mutator::DihedralMutator)(pose::Pose)
The DihedralMutator
AbstractMutator
loops through all the Atom
instances in a given Pose
and applies a new dihedral angle if a random number (rand()
) is bellow a given probability of mutation p_mut
(therefore a higher p_mut
value applies a larger number of dihedral rotations per call). The applied rotation is an angle value (in radians), sampled by calling angle_sampler
and multiplied by the step_size
value. The resulting value is then added to the selected Atom
.Δϕ
. Note that a new dihedral rotation is sampled for each selected Atom
instance. 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
). Note that the DihedralMutator
syncs any pending cartesian to internal coordinate conversion (using the c2i!
method). Requests internal to cartesian coordinates conversion (using request_i2c!
method). Does not sync!
the given Pose
afterwards.
The DihedralMutator
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
.
(dihedral_mutator::DihedralMutator)(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
instances 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.
See also
Examples
julia> ProtoSyn.Mutators.DihedralMutator(randn, 1.0, 1.0, nothing)
⚯ Dihedral Mutator:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | angle_sampler | Function randn |
| 2 | p_mut | 1.0000 |
| 3 | step_size | 1.0000 |
+----------------------------------------------------------------------+
○ Selection: Not Set
julia> ProtoSyn.Mutators.DihedralMutator(randn, 0.05, 1.0, an"CA$|C$"r)
⚯ Dihedral Mutator:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | angle_sampler | Function randn |
| 2 | p_mut | 0.0500 |
| 3 | step_size | 1.0000 |
+----------------------------------------------------------------------+
● Selection: Set
└── FieldSelection › Atom.name = r"CA$|C$"
Figure 1 | A schematic representation of a DihedralMutator
instance. In this example, the selection
an"C$"r
selects only the carbon atoms of the backbone of the peptide, excluding the alpha carbons. The :Δϕ
field in this AtomState
instance applies a given dihedral rotation to all children Atom
instances, therefore setting, in this case, the psi
dihedral angle of the backbone of this Residue
. As such, by providing the DihedralMutator
with this selection
, only the psi
dihedral angles are being sampled for rotation. Each of the selected Atom
instances is looped over and one or more instances can be designated for dihedral angle sampling. This is performed by comparing a random number (by calling rand()
) against the DihedralMutator
.p_mut
field, for each of the looped Atom
instances. If the random number is lower, the current Atom
instance is selected. A high value for p_mut
therefore translates into a higher number of dihedral rotations in a single call to the DihedralMutator
. As a general rule, using a p_mut
value of 1/N
will result in 1 rotation per call of the DihedralMutator
, on average (where N
is the number of atoms in the Pose
or number of selected atoms by selection
). To sample a new dihedral angle, the DihedralMutator
angle_sampler
is called (with no input arguments) and multiplied by the DihedralMutator
.step_size
field. This value is added to the selected AtomState
.Δϕ
.