{"id":45454602,"url":"https://github.com/kavrakilab/ape-gen","last_synced_at":"2026-02-22T06:03:02.122Z","repository":{"id":89785718,"uuid":"172581382","full_name":"KavrakiLab/APE-Gen","owner":"KavrakiLab","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-22T22:16:11.000Z","size":19932,"stargazers_count":4,"open_issues_count":4,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-10-26T07:12:58.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KavrakiLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-25T20:41:46.000Z","updated_at":"2023-10-12T04:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4a9b940-4ab5-4680-bcf0-afb90328c12d","html_url":"https://github.com/KavrakiLab/APE-Gen","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/KavrakiLab/APE-Gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KavrakiLab%2FAPE-Gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KavrakiLab%2FAPE-Gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KavrakiLab%2FAPE-Gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KavrakiLab%2FAPE-Gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KavrakiLab","download_url":"https://codeload.github.com/KavrakiLab/APE-Gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KavrakiLab%2FAPE-Gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29705842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T05:59:28.568Z","status":"ssl_error","status_checked_at":"2026-02-22T05:58:46.208Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-22T06:03:01.272Z","updated_at":"2026-02-22T06:03:02.113Z","avatar_url":"https://github.com/KavrakiLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# APE-Gen: Anchored Peptide-MHC Ensemble Generator\n\n## Description:\n\n- APE-Gen is a tool that generates multiple clash-free conformations of a peptide bound to an MHC\n\n- All that is required for input is the sequence of the peptide and the MHC allotype name (if supported)\n\n- Minimal example: `python APE_Gen.py QFKDNVILL HLA-A*24:02`\n\n- For a peptide with \"n\" residues, APE-Gen will use a template of another peptide with \"n\" residues to place the anchor residues in the correct pocket of the MHC\n  - to change the template, modify `n-mer-templates.txt` for the corresponding n-mer, then add the template pdb file (peptide and MHC) to the `templates/` folder\n\n- A receptor model is also needed to run APE-Gen\n  - if the allotype of the MHC is supported (found in `receptor-class-templates.txt`), then simply specify the name as input into APE-Gen\n  - if the allotype is not supported, but one has the PDB file of the receptor\n    - place the PDB file inside the `templates/` folder\n    - modify `receptor-class-templates.txt` with an appropriate name\n    - then call APE-Gen with the chosen name\n  - One way to obtain a model of the receptor is to use the provided scripts in `modeller_scripts/` for homology modelling (see below)\n\n- PDB File preparation:\n  - For PDB files to be used as input anywhere in the script, the chains must be labelled in a particular way\n  - chain A is the heavy alpha chain, chain B is the light beta-immunoglobulin chain, chain C is the peptide\n\n- Specifying receptor degrees-of-freedom\n  - modify `flex_res.txt` to add/remove residues that are allowed to be flexible during the SMINA minimization step\n\n- `dunbrack.bin` and `loco.score` are files required for the RCD step\n- `align.py` is required for using PYMOL for alignment of PDB files\n- `minimize.py` is needed for further minimization using OpenMM\n\n\n## Output\n\n- Each round of APE-Gen is saved within a folder with the index of the round (counting from 0)\n\n- `full_system_confs/` contains the ensemble of conformations of peptide and MHC after energy refinement and filtering\n  - each conformation is named by the index of the loop as generated by RCD\n    - not every conformation makes it past the energy refinement and filtering step\n- `peptide_confs.pdb` contains only the peptide conformations\n- `filtered_energies.npz` is a numpy file that contains the energies of the ensemble according to the SMINA scoring function\n  - it contains two arrays of the same size: `filtered_indices` which contains indices of each conformation and `filtered_energies` which contains the corresponding energies\n\n\n## Helper scripts\n\n- `get_pMHC_pdb.py`\n  - usage: `python get_pMHC_pdb.py \u003cpdb code\u003e`\n  - assumes pdb code is of a peptide-MHC structure\n  - adds missing atoms/residues, removes all waters and ions, labels chains as A,B,C where chain C is the peptide\n\n- `mutate.py`\n  - Usage: `~/pymol/bin/pymol -qc mutate.py \u003cpdb\u003e \u003cselection\u003e \u003cnew_residue in 3-letter code\u003e \u003cname of new pdb file\u003e`\n  - example: `~/pymol/bin/pymol -qc mutate.py 0.pdb C/1/ ALA 0_mutated.pdb`\n\n## Options help:\n\n```\nusage: APE_Gen.py [-h] [-n NUM_CORES] [-l NUM_LOOPS] [-t RCD_DIST_TOL] [-r]\n                  [-d] [-p] [-a ANCHOR_TOL] [-o] [-g NUM_ROUNDS]\n                  [-b {receptor_only,pep_and_recept}] [-s] [--use_gpu]\n                  [--no_progress] [--clean_rcd]\n                  peptide_input receptor_class\n\nAnchored Peptide-MHC Ensemble Generator\n\npositional arguments:\n  peptide_input         Sequence of peptide to dock or pdbfile of crystal\n                        structure\n  receptor_class        Class descriptor of MHC receptor. Use REDOCK along\n                        with crystal input to perform redocking. Or pass a PDB\n                        file with receptor\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -n NUM_CORES, --num_cores NUM_CORES\n                        Number of cores to use for RCD and smina computations.\n                        (default: 8)\n  -l NUM_LOOPS, --num_loops NUM_LOOPS\n                        Number of loops to generate with RCD. (Note that the\n                        final number of sampled conformations may be less due\n                        to steric clashes. (default: 100)\n  -t RCD_DIST_TOL, --RCD_dist_tol RCD_DIST_TOL\n                        RCD tolerance (in angstroms) of inner residues when\n                        performing IK (default: 1.0)\n  -r, --rigid_receptor  Disable sampling of receptor degrees of freedom\n                        specified in flex_res.txt (default: False)\n  -d, --debug           Print extra information for debugging (default: False)\n  -p, --save_only_pep_confs\n                        Disable saving full conformations (peptide and MHC)\n                        (default: False)\n  -a ANCHOR_TOL, --anchor_tol ANCHOR_TOL\n                        Anchor tolerance (in angstroms) of first and last\n                        backbone atoms of peptide when filtering (default:\n                        2.0)\n  -o, --score_with_openmm\n                        Rescore full conformations with openmm (AMBER)\n                        (default: False)\n  -g NUM_ROUNDS, --num_rounds NUM_ROUNDS\n                        Number of rounds to perform. (default: 1)\n  -b {receptor_only,pep_and_recept}, --pass_type {receptor_only,pep_and_recept}\n                        When using multiple rounds, pass best scoring\n                        conformation across different rounds (choose either\n                        'receptor_only' or 'pep_and_recept') (default:\n                        receptor_only)\n  -s, --min_with_smina  Minimize with SMINA instead of the default Vinardo\n                        (default: False)\n  --use_gpu             Use GPU for OpenMM Minimization step (default: False)\n  --no_progress         Do not print progress bar (default: False)\n  --clean_rcd           Remove RCD folder at the end of each round (default:\n                        False)\n```\n\n\n## Installation instructions:\n\n1) install miniconda \n  - https://conda.io/miniconda.html\n\n2) using conda, install the following\n  - `conda install -c bioconda smina`\n  - `conda install -c omnia pdbfixer`\n  - `conda install -c conda-forge mdtraj`\n  - `conda install -c schrodinger pymol`\n  - `conda install -c bioconda autodock-vina`\n  - `conda install -c omnia -c conda-forge openmm`\n\n3) install RCD (v1.40)\n  - http://chaconlab.org/modeling/rcd/rcd-download\n  - make sure RCD is added to path so that `rcd` is a command in the terminal\n  - intel mkl may be needed (`conda install -c intel mkl`) and added to library path\n\n\n## Using Modeller script\n\n```\nusage: model_receptor.py [-h] [-n NUM_MODELS] alpha_chain_seq template\n\nHomology Modeling of HLAs using Modeller\n\npositional arguments:\n  alpha_chain_seq       Fasta file (.fasta) containing the sequence of the\n                        alpha chain of HLA or name of HLA allele (ex.\n                        HLA-A*02:01). If allele name given, the program will\n                        try to download the sequence from EMBL-EBI.\n  template              PDB of the template HLA or name of HLA allele (ex.\n                        HLA-A*02:01). If allele name given, a template based\n                        on the allele's supertype (as defined in\n                        supertype_templates.csv) will be chosen.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -n NUM_MODELS, --num_models NUM_MODELS\n                        Number of models to sample with Modeller (default: 10)\n```\n\n- Requires Modeller, Biopython, and BeautifulSoup4\n  - `conda install -c salilab modeller`\n  - `conda install -c conda-forge biopython`\n  - `conda install -c anaconda beautifulsoup4`\n  - `conda install -c anaconda requests`\n- Model with the best DOPE score is found in `best_model.pdb`\n- Example: `python model_receptor.py P01892.fasta 3I6L.pdb`\n  - Requires license key\n  - models HLA-A*02:01 using 3I6L as a template\n    - 3I6L contains a model of HLA-A*24:02\n- Even simpler example: `python model_receptor.py HLA-A*02:01 HLA-A*02:01`\n  - First argument says that the sequence of `HLA-A*02:01` will be downloaded\n  - Second argument says that a template PDB will be downloaded based on a representative allele from the same supertype classification\n\n## Instructions to run Minimal Example with Docker\n\n- Open a Terminal\n- Pull image from Docker hub: `docker pull jayab867/apegen:v2.0`\n- Go to the directory where you would like the APE-Gen results to be saved\n- Create a container that links the current working directory to a directory in the container called `/data`\n  - `docker run -it --rm -v $(pwd):/data --workdir \"/data\" jayab867/apegen:v2.0`\n- Run APE-Gen: `python /APE-Gen/APE_Gen.py QFKDNVILL HLA-A*24:02`\n- Exit the container with Ctrl-D\n- There will be a number of folders which contain the results for each round of APE-Gen \n  - Default is one round: so a single folder in this example called `0/`\n  - In each folder:\n    - The best scoring conformation for each round is called `min_energy_system.pdb` \n    - The whole ensemble generated is located in `full_system_confs/`\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavrakilab%2Fape-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavrakilab%2Fape-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavrakilab%2Fape-gen/lists"}