Skip to main content
Random Protein Mutation
License: Random Protein Sampling is open source and free for academic and commercial use under an Apache-2.0 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
proto-bio/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. 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

Usage

python
>>> from proto_language.generator import RandomProteinGenerator, RandomProteinGeneratorConfig
>>> from proto_language.core import Segment
>>> config = RandomProteinGeneratorConfig(
...     masking_strategy=MaskingStrategy(num_mutations=2),
... )
>>> 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 random amino acid mutations

Metadata

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