{"slug": "protuna-optuna-but-for-proteins", "title": "Protuna: Optuna but for Proteins", "summary": "Protuna, an open-source Python optimization framework for iterative protein engineering, was released as a pip-installable package requiring Python 3.12 or higher, proposing the next batch of protein variants to test from historical mutagenesis data or a single starting hit. Protuna steers protein language models toward design objectives through Feynman–Kac steering, classifier guidance and beam search, and offers Ray-based distributed streaming APIs for large-scale screening on local accelerators or clusters. A companion protuna-skills plugin supplies AI coding agents with guidance and examples to build optimization pipelines, configure distributed inference and extend the framework with custom components.", "body_md": "Protuna is an optimization framework for iterative protein engineering campaigns. Starting from historical mutagenesis data or a single hit<sup>[1](#user-content-fn-1-60b0acc5927aaaf4bf10ce825e4d1177)</sup>, it proposes the batch of variants to test next.\n\n- **Guided generation:** Steer protein language models towards your design objectives with reward-guided generation – Feynman–Kac steering, classifier guidance, and beam search.\n- **Scalable screening:** Ray-based distributed streaming APIs for large-scale screening on local accelerators or clusters.\n- **Modular campaigns:** Combine interchangeable samplers, predictors, constraints, and acquisition strategies.\n- **Multiple design goals:** Optimize for multiple properties with a primary objective and inequality constraints on the others.\n\nProtuna requires Python 3.12 or higher.\n\n```\npip install protuna\n```\n\nThe `protuna-skills` plugin gives AI coding agents the guidance and examples needed\nto work with Protuna. Use it to build, and run optimization pipelines,\nconfigure distributed inference, or extend the framework with custom components.\n\nSee the [plugin guide](https://github.com/kumarshreshtha/protuna/blob/main/protuna-skills/README.md) for installation instructions for\ncoding and science agents.\n\nThe following code builds and runs a simple `Pipeline`.\n\nIt starts by defining which mutations are allowed and how to sample narrower search spaces. The pipeline then samples random protein sequences in those subspaces, uses a multiple sequence alignment (MSA) to score them based on amino acid frequencies at the mutated sites, and selects up to 20 of the highest-scoring sequences.\n\n``` python\nfrom protuna import data\nfrom protuna import optim\nfrom protuna.optim import acquisitions\nfrom protuna.optim import predictors\nfrom protuna.optim import rules\nfrom protuna.optim import samplers\nfrom protuna.optim import spaces\n\ndataset = data.get_dataset(\"gb1\", source=data.DatasetSource.FLIP)\ntokens = data.tokenizer.encode(dataset.target_sequence)\nmsa = data.TokenizedMSA.from_file(\n    dataset.get_msa_path(data.MSAProtocol.ColabFold), format=\"a3m\"\n)\ndesign_space = spaces.DesignSpace.from_rules(\n    rules=[\n        # Positions are illustrative and use zero-based indexing.\n        rules.AllowOnly(positions=list(range(100, 125))),\n        rules.DenyResidues(amino_acids=[\"C\"]),\n        rules.FixSites(positions=[105, 120]),\n        # Protect sites where the query residue is >= 95% conserved.\n        rules.MSAConserved(tokenized_msa=msa, threshold=0.95),\n    ],\n    init_sequences=[tokens],\n    # Explore up to 4 subspaces, each with at most 3 mutable sites.\n    space_sampler=spaces.RandomMaskSampler(max_mutations=3, n_subspaces=4),\n)\npipeline = optim.Pipeline(\n    design_space=design_space,\n    sampler=samplers.RandomSampler(max_samples=100),  # Propose up to 4x100 variants\n    objective=predictors.PSSMZeroshotPredictor(tokens, msa, laplace_smoothing=True),\n    acquisition=acquisitions.Greedy(budget=20),\n)\noutput = pipeline.run()\n# Up to 20 sequences\ncandidates = data.tokenizer.decode(list(output.selection.token_ids))\n```\n\nSee the [pipeline documentation](https://protuna.readthedocs.io/en/latest/concepts/pipeline.html) for configuration options or read the [concepts overview](https://protuna.readthedocs.io/en/latest/concepts/overview.html) to understand Protuna's workflow and core primitives.\n\nProtuna stores cached downloads and default pipeline artifacts under `$PROTUNA_HOME/protuna`. If `PROTUNA_HOME` is unset, it uses `$XDG_CACHE_HOME/protuna`, falling back to `$HOME/.cache/protuna`.\n\nYou can configure pipeline runs to store artifacts in another folder or directly in cloud storage (AWS, Azure, or GCP) to support large exploration campaigns.\n\nProtuna separates candidate generation from experimental batch selection. A `Pipeline` combines four steps:\n\n1. **Defining the search region.** A`DesignSpace` holds starting sequences and their allowed substitutions and can sample smaller search spaces for independent exploration.\n2. **Generating proposals.** A`Sampler` proposes sequences within each search space.\n3. **Evaluating proposals.** A`Predictor` estimates the objective property. Hard constraints reject candidates; soft constraints provide feasibility probabilities.\n4. **Selecting candidates.** An`Acquisition` selects candidates within your budget, using criteria such as predicted fitness, uncertainty, or diversity.\n\nSelection is limited to the candidates proposed by the sampler. Protein language models provide a useful prior over plausible sequences, but their likelihoods need not align with a campaign’s objective. Protuna supports reward-guided generation to steer exploration towards desired properties, using inference-time steering, externally aligned generators, or both.\n\nOptional recycling uses promising candidates as parents for the next generation cycle, allowing subsequent cycles to build on promising mutations.\n\nRead the [optimization overview](https://protuna.readthedocs.io/en/latest/concepts/overview.html) for the broader campaign workflow. To extend Protuna, see the guides for custom [model adapters](https://protuna.readthedocs.io/en/latest/guides/writing_adapters.html), [samplers](https://protuna.readthedocs.io/en/latest/guides/writing_samplers.html), and [acquisitions](https://protuna.readthedocs.io/en/latest/guides/writing_acquisitions.html).\n\n| Module | Description | \n|---|---|\n| [protuna.optim](https://protuna.readthedocs.io/en/latest/api/optim/index.html) | The primary optimization framework. It contains all the primitives needed to set up and run your protein optimization task. | \n| [protuna.inference](https://protuna.readthedocs.io/en/latest/api/inference/index.html) | Distributed inference interface and a few illustrative model adapters. | \n| [protuna.data](https://protuna.readthedocs.io/en/latest/api/data/index.html) | Common preprocessed public benchmark datasets, MSA handling, and tokenization modules. | \n| [protuna.score](https://protuna.readthedocs.io/en/latest/api/score/index.html) | Functional library of protein scoring methods such as zero-shot variant effect prediction (VEP) and contact prediction using a categorical Jacobian. | \n| protuna.train (coming soon) | Future releases will include trainers and recipes for few-shot property prediction models, fine-tuning, and preference alignment of generators. | \n\nSee the [roadmap for upcoming releases](https://protuna.readthedocs.io/en/latest/upcoming.html).\n\nSee [CONTRIBUTING.md](https://github.com/kumarshreshtha/protuna/blob/main/CONTRIBUTING.md).\n\nIf you use Protuna in your research, please cite this software:\n\n```\n@software{protuna2026,\n    title = {{Protuna: An optimization framework for AI-guided protein engineering}},\n    author = {Shreshtha, Kumar},\n    url = {https://github.com/kumarshreshtha/protuna},\n    year = {2026},\n    version = {0.1.0}\n}\n```\n\n## Footnotes\n\n1. \nSuccessfully generating candidates from a single data point depends on how well your goals, the zero-shot proxies you use for scoring, and the sampler's likelihoods align. [↩](#user-content-fnref-1-60b0acc5927aaaf4bf10ce825e4d1177)", "url": "https://wpnews.pro/news/protuna-optuna-but-for-proteins", "canonical_source": "https://github.com/kumarshreshtha/protuna", "published_at": "2026-11-01 10:39:23+00:00", "updated_at": "2026-11-01 10:49:59.975699+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "ai-tools", "developer-tools"], "entities": ["Protuna", "Optuna", "Ray", "Python 3.12", "protuna-skills", "kumarshreshtha"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/protuna-optuna-but-for-proteins", "markdown": "https://wpnews.pro/news/protuna-optuna-but-for-proteins.md", "text": "https://wpnews.pro/news/protuna-optuna-but-for-proteins.txt", "jsonld": "https://wpnews.pro/news/protuna-optuna-but-for-proteins.jsonld"}}