Skip to main content

Parameters

mutation_bias
Dict[str, float]
default:"lambda: mutation_bias_no_cystein()"
n_mutations
int
default:"1"
exclude_self
bool
default:"True"

Methods

one_step

Abstract method for performing a single mutation step. Parameters
system
System
required
The system to be mutated
Returns
return
System
The mutated system (new copy) MutationRecord Record of all mutations performed in this step

choose_chain

Choose one of the chains in the whole System that needs to be mutated. This is done by selecting a chain Parameters
system
System
required

mutate_random_residue

Mutate a random residue on a chain. Parameters
chain
Chain
required
The chain to mutate.
Returns
return
Mutation
The mutation performed. This includes the chain_id, the move_type, the residue_index, the old_amino_acid, and the new_amino_acid.

replay

Replay a mutation record on a system, reusing existing mutation logic. Parameters
system
System
required
The system to apply mutations to
mutation_record
MutationRecord
required
Record of mutations to replay
Returns
return
System
System with mutations applied

Example

import bagel as bg

class AlwaysSubstitute(bg.mutation.MutationProtocol):
    def one_step(self, system: bg.System) -> tuple[bg.System, bg.mutation.MutationRecord]:
        mutated = system.__copy__()
        chain = self.choose_chain(mutated)
        mutation = self.mutate_random_residue(chain)
        return mutated, bg.mutation.MutationRecord(mutations=[mutation])