### Setup MixTCRpred Environment in Google Colab Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This snippet prepares the Google Colab environment by cloning the MixTCRpred repository, installing necessary Python packages (wget, pytorch_lightning), and navigating into the project directory. This setup is required to run the notebook's examples. ```python #Run this cell if using Google COLAB #clone the repository and the data to run the notebook on Google Colab !git clone https://github.com/GfellerLab/MixTCRpred !pip install wget >> /dev/null !pip install pytorch_lightning >> /dev/null %cd MixTCRpred ``` -------------------------------- ### Test MixTCRpred Installation with Help Command Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Runs the MixTCRpred script with the '--help' flag to display usage instructions and confirm successful installation. ```Bash python MixTCRpred.py --help ``` -------------------------------- ### Install Python Dependencies for MixTCRpred Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Upgrades pip and installs all required Python packages listed in 'requirements.txt' for MixTCRpred. ```Bash pip install --upgrade pip pip install -r requirements.txt ``` -------------------------------- ### Load Example Input TCRs Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This Python code loads the 'test.csv' file, which contains example paired TCRs in the required input format for MixTCRpred, into a pandas DataFrame. This serves as a sample dataset for running predictions. ```python input_tcrs = pd.read_csv("./test/test.csv") input_tcrs ``` -------------------------------- ### MixTCRpred Command Line Arguments API Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Documents the required and optional command-line arguments for the MixTCRpred script, including their purpose, format, and examples. ```APIDOC Arguments: --model, -m [MixTCRpred_model_name] Description: The format is HLA_PeptideSequence (e.g. A0201_GILGFVFTL). --input, -i [input_TCR_file] Description: CSV file listing all the TCRs to test. See ./test/test.cvs for a reference input file. The columns order is not important. CDR3 alpha and beta should not be longer than 20 amino acids. Incomplete TCR entries are accepted, but the models will have lower predictive performance. --output, -o [output_file] Description: The name of the output file. It contains two extra columns than the input file: the MixTCRpred binding score and the %rank. Optional Arguments: --list_models Description: To list the 146 MixTCRpred models for which we can currently run predictions. Models with less than 50 training TCRs have low confidence. --batch_size Description: The default batch size for testing is 1. If you have a large dataset of TCRs to test, increasing the batch_size can speed MixTCRpred up. --download model_name Description: To download a specific pretrained MixTCRpred model. --download_all Description: To download the 146 pretrained MixTCRpred models. --download_high Description: To download the 43 high-confidence pretrained MixTCRpred models. ``` -------------------------------- ### Download All MixTCRpred Pretrained Models Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Downloads all 146 available pretrained MixTCRpred models. ```Bash python MixTCRpred.py --download_all ``` -------------------------------- ### Basic MixTCRpred Command Line Usage Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Shows the fundamental command structure for running MixTCRpred, requiring model name, input file, and output file. ```Bash python MixTCRpred.py --model [MixTCRpred_model_name] --input [input_TCR_file] --output [output_file] ``` -------------------------------- ### Download Specific MixTCRpred Pretrained Model Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Downloads a specified pretrained MixTCRpred model (e.g., A0201_NLVPMVATV) from the Zenodo dataset. ```Bash python MixTCRpred.py --download A0201_NLVPMVATV ``` -------------------------------- ### Clone MixTCRpred GitHub Repository Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Clones the MixTCRpred repository from GitHub to your local machine and navigates into the project directory. ```Bash git clone https://github.com/GfellerLab/MixTCRpred cd MixTCRpred ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Creates a Python virtual environment named 'MixTCRpred_venv' and activates it for Unix/Mac OS users. This isolates project dependencies. ```Bash python -m venv MixTCRpred_venv source MixTCRpred_venv/bin/activate ``` -------------------------------- ### Download High-Confidence MixTCRpred Models Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Downloads the 43 high-confidence pretrained MixTCRpred models (those with more than 50 training TCRs). ```Bash python MixTCRpred.py --download_high ``` -------------------------------- ### List Available MixTCRpred Models Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Executes the MixTCRpred script with '--list_models' to display all currently available prediction models. ```Bash python MixTCRpred.py --list_models ``` -------------------------------- ### Run MixTCRpred with Downloaded Model Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This command-line snippet executes MixTCRpred using a newly downloaded pre-trained model (e.g., for HLA-A*02:01, YLQPRTFLL) to predict TCR binding for the input TCRs and store results in a new output file. ```python !python MixTCRpred.py --model A0201_YLQPRTFLL --input ./test/test.csv --output ./test/out_A0201_YLQPRTFLL.csv ``` -------------------------------- ### Download MixTCRpred Pre-trained Model Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This command-line snippet downloads a specific MixTCRpred pre-trained model (e.g., for HLA-A*02:01, YLQPRTFLL) that is not stored on GitHub. This step is necessary before making predictions with a new pMHC model. ```python !python MixTCRpred.py --download A0201_YLQPRTFLL ``` -------------------------------- ### Load MixTCRpred Pre-trained Models Information Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This Python code loads the 'info_models.csv' file into a pandas DataFrame. This file contains essential information about the available MixTCRpred pre-trained models, which can be used for various pMHC targets. ```python import pandas as pd import wget import os df_info = pd.read_csv("./pretrained_models/info_models.csv") df_info ``` -------------------------------- ### Run MixTCRpred for TCR Prediction Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Demonstrates how to run MixTCRpred to predict TCRs targeting a specific epitope (HLA-A*02:01, GILGFVFTL) using an input CSV file and saving results to an output CSV. ```Bash python MixTCRpred.py --model A0201_GILGFVFTL --input ./test/test.csv --output ./test/output.csv ``` -------------------------------- ### Run MixTCRpred for TCR-pMHC Prediction Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This command-line snippet executes the MixTCRpred script to predict TCR binding for a specific pMHC (e.g., HLA-A*02:01 GILGFVFTL). It requires a model name, an input TCR list, and an output file path. The leading '!' allows execution in a notebook environment. ```python !python MixTCRpred.py --model A0201_GILGFVFTL --input ./test/test.csv --output ./test/out_A0201_GILGFVFTL.csv ``` -------------------------------- ### Create Permanent Alias for MixTCRpred Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Creates a shell alias for MixTCRpred, making it executable from any directory using the Python version from the virtual environment. This alias can be made permanent by adding it to your .bashrc file. ```Bash alias MixTCRpred='/home/[...]/MixTCRpred/MixTCRpred_venv/bin/python /home/[...]/MixTCRpred/MixTCRpred.py' ``` -------------------------------- ### Configure Absolute Path for Pretrained Models Source: https://github.com/gfellerlab/mixtcrpred/blob/main/README.md Modifies the 'path_pretrained_models' variable in 'MixTCRpred.py' to use an absolute path, allowing the script to be run from any directory. ```Python #change path_pretrained_models = './pretrained_models' #to path_pretrained_models = '/home/[...]/MixTCRpred/pretrained_models' ``` -------------------------------- ### Load Second MixTCRpred Prediction Results Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This Python code loads the prediction results from the second specified output CSV file (e.g., './test/out_A0201_YLQPRTFLL.csv') into a pandas DataFrame for analysis, similar to the previous prediction results. ```python results_LLW = pd.read_csv("./test/out_A0201_YLQPRTFLL.csv", comment = '#') results_LLW ``` -------------------------------- ### Load MixTCRpred Prediction Results Source: https://github.com/gfellerlab/mixtcrpred/blob/main/colab_MixTCRpred.ipynb This Python code loads the prediction results from the specified output CSV file (e.g., './test/out_A0201_GILGFVFTL.csv') into a pandas DataFrame for analysis. The results are sorted from the most probable binder to the least probable binder. ```python results_GIL = pd.read_csv("./test/out_A0201_GILGFVFTL.csv", comment = '#') results_GIL ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.