Skip to main content
Random Protein Mutation
License: Random Protein Sampling is open source and free for academic and commercial use under an MIT license. Please refer to the license for full terms.

This generator is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.


Go to Tool Page
evo-design/proto-language/proto_language/generator/random_protein_generator.py
View source
Protein sequence generator that introduces random amino acid mutations. This generator creates sequence diversity by randomly mutating masked positions in protein sequences. Amino acid selection is biased by the configured codon scheme, allowing simulation of library diversity achievable through degenerate codon synthesis. Optional amino-acid exclusions remove unwanted residues from the sampled mutation alphabet. The generator category is "mutation". When the assigned segment has a starting sequence (or an upstream optimizer stage has populated proposals), masking_strategy controls which positions are mutated on each call. When the segment has no starting sequence, the first sample() call fills each proposal with a fully random sequence of the segment’s length using the configured codon_scheme; subsequent calls then apply masking_strategy normally.

API Reference

ConfigRandomProteinGeneratorConfig Source
Configuration object for RandomProteinGenerator.This class defines configuration parameters for the random protein generator, which introduces random amino acid mutations at masked positions using codon scheme-biased sampling.
masking_strategy
MaskingStrategy
Controls which positions to mask for sampling. Default: random 30%.
codon_scheme
enum
default:"UNIFORM"
Codon scheme for amino acid sampling probabilities.Options: UNIFORM, NNN, NNK, NNS, NDT, DBK, NRT
excluded_amino_acids
array
Residues to remove after codon-scheme handling (e.g. [‘C’] to forbid cysteine).

Usage

python
>>> from proto_language.generator import RandomProteinGenerator, RandomProteinGeneratorConfig
>>> from proto_language.core import Segment
>>> from proto_tools.transforms.masking import MaskingStrategy
>>> config = RandomProteinGeneratorConfig(
...     masking_strategy=MaskingStrategy(num_mutations=2),
...     excluded_amino_acids=["C"],
... )
>>> gen = RandomProteinGenerator(config)
>>> segment = Segment(length=100, sequence_type="protein")
>>> gen.assign(segment)
>>> gen.sample()  # First call: random init (no starting sequence)
>>> gen.sample()  # Second call onward: 2 non-cysteine mutations

Metadata

PropertyValue
Keyrandom-protein
ClassRandomProteinGenerator
Categorymutation
Input Typestarting_sequence
Uses GPUFalse
Supported Sequence Typesprotein
Allows Empty StartTrue