### Install ImmuneBuilder via PyPI Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Installs the ImmuneBuilder package using pip after all dependencies are met. This command should be run within an environment where PyTorch, OpenMM, and pdbfixer are already installed. ```bash pip install ImmuneBuilder ``` -------------------------------- ### FASTA File Format Examples Source: https://context7.com/oxpig/immunebuilder/llms.txt Illustrates the FASTA file format for antibodies (H and L chains), nanobodies (H chain only), and TCRs (A and B chains). Shows how to load sequences programmatically. ```python # Example FASTA for antibody (H and L chains) """ >H EVQLVESGGGVVQPGGSLRLSCAASGFTFNSYGMHWVRQAPGKGLEWVAFIRYDGGNKYYADSVKGRFTISRDNSKNTLYLQMKSLRAEDTAVYYCANLKDSRYSGSYYDYWGQGTLVTVS >L VIWMTQSPSSLSASVGDRVTITCQASQDIRFYLNWYQQKPGKAPKLLISDASNMETGVPSRFSGSGSGTDFTFTISSLQPEDIATYYCQQYDNLPFTFGPGTKVDFK """ # Example FASTA for nanobody (H chain only) """ >H QVQLVESGGGLVQPGESLRLSCAASGSIFGIYAVHWFRMAPGKEREFTAGFGSHGSTNYAASVKGRFTMSRDNAKNTTYLQMNSLKPADTAVYYCHALIKNELGFLDYWGPGTQVTVSS """ # Example FASTA for TCR (A and B chains) """ >A AQSVTQLGSHVSVSEGALVLLRCNYSSSVPPYLFWYVQYPNQGLQLLLKYTSAATLVKGINGFEAEFKKSETSFHLTKPSAHMSDAAEYFCAVSEQDDKIIFGKGTRLHILP >B ADVTQTPRNRITKTGKRIMLECSQTKGHDRMYWYRQDPGLGLRLIYYSFDVKDINKGEISDGYSVSRQAQAKFSLSLESAIPNQTALYFCATSDESYGYTFGSGTRLTVV """ # Load sequences from FASTA file programmatically from ImmuneBuilder.util import sequence_dict_from_fasta sequences = sequence_dict_from_fasta("my_protein.fasta") # Returns: {'H': 'EVQLVE...', 'L': 'VIWMTQ...'} for antibodies ``` -------------------------------- ### Install OpenMM and pdbfixer with Conda Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Installs OpenMM and pdbfixer using the conda package manager. These are required for the refinement step in ImmuneBuilder. ```bash conda install -c conda-forge openmm pdbfixer ``` -------------------------------- ### Install Dependencies for ImmuneBuilder Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Installs necessary libraries including ImmuneBuilder, py3Dmol, ANARCI, and OpenMM. This script also sets up Conda and ensures the correct Python version is used. ```bash #@title Install dependencies %%capture %%bash -s $python_version #@markdown This script will download and install the ImmuneBuilder code, ANARCI and OpenMM PYTHON_VERSION=$1 set -e if [ ! -f CODE_READY ]; then # install dependencies pip install ImmuneBuilder 2>&1 1>/dev/null pip install py3Dmol 2>&1 1>/dev/null touch CODE_READY fi # setup conda if [ ! -f CONDA_READY ]; then wget -qnc https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local 2>&1 1>/dev/null rm Miniconda3-latest-Linux-x86_64.sh touch CONDA_READY fi # setup openmm for amber refinement if [ ! -f AMBER_READY ]; then conda install -y -q -c conda-forge openmm=7.7.0 python="${PYTHON_VERSION}" pdbfixer 2>&1 1>/dev/null touch AMBER_READY fi # setup anarci if [ ! -f ANARCI_READY ]; then conda install -y -q anarci hmmer biopython -c bioconda --no-deps --solver=classic 2>&1 1>/dev/null touch ANARCI_READY fi ``` -------------------------------- ### TCRBuilder2 Command Line Usage Source: https://context7.com/oxpig/immunebuilder/llms.txt Provides examples for using the TCRBuilder2 command-line interface for predicting TCR structures from FASTA files or explicit sequences, with options for using original weights and saving ensemble models. ```bash # Command line usage (uses TCRBuilder2+ by default) TCRBuilder2 --fasta_file my_tcr.fasta -v # With explicit sequences TCRBuilder2 -A "AQSVTQLGSHVSV..." -B "ADVTQTPRNRITK..." -o tcr.pdb # Use original TCRBuilder2 weights TCRBuilder2 --fasta_file my_tcr.fasta --original_weights -o tcr.pdb # Save all ensemble models TCRBuilder2 --fasta_file my_tcr.fasta --to_directory -o tcr_output/ ``` -------------------------------- ### Install ANARCI with Conda Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Installs ANARCI using the bioconda channel. ANARCI is used for trimming and numbering sequences. ```bash conda install -c bioconda anarci ``` -------------------------------- ### Resolving GLIBCXX_3.4.30 Not Found Error Source: https://github.com/oxpig/immunebuilder/blob/main/README.md If you encounter an 'Import Error: `GLIBCXX_3.4.30' not found', it indicates an issue with OpenMM's libstdc++. Install `libstdcxx-ng` from conda-forge to resolve this. ```bash conda install -c conda-forge libstdcxx-ng ``` -------------------------------- ### Display ABodyBuilder2 Help Information Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Shows the available command-line options and usage instructions for the ABodyBuilder2 tool. ```bash ABodyBuilder2 --help ``` -------------------------------- ### Command Line Usage for NanoBodyBuilder2 Source: https://context7.com/oxpig/immunebuilder/llms.txt Use NanoBodyBuilder2 from the command line with a FASTA file or an explicit heavy chain sequence. Options include specifying the output file and enabling faster prediction by skipping sidechain bond checks. ```bash # Command line usage NanoBodyBuilder2 --fasta_file my_nanobody.fasta -v # With explicit sequence NanoBodyBuilder2 -H "QVQLVESGGGLVQPGESLRLSCAAS..." -o nanobody.pdb # Faster prediction without sidechain bond check NanoBodyBuilder2 --fasta_file my_nanobody.fasta -u -o nanobody.pdb ``` -------------------------------- ### Command Line Usage for ABodyBuilder2 Source: https://context7.com/oxpig/immunebuilder/llms.txt Execute ABodyBuilder2 from the command line using a FASTA file or explicit sequences for antibody structure prediction. Options include specifying output files, directories, and numbering schemes. ```bash # Command line usage ABodyBuilder2 --fasta_file my_antibody.fasta -v # With explicit sequences ABodyBuilder2 -H "EVQLVESGGG..." -L "VIWMTQSPSS..." -o output.pdb # Save all models to directory ABodyBuilder2 --fasta_file my_antibody.fasta --to_directory -o output_dir/ # Use different numbering scheme ABodyBuilder2 --fasta_file my_antibody.fasta -n chothia -v ``` -------------------------------- ### Input Immune Protein Sequences and Filename Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Configure the type of immune protein to model and provide the relevant amino acid sequences. Ensure sequences are free of whitespace. Specify the desired output PDB filename. ```python #@title Input chain sequence(s), then hit `Runtime` -> `Run all` import sys python_version = f"{sys.version_info.major}.{sys.version_info.minor}" #@markdown Select what type of immune protein you are modelling protein_type = "Antibody" #@param ["Antibody", "Nanobody","TCR"] #@markdown Insert the sequence for the variable domain. If modelling a Nanobody, only use one of the fields sequence_1 = 'VKLLEQSGAEVKKPGASVKVSCKASGYSFTSYGLHWVRQAPGQRLEWMGWISAGTGNTKYSQKFRGRVTFTRDTSATTAYMGLSSLRPEDTAVYYCARDQAGYTGGKSEFDYWGQGTLVTVSS' #@param {type:"string"} sequence_2 = 'ELVMTQSPSSLSASVGDRVNIACRASQGISSALAWYQQKPGKAPRLLIYDASNLESGVPSRFSGSGSGTDFTLTISSLQPEDFAIYYCQQFNSYPLTFGGGTKVEIKRTV' #@param {type:"string"} # remove whitespaces sequence_1 = "".join(sequence_1.split()) sequence_2 = "".join(sequence_2.split()) #@markdown Insert the output file name filename = 'ImmuneBuilder_model.pdb' #@param {type:"string"} ``` -------------------------------- ### Predict Nanobody Structure via Command Line Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Performs nanobody structure prediction using the NanoBodyBuilder2 command-line tool. Input is provided via a FASTA file. ```bash NanoBodyBuilder2 --fasta_file my_nanobody.fasta -v ``` -------------------------------- ### Predict Antibody Structure with ABodyBuilder2 Source: https://context7.com/oxpig/immunebuilder/llms.txt Initialize ABodyBuilder2 with specified ensemble models and numbering scheme. Provide heavy and light chain sequences to predict the 3D structure and save it to a PDB file. Optionally save all ensemble models and refined structures to a directory with error estimates. ```python from ImmuneBuilder import ABodyBuilder2 # Initialize the predictor (loads 4 ensemble models) predictor = ABodyBuilder2( model_ids=[1, 2, 3, 4], # Which ensemble models to use numbering_scheme='imgt' # Options: imgt, chothia, kabat, aho, wolfguy, martin, raw ) # Define antibody sequences (heavy and light chains) sequences = { 'H': 'EVQLVESGGGVVQPGGSLRLSCAASGFTFNSYGMHWVRQAPGKGLEWVAFIRYDGGNKYYADSVKGRFTISRDNSKNTLYLQMKSLRAEDTAVYYCANLKDSRYSGSYYDYWGQGTLVTVS', 'L': 'VIWMTQSPSSLSASVGDRVTITCQASQDIRFYLNWYQQKPGKAPKLLISDASNMETGVPSRFSGSGSGTDFTFTISSLQPEDIATYYCQQYDNLPFTFGPGTKVDFK' } # Predict structure - returns an Antibody object antibody = predictor.predict(sequences) # Save refined structure to PDB file # Includes error estimates as B-factors antibody.save("my_antibody.pdb") # Save all ensemble models and final refined structure to directory antibody.save_all( dirname="antibody_output", filename="final_model.pdb", check_for_strained_bonds=True, n_threads=-1 # Use all available CPU threads ) # Access prediction data print(f"Model ranking: {antibody.ranking}") # Models ranked by agreement print(f"Error estimates shape: {antibody.error_estimates.shape}") ``` -------------------------------- ### Predict Nanobody Structure with NanoBodyBuilder2 Source: https://context7.com/oxpig/immunebuilder/llms.txt Initialize NanoBodyBuilder2 and provide the heavy chain sequence to predict the nanobody structure. The predicted structure can be saved to a PDB file or all ensemble predictions can be saved to a directory. ```python from ImmuneBuilder import NanoBodyBuilder2 # Initialize predictor predictor = NanoBodyBuilder2( model_ids=[1, 2, 3, 4], numbering_scheme='imgt' ) # Nanobodies only have a heavy chain sequence = { 'H': 'QVQLVESGGGLVQPGESLRLSCAASGSIFGIYAVHWFRMAPGKEREFTAGFGSHGSTNYAASVKGRFTMSRDNAKNTTYLQMNSLKPADTAVYYCHALIKNELGFLDYWGPGTQVTVSS' } # Predict and save nanobody = predictor.predict(sequence) nanobody.save("my_nanobody.pdb") # Save all ensemble predictions nanobody.save_all( dirname="nanobody_output", check_for_strained_bonds=True ) ``` -------------------------------- ### Predict Antibody Structure via Command Line Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Executes antibody structure prediction using the ABodyBuilder2 command-line interface. Requires a FASTA file containing the antibody sequences as input. ```bash ABodyBuilder2 --fasta_file my_antibody.fasta -v ``` -------------------------------- ### Batch Process Multiple Antibodies with ImmuneBuilder Source: https://context7.com/oxpig/immunebuilder/llms.txt Demonstrates efficient batch processing of multiple antibody sequences using ImmuneBuilder. Initializes the predictor once to load models into memory and reuses it for predicting each antibody in a list. Includes error handling for prediction failures. ```python from ImmuneBuilder import ABodyBuilder2 import os # Initialize once - loads models into memory predictor = ABodyBuilder2() # List of antibodies to predict antibodies = [ {'H': 'EVQLVESGGG...', 'L': 'VIWMTQSPSS...'}, {'H': 'QVQLQQSGAE...', 'L': 'DIQMTQSPSS...'}, {'H': 'EVQLLESGGG...', 'L': 'EIVLTQSPAT...'}, ] # Process each antibody os.makedirs("predictions", exist_ok=True) for i, sequences in enumerate(antibodies): try: antibody = predictor.predict(sequences) antibody.save(f"predictions/antibody_{i}.pdb") print(f"Predicted antibody {i}") except AssertionError as e: print(f"Failed antibody {i}: {e}") ``` -------------------------------- ### Download ImmuneBuilder Model Weights Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Loads the appropriate deep learning model (ABodyBuilder2, NanoBodyBuilder2, or TCRBuilder2) based on the selected protein type. This step is necessary before structure prediction. ```python #@title Download the model weights %%capture #@markdown This will take a few seconds the first time if f"/usr/local/lib/python{python_version}/site-packages/" not in sys.path: sys.path.insert(0, f"/usr/local/lib/python{python_version}/site-packages/") from ImmuneBuilder import ABodyBuilder2, NanoBodyBuilder2, TCRBuilder2 if protein_type == "Antibody": predictor = ABodyBuilder2() elif protein_type == "Nanobody": predictor = NanoBodyBuilder2() elif protein_type == "TCR": predictor = TCRBuilder2() ``` -------------------------------- ### Initialize TCRBuilder2 for T-Cell Receptor Structure Prediction Source: https://context7.com/oxpig/immunebuilder/llms.txt Initialize TCRBuilder2, optionally using TCRBuilder2+ weights for improved accuracy. Specify ensemble model IDs and the numbering scheme. ```python from ImmuneBuilder import TCRBuilder2 # Initialize with TCRBuilder2+ weights (default) predictor = TCRBuilder2( model_ids=[1, 2, 3, 4], numbering_scheme='imgt', use_TCRBuilder2_PLUS_weights=True # Use improved TCRBuilder2+ model ) ``` -------------------------------- ### Predict TCR Structure via Command Line Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Initiates TCR structure prediction using the TCRBuilder2 command-line interface. Requires a FASTA file containing the TCR sequences. ```bash TCRBuilder2 --fasta_file my_tcr.fasta -v ``` -------------------------------- ### Refine PDB Structure with OpenMM Source: https://context7.com/oxpig/immunebuilder/llms.txt Refines a PDB structure using OpenMM and the AMBER14 force field. Options include checking for strained bonds, setting refinement attempts, iterations, and CPU threads. ```python from ImmuneBuilder.refine import refine # Refine a PDB structure success = refine( input_file="unrefined.pdb", output_file="refined.pdb", check_for_strained_bonds=True, # Check/fix strained sidechain bonds tries=3, # Number of refinement attempts n=6, # Refinement iterations per attempt n_threads=-1 # CPU threads (-1 for all available) ) if success: print("Refinement successful") else: print("Refinement failed - structure saved anyway") ``` -------------------------------- ### Control Refinement During Prediction Saving Source: https://context7.com/oxpig/immunebuilder/llms.txt Demonstrates how to control refinement options when saving predicted protein structures. Allows for faster output by skipping sidechain bond checking. ```python from ImmuneBuilder import ABodyBuilder2 predictor = ABodyBuilder2() antibody = predictor.predict(sequences) # Save with custom refinement options antibody.save( filename="my_antibody.pdb", check_for_strained_bonds=True, # Slower but more accurate n_threads=4 # Limit CPU threads ) # Skip sidechain bond checking for faster output antibody.save( filename="my_antibody_fast.pdb", check_for_strained_bonds=False ) ``` -------------------------------- ### Download Predicted Structure Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Provides a mechanism to download the predicted structure file. Includes a note about potential adblocker interference and an alternative manual download method. ```python from google.colab import files files.download(filename) ``` -------------------------------- ### Fasta Formatting for ImmuneBuilder Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Format your sequence data in FASTA format with specific chain labels for heavy (H) and light (L) chains. For TCRs, use A for alpha and B for beta chains. Nanobodies require only a heavy chain labeled H. ```plaintext >H YOURHEAVYCHAINSEQUENCE >L YOURLIGHCHAINSEQUENCE ``` -------------------------------- ### Process Input Sequences Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Processes input sequences to identify and map them to their respective chains. Handles potential KeyErrors if a sequence is missing. ```python _, chain1 = number(sequence_1) _, chain2 = number(sequence_2) input = dict() if chain1: input[chain1] = sequence_1 if chain2: input[chain2] = sequence_2 try: predictor.predict(input).save(filename) except KeyError as e: print(f"ERROR: Missing sequence for chain {str(e)}") ``` -------------------------------- ### Predict Antibody Structure with Python API Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Uses the ABodyBuilder2 class from the ImmuneBuilder library to predict the structure of an antibody. Requires a dictionary of heavy ('H') and light ('L') chain sequences. The predicted structure is saved to a PDB file. ```python from ImmuneBuilder import ABodyBuilder2 predictor = ABodyBuilder2() output_file = "my_antibody.pdb" sequences = { 'H': 'EVQLVESGGGVVQPGGSLRLSCAASGFTFNSYGMHWVRQAPGKGLEWVAFIRYDGGNKYYADSVKGRFTISRDNSKNTLYLQMKSLRAEDTAVYYCANLKDSRYSGSYYDYWGQGTLVTVS', 'L': 'VIWMTQSPSSLSASVGDRVTITCQASQDIRFYLNWYQQKPGKAPKLLISDASNMETGVPSRFSGSGSGTDFTFTISSLQPEDIATYYCQQYDNLPFTFGPGTKVDFK'} antibody = predictor.predict(sequences) antibody.save(output_file) ``` -------------------------------- ### Visualize Prediction Results Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Visualizes the predicted protein structure using py3Dmol. Allows customization of coloring by predicted error, chain, or rainbow spectrum, and options to show sidechains and mainchains. ```python import py3Dmol colour_by = "predicted_error" #@param ["predicted_error", "chain", "rainbow"] show_sidechains = True #@param {type:"boolean"} show_mainchains = False #@param {type:"boolean"} view=py3Dmol.view() view.addModel(open(filename, 'r').read(),'pdb') view.zoomTo() view.setBackgroundColor('white') if colour_by == "chain": view.setStyle({'chain':'H'},{'cartoon': {'color':'purple'}}) view.setStyle({'chain':'L'},{'cartoon': {'color':'green'}}) elif colour_by == "rainbow": view.setStyle({'cartoon': {'color':'spectrum'}}) elif colour_by == "predicted_error": print("The error is calulated by comparing how much different models agree or disagree on the placement of each residue") view.setStyle({'cartoon': {'colorscheme': {'prop':'b','gradient': 'roygb','min':5,'max':0}}}) if show_sidechains: BB = ['C','O','N'] view.addStyle({'and':[{'resn':["GLY","PRO"],'invert':True},{'atom':BB,'invert':True}]}, {'stick':{'colorscheme':f"WhiteCarbon",'radius':0.3}}) view.addStyle({'and':[{'resn':"GLY"},{'atom':'CA'}]}, {'sphere':{'colorscheme':f"WhiteCarbon",'radius':0.3}}) view.addStyle({'and':[{'resn':"PRO"},{'atom':['C','O'],'invert':True}]}, {'stick':{'colorscheme':f"WhiteCarbon",'radius':0.3}}) if show_mainchains: BB = ['C','O','N','CA'] view.addStyle({'atom':BB},{'stick':{'colorscheme':f"WhiteCarbon",'radius':0.3}}) view.zoomTo() view.show() ``` -------------------------------- ### ImmuneBuilder Citation Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Cite this work using the provided BibTeX entry when using the code and data from the ImmuneBuilder package. ```tex @article{Abanades2023, author = {Abanades, Brennan and Wong, Wing Ki and Boyles, Fergus and Georges, Guy and Bujotzek, Alexander and Deane, Charlotte M.}, doi = {10.1038/s42003-023-04927-7}, issn = {2399-3642}, journal = {Communications Biology}, number = {1}, pages = {575}, title = {ImmuneBuilder: Deep-Learning models for predicting the structures of immune proteins}, volume = {6}, year = {2023} } ``` -------------------------------- ### Number Protein Sequences with ANARCI Source: https://context7.com/oxpig/immunebuilder/llms.txt Provides functions for numbering protein sequences using ANARCI, supporting multiple numbering schemes (imgt, chothia, kabat, etc.) and species filtering. Shows numbering for single and multiple sequences. ```python from ImmuneBuilder.sequence_checks import number_sequences, number_single_sequence # Number a single sequence numbered = number_single_sequence( sequence="EVQLVESGGGVVQPGGSLRLSCAASGFTFNSYGMH...", chain="H", # H, L, A, or B scheme="imgt", # Numbering scheme allowed_species=['human', 'mouse'] # Species filter ) # Returns: [((1, ' '), 'E'), ((2, ' '), 'V'), ...] # Number multiple sequences sequences = { 'H': 'EVQLVESGGG...', 'L': 'VIWMTQSPSS...' } numbered = number_sequences( seqs=sequences, scheme='chothia', # Options: imgt, chothia, kabat, aho, wolfguy, martin, raw allowed_species=['human', 'mouse'] ) # Available numbering schemes schemes = ['imgt', 'chothia', 'kabat', 'aho', 'wolfguy', 'martin', 'raw'] ``` -------------------------------- ### Predict Immune Protein Structure Source: https://github.com/oxpig/immunebuilder/blob/main/notebook/ImmuneBuilder.ipynb Initiates the structure prediction process using the loaded ImmuneBuilder model and the provided sequences. Requires ANARCI for numbering. ```python #@title Predict the structure from anarci import number ``` -------------------------------- ### TCRBuilder2+ Pre-print Citation Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Cite the TCRBuilder2+ pre-print using the provided BibTeX entry if you utilize its models or code. ```tex @article {Quast2024, author = {Quast, Nele P. and Abanades, Brennan and Guloglu, Bora and Karuppiah, Vijaykumar and Harper, Stephen and Raybould, Matthew I. J. and Deane, Charlotte M.}, title = {T-cell receptor structures and predictive models reveal comparable alpha and beta chain structural diversity despite differing genetic complexity}, year = {2024}, doi = {10.1101/2024.05.20.594940}, journal = {bioRxiv}, } ``` -------------------------------- ### Predict Nanobody Structure with Python API Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Utilizes the NanoBodyBuilder2 class to predict nanobody structures. Input is a dictionary containing the heavy chain sequence ('H'). The output is saved to a PDB file. ```python from ImmuneBuilder import NanoBodyBuilder2 predictor = NanoBodyBuilder2() output_file = "my_nanobody.pdb" sequence = {'H': 'QVQLVESGGGLVQPGESLRLSCAASGSIFGIYAVHWFRMAPGKEREFTAGFGSHGSTNYAASVKGRFTMSRDNAKNTTYLQMNSLKPADTAVYYCHALIKNELGFLDYWGPGTQVTVSS'} nanobody = predictor.predict(sequence) nanobody.save(output_file) ``` -------------------------------- ### Access and Save Antibody Error Estimates Source: https://context7.com/oxpig/immunebuilder/llms.txt Calculates and prints per-residue RMSD estimates from an antibody object. Saves the raw error estimates to a NumPy file and the antibody structure with error estimates as B-factors in a PDB file. ```python error_estimates = antibody.error_estimates.mean(0).sqrt().cpu().numpy() print(f"Per-residue RMSD estimates: {error_estimates}") print(f"Mean error: {np.mean(error_estimates):.2f} Angstroms") print(f"Max error: {np.max(error_estimates):.2f} Angstroms") # Model ranking (lower error = better) print(f"Best model index: {antibody.ranking[0]}") # Error estimates are saved as B-factors in PDB output # Can be visualized in molecular viewers (PyMOL, ChimeraX, etc.) antibody.save("antibody_with_errors.pdb") # Save error estimates separately np.save("error_estimates.npy", error_estimates) ``` -------------------------------- ### Predict TCR Structure with Python API Source: https://github.com/oxpig/immunebuilder/blob/main/README.md Employs the TCRBuilder2 class for predicting T-Cell Receptor structures. It accepts a dictionary containing the sequences for the 'A' and 'B' chains. The prediction is saved to a PDB file. ```python from ImmuneBuilder import TCRBuilder2 predictor = TCRBuilder2() output_file = "my_tcr.pdb" sequences = { "A": "AQSVTQLGSHVSVSEGALVLLRCNYSSSVPPYLFWYVQYPNQGLQLLLKYTSAATLVKGINGFEAEFKKSETSFHLTKPSAHMSDAAEYFCAVSEQDDKIIFGKGTRLHILP", "B": "ADVTQTPRNRITKTGKRIMLECSQTKGHDRMYWYRQDPGLGLRLIYYSFDVKDINKGEISDGYSVSRQAQAKFSLSLESAIPNQTALYFCATSDESYGYTFGSGTRLTVV"} tcr = predictor.predict(sequences) tcr.save(output_file) ``` -------------------------------- ### Predict and Save TCR Structure Source: https://context7.com/oxpig/immunebuilder/llms.txt Predicts the structure of TCR sequences (alpha and beta chains) and saves the result to a PDB file. Demonstrates using default and original TCRBuilder2 weights. ```python sequences = { "A": "AQSVTQLGSHVSVSEGALVLLRCNYSSSVPPYLFWYVQYPNQGLQLLLKYTSAATLVKGINGFEAEFKKSETSFHLTKPSAHMSDAAEYFCAVSEQDDKIIFGKGTRLHILP", "B": "ADVTQTPRNRITKTGKRIMLECSQTKGHDRMYWYRQDPGLGLRLIYYSFDVKDINKGEISDGYSVSRQAQAKFSLSLESAIPNQTALYFCATSDESYGYTFGSGTRLTVV" } # Predict structure tcr = predictor.predict(sequences) # Save to PDB file tcr.save("my_tcr.pdb") # Use original TCRBuilder2 weights instead predictor_original = TCRBuilder2(use_TCRBuilder2_PLUS_weights=False) tcr_original = predictor_original.predict(sequences) tcr_original.save("my_tcr_original.pdb") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.