Peptide Designer ================ Let's walk through how to use Peptide Designer to generate peptides that bind to a selected target protein. The workflow follows three stages: creating a project from an input structure, configuring design constraints and submitting the job, then inspecting and downloading the ranked results. :: peptide_designer = molcube.create_peptide_designer_project() Step 1. Create a Project ------------------------ The input structure can come from one of four sources: * a completed PDB Reader project (most common — see :doc:`pdbreader`) * an RCSB PDB ID * an AlphaFold UniProt ID * a local structure file List available PDB Reader projects ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`search_pdb_reader_projects() ` to print completed PDB Reader projects that can be used as Peptide Designer inputs:: >>> peptide_designer.search_pdb_reader_projects() [ { "title": "my_pdbreader_project", "pk": "your-pdb-reader-project-id", "forcefieldType": "amberff" } ] The most useful fields are: * ``title``: project title * ``pk``: project ID to pass into the creation method below * ``forcefieldType``: force field used by the source PDB Reader project Create from a PDB Reader project ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If the structure has already been prepared in PDB Reader, create the Peptide Designer project from its project ID:: pdb_reader_project_id = "your-pdb-reader-project-id" assert peptide_designer.create_project_from_pdb_reader( title="peptide_designer_demo", pdb_reader_project_id=pdb_reader_project_id, workspace="personal", ) This is the most common route when the target structure has already been cleaned or edited in MolCube. Create from an RCSB PDB ID ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`create_project_from_rcsb() ` to fetch a structure directly from RCSB:: assert peptide_designer.create_project_from_rcsb( title="peptide_designer_demo", pdb_id="2hac", workspace="personal", ) Create from an AlphaFold structure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`create_project_from_alphafold() ` with a UniProt ID:: assert peptide_designer.create_project_from_alphafold( title="peptide_designer_demo", uniprot_id="A0A1Y0CER9", workspace="personal", ) Create from a local structure file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`create_project_from_file() ` to upload a local ``.pdb``, ``.cif``, ``.gro``, or ``.gz`` file (max 50 MB):: assert peptide_designer.create_project_from_file( title="peptide_designer_demo", file_path="/absolute/path/to/input.pdb", workspace="personal", ) Create from a Boltz-2 / Protenix prediction ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`create_project_from_prediction() ` to load the target directly from a finished Boltz-2 or Protenix prediction project. The predicted ``.cif`` is converted to PDB by the backend, so no separate download/upload is needed:: assert peptide_designer.create_project_from_prediction( title="peptide_designer_demo", boltz_project_id="your-boltz-or-protenix-project-id", workspace="personal", ) Design program ^^^^^^^^^^^^^^ Every ``create_project_from_*`` method accepts an optional ``program`` argument that selects the design engine (default: ``rfdiffusion``): * ``"rfdiffusion"`` *(default)*: RFdiffusion → ProteinMPNN → Boltz-2 pipeline. * ``"boltzgen"``: BoltzGen peptide binder design. :: from molcube.peptide_designer import PeptideProgram assert peptide_designer.create_project_from_rcsb( title="peptide_designer_demo", pdb_id="2hac", program=PeptideProgram.BOLTZGEN, # or the string "boltzgen" ) .. note:: ``pdb_id`` (RCSB) and ``uniprot_id`` (AlphaFold) are format-validated before the request is sent — an invalid PDB ID (not 4 characters) or UniProt accession (not 6/10 characters) raises ``ValueError``. Inspect the Input Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^^ After Step 1 finishes, inspect the target structure before selecting hotspot residues. Use :py:meth:`get_chain_sequence() ` to print the available protein chains in a layout that mirrors the Step 2 frontend view:: >>> peptide_designer.get_chain_sequence() [PROT_A] -3-7: DSKLCYLLDG 8-17: ILFIYGVILT 18-27: ALFLRVKFSR 28-30: SAD [PROT_B] -3-7: DSKLCYLLDG 8-17: ILFIYGVILT 18-27: ALFLRVKFSR 28-30: SAD The output is grouped by chain, and each line spans ``chunk_size`` residues (default: ``10``). The line labels use the original residue numbers from the PDB. Only ``PROTEIN`` chains are shown by default. Use the chain names and residue numbers shown here to compose hotspot labels in the next step. Step 2. Configure Design Constraints ------------------------------------- Once the target structure is understood, configure the constraints that will be sent in the Step 2 request. Choose hotspot residues ^^^^^^^^^^^^^^^^^^^^^^^^ Hotspot residues identify the target binding site that guides peptide generation. Set them with :py:meth:`set_hotspot_residues() `:: peptide_designer.set_hotspot_residues(["A-1", "A1", "A2", "A3"]) Each hotspot label is a single-letter chain ID followed immediately by a residue number, with no separator (e.g. ``"A35"`` = chain A, residue 35). Negative residue numbers are also accepted when the input structure uses them. Rules enforced by the client: * at least one hotspot residue must be provided * duplicates are removed automatically * all hotspot residues must belong to the same chain * the selected chain must be a ``PROTEIN`` chain in the input structure * all residue numbers must exist in the selected chain Preview the input structure in 3D ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`show_3d_structure() ` to preview the input protein with hotspot highlighting:: peptide_designer.show_3d_structure(protein_style="cartoon") On Step 2, this method renders the input structure and highlights the currently selected hotspot residues. The most useful Step 2 options are: * ``protein_style``: ``"cartoon"`` (default), ``"stick"``, ``"line"``, or ``"surface"`` * ``protein_color``: optional custom hex color * ``hotspot_style``: how hotspot residues are highlighted — ``"cartoon"`` (default), ``"stick"``, or ``"line"`` * ``enable_surface``: whether to add a VDW surface over hotspot residues (default: ``True``) * ``surface_opacity``: hotspot surface opacity between 0 and 1 (default: ``0.7``) * ``show_label``: whether to show numeric labels above hotspot residues (default: ``True``) Set the peptide length range ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`set_peptide_length_range() ` to define the peptide length range:: peptide_designer.set_peptide_length_range( minimum_length=12, maximum_length=18, ) Set additional generation options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`set_generation_options() ` to configure the main generation parameters. For ``rfdiffusion``:: peptide_designer.set_generation_options( use_cyclic_peptide=False, number_of_backbone_structures=1, number_of_sequences_per_backbone=5, number_of_predictions=1, excluded_amino_acids=["CYS", "TRP"], ) For ``boltzgen``:: peptide_designer.set_generation_options( use_cyclic_peptide=False, number_of_backbone_structures=1, number_of_predictions=1, excluded_amino_acids=["CYS", "TRP"], budget=10, ) All arguments are optional and have defaults. Program-specific parameters raise ``ValueError`` when passed for the wrong program: * ``use_cyclic_peptide`` (bool): generate cyclic peptides (default: ``False``) * ``number_of_backbone_structures`` (int): number of backbone structures to generate (default: ``1``). Maximum ``10`` for ``rfdiffusion``; no upper limit for ``boltzgen``. * ``number_of_sequences_per_backbone`` (int): number of sequences to sample per backbone (default: ``5``). ``rfdiffusion`` only — raises ``ValueError`` when the design program is ``boltzgen``. * ``number_of_predictions`` (int): number of predicted structures per sequence (default: ``1``) * ``excluded_amino_acids`` (list[str]): three-letter amino acid codes to exclude from generation (default: ``[]``) * ``budget`` (int): number of designs in the final optimized set (default: ``10``). ``boltzgen`` only — raises ``ValueError`` when the design program is ``rfdiffusion``. Submit Step 2 ^^^^^^^^^^^^^ Submit the design job with :py:meth:`submit_project() `:: assert peptide_designer.submit_project() The method submits the design request, waits for task completion, and returns ``True`` on success. Cancel a running job with :py:meth:`stop_project() `:: peptide_designer.stop_project() Step 3. Inspect the Results ---------------------------- After the job finishes, inspect the ranked design outputs. Retrieve the result summary ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`get_result_summary() ` to retrieve confidence metrics for all ranked designs:: >>> peptide_designer.get_result_summary() RANK SEQUENCE SCORE ipTM plDDT ipSAE pDockQ2 rank01 LLGLLVLLLVVLLIAAE 0.823 0.661 0.863 0.25 0.701 rank02 LLLVAILLLLILLLLAE 0.69 0.249 0.801 0.017 0.074 rank03 LLLLAILGLLVALLKAE 0.644 0.15 0.768 0.012 0.033 rank04 LLLVALLLLLILLILAQ 0.644 0.139 0.77 0.014 0.027 rank05 LLLLAILLGLVLLLLAE 0.633 0.134 0.757 0.015 0.026 Results are sorted by ``SCORE`` in descending order. The fields are: * ``RANK``: result rank label * ``SEQUENCE``: designed peptide amino acid sequence * ``SCORE``: overall confidence score (higher is better) * ``ipTM``: interface predicted TM-score * ``plDDT``: complex pLDDT score * ``ipSAE``: interface score average error * ``pDockQ2``: docking quality score Inspect the result structure in 3D ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`show_3d_structure() ` to render a ranked result structure:: peptide_designer.show_3d_structure( rank=1, apply="A", protein_style="stick", nearby_residue_sticks=True, ) On Step 3, this method renders the selected result structure instead of the input structure. Useful Step 3 options: * ``rank``: result rank number to render (required for Step 3) * ``apply``: which chain(s) receive ``protein_style``; accepts a single-letter chain ID (``"A"``, ``"B"``), a segment name (``"PROT_A"``), or ``"all"`` * ``protein_style``: ``"cartoon"`` (default), ``"stick"``, ``"line"``, or ``"surface"`` * ``nearby_residue_sticks``: show receptor interface residues as sticks (default: ``True``) Download Outputs ----------------- After the job completes, ``peptide_designer.title`` holds the project title set in Step 1. Download the full project archive ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`download_project() ` to save the full project archive. The file is saved as ``{title}.tar.gz`` in the current directory:: peptide_designer.download_project() Download a subset of result PDB files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use :py:meth:`download_selected_pdbs() ` to bundle selected result PDBs into a ``.tar.gz`` file. The file is saved as ``{title}_selected_pdbs.tar.gz``:: peptide_designer.download_selected_pdbs(exclude_ranks=[1]) If ``exclude_ranks`` is omitted, all available result ranks are included. Each value in ``exclude_ranks`` must be an integer that exists in the result PDB list; passing a rank that was not generated raises ``ValueError``.