{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Library: Custom Species" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By default, `TCRconvert` supports alpha-beta and gamma-delta V, D, J, and C genes for human, mouse, and rhesus macaque from the IMGT F+ORF+in-frame P references. For other species, follow these steps:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Create a folder of IMGT FASTA files\n", "\n", "The simplest way is to download from [IMGT](https://www.imgt.org/vquest/refseqh.html).\n", "\n", "**Details:**\n", "\n", "`TCRconvert` expects a folder containing files ending in `.fasta` or `.fa` with headers in the IMGT format:\n", "\n", "```\n", ">SomeText|TRBV10-1*02|MoreText|...\n", "```\n", "\n", "The sequences are not used, so a text file containing headers and ending in `.fa` would also work." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Run `build_lookup_from_fastas()`\n", "\n", "The `species` parameter should be the species name you'll use when calling `convert_gene()`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import tcrconvert\n", "import os\n", "\n", "# Using our example directory of fasta files\n", "fastadir = tcrconvert.get_example_path('fasta_dir')\n", "\n", "# Build lookup tables and note where they're being written to\n", "new_lookup_dir = tcrconvert.build_lookup_from_fastas(fastadir, species='rabbit')\n", "new_lookup_dir" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Confirm they exist there:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "os.listdir(new_lookup_dir)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Details:**\n", "\n", "`species` will also be the name of the folder storing lookup tables, so these characters are not allowed:\n", "\n", "`` / \\ : * ? \" < > | ~ ` \\n \\t``" ] } ], "metadata": { "kernelspec": { "display_name": "tcrconvert", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.5" } }, "nbformat": 4, "nbformat_minor": 2 }