---
name: phi-redesign
description: "Redesign a protein sequence on its structure with ProteinMPNN, PottsMPNN, ESM-IF1 or Proton-PottsMPNN on Dyno Phi, keeping the residues that must stay, and check the designs by refolding them; or score the person's own sequences on a backbone; or read what the model would put at every position. Use when a person has a structure and wants new sequences for it or for part of it, wants sequences scored on a backbone, or asks about inverse folding, sequence recovery, native fit or certainty. The tools are phi_load_target, set_hotspots, select_patch and phi_submit_job."
license: MIT
access: general
metadata:
  author: dynotx
  version: "1.2"
  updated: "2026-10-18"
  models: "PROTEINMPNN POTTSMPNN ESM_IF1 PROTON_POTTSMPNN ESMFOLD"
  prompt: "true"
---

# Redesign a sequence on its structure

Use this skill when the person has a structure and wants new sequences for it or for a part of it, or wants sequences scored against a backbone.

## What Phi offers

Four inverse folding models, each a job at the same price:

| Job type | Modes | What it returns per sequence |
|---|---|---|
| `PROTEINMPNN` (the default) | design, score, probs | `score` and `global_score` (negative log-likelihoods, lower is better) and `seq_recovery` |
| `POTTSMPNN` | design, score, probs | the same rows plus a Potts energy; weights chosen by `checkpoint` |
| `ESM_IF1` | design, score, one chain at a time | `score`, its negated average log-likelihood over the designed chain, and `global_score` over the residues with coordinates |
| `PROTON_POTTSMPNN` | design only, the binder chain alone | a chain designed for a pH switch, with Potts and selective energies; takes `num_designs` and `temperature` |

Design mode returns per-sequence numbers. Probs mode returns a distribution per residue.

## Before you start

- The structure: a PDB id, a UniProt id, a URL or a file, loaded with `phi_load_target`. The lab shows author numbering; the model counts positions from 1 along each chain, and the lab converts.
- Which chains are designed and which are kept. A chain the model sees but does not design is fixed whole. Keep a partner chain in the file when an interface matters, because the model sees only what it is given.

## Steps

1. Settle what to redesign. The whole chain is the default. For a part, name the residues in author numbering with `set_hotspots`, a patch around a landmark with `select_patch`, or a region from `get_features`. Everything not named is fixed. In the lab, one click keeps the interface contacts with a partner chain.
2. Settle the count and the temperature, and say which purpose they serve. Phi's defaults are 4 sequences at 0.0001 on jobs and 0.1 on runs. A few sequences check a backbone; tens explore it. 0.1 stays close to the backbone's preferences, and 0.2 to 0.3 wanders.
3. Submit through the lab, or through `phi_submit_job` with `dry_run: true` first and then on the person's yes. The request carries `pdb_gcs_uri`, `binder_chain_id` and `target_chain_id` (or `designed_chain_ids`), `pdb_path_chains`, `fixed_positions` as `{chain: [positions]}`, `num_seq_per_target`, `sampling_temp`, `model_name` (`v_48_020_soluble` by default) and `omit_AAs` (`C` by default). A structure with insertion codes must be renumbered from 1 per chain before the model sees it; the lab's upload does this.
4. Read the designs: `sequence_by_chain`, `score`, `global_score` and `seq_recovery` (the share of residues kept). No source states a threshold on any of them, and recovery does not predict function.
5. Check by refolding: one `ESMFOLD` job per design for the designed chain alone (Phi's ESMFold folds one chain; the kept chains stay the input's) gives per-residue pLDDT, and the lab overlays the refold on the input for its RMSD. Whether a redesigned binder still binds is a second question for a co-folding model (`ESMFOLD2`, `ALPHAFOLD`, `BOLTZ2`). Say that geometry admits a design and confidence only orders a shortlist.

To score the person's own sequences instead, use `mode: "score"` with `sequences` as the full complex, chains in alphabetical order joined with `/`; the lab's Score mode writes this.

To see what the model would put at every position, use `mode: "probs"` on `PROTEINMPNN` or `POTTSMPNN` with one backbone, and optionally one `sequences` entry to score a substituted sequence. It writes `per_residue.json`: for each residue the 21-letter distribution given the backbone and every other residue, `fit` (the log probability of the residue present, at most 0, higher fits better), `certainty` (1 minus the entropy over ln 21), and the mean fit as `score`. The lab runs this by itself when a structure loads, caches it, and shows Native fit and Certainty on the structure and under the sequence, with a 21-letter row per residue where a click substitutes.

## Rules

- Never submit without the dry run and the person's yes.
- Never rank by an ESM log-likelihood, and never let one gate a design in either direction.
- Do not invent a threshold on score, global score, recovery, refold RMSD, fit or certainty. Say that none is set.
- Treat a low fit as a residue to look at. ProteinMPNN is a weak zero-shot fitness scorer (ProteinGym Spearman 0.258), so a low fit does not show that the residue is wrong.
- Keep the partner chain in the file when an interface matters.
