Shiny application for T-cell receptor repertoire analysis and antigen annotation
2.5K
T cells are critical for immune responses, recognizing antigens via their unique T-cell receptors (TCRs). Analyzing the diverse TCR repertoires, especially the hypervariable CDR3 region, is essential for understanding immune function in health and disease. Current TCR analysis tools often require specialized expertise, computational resources, or sacrifice biological information for efficiency. To address these limitations, we developed TCRanalyzer, a fast and comprehensive TCR analysis pipeline within a user-friendly graphical interface. TCRanalyzer covers all steps from data loading, aggregation and optional sequence clustering, to the analysis of TCR diversity metrics, clonal expansion and antigen specificity. Applied to datasets from patients with either benign or malignant tumors, TCRanalyzer identified changes in TCR clonality, clonal expansion and shifts in antigen specificity across different cohorts or following immunotherapy, thereby demonstrating its potential to dissect critical immunological processes. TCRanalyzer provides a robust and user-friendly tool for TCR sequence analysis, enhancing research in immunology and related fields.
TCRanalyzer is available out-of-the-box as a Docker container (https://hub.docker.com/r/tcranalyzer/application), which may be started within a graphical environment (Docker Desktop) or from the command line.
Wait until the download is finished and that's it. You can now follow the [Quick start](#Quick start) guide below to start your first analysis in TCRanalyzer.
To use TCRanalyzer from the command line, make sure that Docker is installed (https://docs.docker.com/engine/install/).
Pull the TCRanalyzer Docker container from Docker Hub:
docker pull tcranalyzer/application:latest
Important: Before starting TCRanalyzer, always ensure your sample names follow the proper format (“PatIDSubsetXTx”) and that your sequencing data is stored in a folder structured as MyFolder/Data/studyname/. Please refer to our How to use your own data guide for more information.
1. Run "tcranalyzer/application" in Docker Desktop
2. Add "optional settings"
Start the container by mounting your desired directory into the directory /app/Data within the TCRanalyzer Docker container. This mounted volume becomes your working environment. Within it, a Data folder and a Results folder will be created automatically when you run the modules. You should place your sequencing data folder inside this working environment so that the modules can locate and process your data.
Below is an example command with explanations for each flag:
docker run -it --rm \
-p 3838:3838 \
-v /MyPath/MyFolder:/app/Data \
--name tcranalyzer \
tcranalyzer/application:latest
Explanation of flags:
-it
Runs the container in interactive mode with a TTY attached. It is useful for debugging with real‑time output.
--rm
Automatically removes the container when it exits.
-p 3838:3838
Maps port 3838 of the container to port 3838 on the host. This allows you to access the Shiny application through your browser using http://localhost:3838.
-v /MyPath/MyFolder:/app/Data
Mounts the host directory /MyPath/MyFolder into the container at /app/Data.
Note: This mounted volume is your working environment. You need to place your sequencing data folder inside this mounted volume so that the modules can find and process the data correctly. When the container starts, it will create a Data folder and a Results folder within /app/Data.
--name tcranalyzer
Assigns the name tcranalyzer to the container.
tcranalyzer/application:latest
Specifies the Docker image to use (with the latest tag). Make sure this image exists on your system or in your repository.
With this setup, after you start the container, your working environment is set up in /MyPath/MyFolder (mounted as /app/Data inside the container). The modules will create and populate the Data and Results folders within that directory based on your analysis workflows.
TCRanalyzer writes intermediate data, results, and module log files to the host directory mounted at /app/Data. This directory must therefore be writable by the container.
Do not add --user $(id -u):$(id -g) by default. Docker Desktop, standard rootful Docker, rootless Docker, and Docker installations using user-namespace remapping handle host and container user IDs differently. On rootless or user-namespace-remapped systems, explicitly passing the host UID/GID can map to subordinate IDs on the host and make generated files inaccessible to the host user.
Before starting TCRanalyzer, verify that the working directory is writable on the host. For Bash-compatible shells:
touch /MyPath/MyFolder/.tcranalyzer_write_test && \
rm /MyPath/MyFolder/.tcranalyzer_write_test
On a standard rootful Linux Docker installation, if the default command creates files owned by root on the host, you can instead run TCRanalyzer with your host UID and GID:
docker run -it --rm \
--user "$(id -u):$(id -g)" \
-e HOME=/tmp \
-p 3838:3838 \
-v /MyPath/MyFolder:/app/Data \
--name tcranalyzer \
tcranalyzer/application:latest
Do not use this --user form on rootless or user-namespace-remapped Docker installations unless it is recommended by your local administrator.
You can inspect Docker's UID/GID mapping with:
docker run --rm \
--entrypoint sh \
tcranalyzer/application:latest \
-c 'echo "UID map:"; cat /proc/self/uid_map; echo "GID map:"; cat /proc/self/gid_map'
If container UID 0 is already mapped to your host UID, as can occur with rootless Docker on HPC systems, use the default command without --user. Site-specific instructions supplied by an HPC or system administrator take precedence over these general examples.
Open http://localhost:3838 in your web browser
Note: By accessing "localhost" your data remains on your local computer and analyses are performed on your own system. It will not be forwarded to the internet.
The Load Study Files tab in TCRanalyzer lets you import your study data directly from a ZIP file into your working environment - no manual file copying or external uploads required. Here's how it works:
Study Name Assignment:
Enter a study name in the provided text field. This name becomes the folder name in your working environment. All data extracted from the ZIP file will be organized under this folder.
ZIP File Selection:
Use the file input to browse and select your ZIP file. The selected ZIP file contains your study's sequencing data. Importantly, the file is not uploaded to any remote server - it remains local and is only used to extract its contents into the container’s mounted volume.
Data Extraction:
When you click the "Extract Study Data" button, the application will unzip the file directly into your working environment (the mounted volume, typically found at /app/Data). During extraction, two folders are created automatically: one for raw data (Data) and one for analysis results (Results).
Local Working Environment:
The mounted volume serves as your working environment, where all study data is stored and processed. This approach ensures that your data stays on your local system (or in your designated workspace) and is immediately available for analysis by the container’s modules.
This feature streamlines the process of importing study data. Instead of manually copying and extracting files via your file browser, you simply select the ZIP file in the UI, and the data is automatically extracted into your working directory. This makes it easier and more efficient to update or import new data without leaving the TCRanalyzer interface.
That's it, TCRanalyzer does the rest. You can find a folder containing all generated results in the folder you provided in step 1.
Please read our Paper for a detailed description of the functionalities of each module
Note: Base Module 1 has to be run once for every new dataset before any analysis module can be started. Base Module 2 is optional and is only required if clustered TCR data should be used as input for Analysis Module 1 or 2.
In the Backup tab you can select specific folders and files from your working environment to create a ZIP archive. This ZIP file is generated and downloaded locally to your PC. Nothing is stored externally - sensitive data remains on your system.
File Selection:
Use the interactive folder tree to choose the folders and files you want to include in the backup.
Filename:
Enter your desired filename in the provided text field. The application will create a ZIP file with that name.
ZIP Creation:
Click the "Zip and Save Selected Data for a Backup" button. The selected data is compressed into a ZIP file, which is then downloaded directly to your PC.
By performing the backup locally, your data stays secure on your machine and is never transmitted over the web.
You can stop the app in Docker Desktop (Container -> Actions -> Stop)
= folder name containing your sequencing data
= All samples with a total CDR3 count <= cutoff will be removed from the dataset.
= Do you want to analyze unclustered ("No") or clustered CDR3 ("Yes")?
The Comparison setting defines whether the analysis compares different subsets or different timepoints within one subset. The fields shown in the interface depend on Compare Dynamics.
When Compare Dynamics = No:
These non-dynamics runs generate the static AM1 comparison outputs, including Simpson's Clonality, percentage of Singletons (PoS), and clone-overlap results.
Matched samples are paired by patient ID. Normality is assessed using the Shapiro–Wilk test, using paired differences for matched samples. Depending on normality and pairing, comparisons are performed using paired or Welch’s t-tests, or Wilcoxon signed-rank or rank-sum tests, respectively. If all paired differences are zero, the P-value is set to 1.
Set Compare Dynamics to Yes to run a dynamics-only comparison based on time intervals. Static timepoint comparison fields are hidden and are not used for the analysis, output directory, or filenames. Dynamics-only runs generate the clonal-expansion comparison outputs for Expanded Singletons (ES) and Expanded Non-Singletons (ENS).
You compare one time interval from Subset 1 with one time interval from Subset 2. The ordinary fixed Timepoint field is not used.
T0-T1).T0-T1).The two subsets may be compared over the same interval. For example, HCCtissue T0-T1 can be compared with HCCblood T0-T1.
You compare two different time intervals within one subset. The ordinary Timepoint 1 and Timepoint 2 fields are not used.
T0-T1).T1-T2).Dynamics-only run directories are identified by the selected subset(s) and intervals. They do not contain an unrelated fixed timepoint. For example:
Results/HCC/AM1/Subset__HCCtissue-vs-HCCblood__dynamics-T0-T1-vs-T0-T1__aggr/
T0-T1, not T0-T0).= Did you sequence CDR3 from TCR alpha ("TRA") or beta chain ("TRB")? Note: TCRanalyzer will select the compatible subset of CDR3 sequences in the CDR3-antigen database.
= Decides on the type of antigen annotation that should be analyzed (recommended: gene.exactly; see our ReadMe for details)
CDR3 sequences are aligned against the selected VDJdb TCR chain using MMseqs2. Only alignments with an E-value <= 0.05 are retained. The best alignment is selected by lowest E-value, followed by highest bit score and sequence identity. Antigen frequencies are calculated from clone counts relative to the total annotated clone count of each sample. An antigen absent from an otherwise annotated sample is assigned a frequency of zero.Samples without annotated clone counts remain missing.
This parameter determines which type of p-value is used in the volcano plot. You can choose between:
For comparative AM2 analyses, the volcano-plot x-axis shows the difference in mean antigen frequency between the two groups, calculated as Group 2 minus Group 1. For a Subset comparison this corresponds to Subset 2 minus Subset 1. For a Timepoint comparison it corresponds to Timepoint 2 minus Timepoint 1. Positive values therefore indicate a higher mean antigen frequency in the second group.
...
Important: If you change your dataset, you must either assign a new folder name for the updated dataset or delete the associated files in the Data and Results Directories, as these processes build upon one another’s results. Please rerun at least BM1.
If you are familiar with R, you can use the fixVis function of the R package 'immunarch' (https://immunarch.com/) to customize compatible AM1 plots. TCRanalyzer saves the corresponding AM1 plot objects as .rda files in the run-specific fixVis directories. AM2 volcano plots are provided as PDF files and are not saved as .rda plot objects.
Dependencies:
library(immunarch)
load("MyFolder/Results/studyname/AM1/fixVis/plotname.rda")
Or you can simply double-click on plotname.rda in the fixVis folder.
fixVis(plot.tmp)
A graphical interface will open where you can adjust your plot manually.
Note: plot.tmp is the name of the plot in your global environment in R. You can exchange "plot.tmp" with another plot of your R environment.
You can visit https://immunarch.com/ for more information on plot manipulation with fixVis.
Check if RAM is sufficient:
You can monitor the system's memory usage by running htop (if not installed, you can install it using sudo apt install htop in your virtual machine or Docker container). In htop, observe the memory and swap usage. If the system is running low on memory, it might cause processes to stop unexpectedly.
If needed allocate more memory to your Virtual Machine.
Allocate more RAM to the Docker container: If you suspect insufficient memory is causing the issue in a Docker container, you can increase the allocated RAM by modifying the Docker settings:
After adjusting the settings, restart the container to apply the changes.
/app/DataTCRanalyzer requires write access to the directory mounted at /app/Data. At startup, the container checks this and exits with a diagnostic message if the directory is not writable.
If you receive a permission error:
--user option.chmod -R 777 as a general solution. On managed HPC systems, follow the local storage and Docker policy.“In case of errors, check the module log files generated in the directory mounted to /app/Data: info_bm1.log, info_bm2.log, info_am1.log, and info_am2.log. If you need help regarding an error, please contact us with the corresponding log file attached.”
You can create an issue in the TCRanalyzer GitLab repository or contact us directly via [email protected].
If you use TCRanalyzer in your research, please cite:
Seifert N, Reinke S, Kurz NS, Demmer J, Kornrumpf K, Beißbarth T, Klapper W, Altenbuchinger M. TCRanalyzer: A user-friendly tool for comprehensive analysis of T-cell diversity, dynamics and potential antigen targets. bioRxiv. 2025. doi: 10.1101/2025.05.09.652820.
Preprint: https://www.biorxiv.org/content/10.1101/2025.05.09.652820v1.full.pdf
The package is freely distributed under the CC-BY 4.0 International license.
For commercial or server use, please contact us via [email protected].
Content type
Image
Digest
sha256:7ecbbfa45…
Size
1.7 GB
Last updated
3 months ago
docker pull tcranalyzer/dev_jde