Last updated: 2026-03-25
Checks: 7 0
Knit directory: muse/
This reproducible R Markdown analysis was created with workflowr (version 1.7.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20200712) was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 993148d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish or
wflow_git_commit). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .Rproj.user/
Ignored: data/1M_neurons_filtered_gene_bc_matrices_h5.h5
Ignored: data/293t/
Ignored: data/293t_3t3_filtered_gene_bc_matrices.tar.gz
Ignored: data/293t_filtered_gene_bc_matrices.tar.gz
Ignored: data/5k_Human_Donor1_PBMC_3p_gem-x_5k_Human_Donor1_PBMC_3p_gem-x_count_sample_filtered_feature_bc_matrix.h5
Ignored: data/5k_Human_Donor2_PBMC_3p_gem-x_5k_Human_Donor2_PBMC_3p_gem-x_count_sample_filtered_feature_bc_matrix.h5
Ignored: data/5k_Human_Donor3_PBMC_3p_gem-x_5k_Human_Donor3_PBMC_3p_gem-x_count_sample_filtered_feature_bc_matrix.h5
Ignored: data/5k_Human_Donor4_PBMC_3p_gem-x_5k_Human_Donor4_PBMC_3p_gem-x_count_sample_filtered_feature_bc_matrix.h5
Ignored: data/97516b79-8d08-46a6-b329-5d0a25b0be98.h5ad
Ignored: data/Parent_SC3v3_Human_Glioblastoma_filtered_feature_bc_matrix.tar.gz
Ignored: data/brain_counts/
Ignored: data/cl.obo
Ignored: data/cl.owl
Ignored: data/jurkat/
Ignored: data/jurkat:293t_50:50_filtered_gene_bc_matrices.tar.gz
Ignored: data/jurkat_293t/
Ignored: data/jurkat_filtered_gene_bc_matrices.tar.gz
Ignored: data/pbmc20k/
Ignored: data/pbmc20k_seurat/
Ignored: data/pbmc3k.csv
Ignored: data/pbmc3k.csv.gz
Ignored: data/pbmc3k.h5ad
Ignored: data/pbmc3k/
Ignored: data/pbmc3k_bpcells_mat/
Ignored: data/pbmc3k_export.mtx
Ignored: data/pbmc3k_matrix.mtx
Ignored: data/pbmc3k_seurat.rds
Ignored: data/pbmc4k_filtered_gene_bc_matrices.tar.gz
Ignored: data/pbmc_1k_v3_filtered_feature_bc_matrix.h5
Ignored: data/pbmc_1k_v3_raw_feature_bc_matrix.h5
Ignored: data/refdata-gex-GRCh38-2020-A.tar.gz
Ignored: data/seurat_1m_neuron.rds
Ignored: data/t_3k_filtered_gene_bc_matrices.tar.gz
Ignored: r_packages_4.5.2/
Untracked files:
Untracked: .claude/
Untracked: CLAUDE.md
Untracked: analysis/.claude/
Untracked: analysis/aucc.Rmd
Untracked: analysis/bimodal.Rmd
Untracked: analysis/bioc.Rmd
Untracked: analysis/bioc_scrnaseq.Rmd
Untracked: analysis/chick_weight.Rmd
Untracked: analysis/likelihood.Rmd
Untracked: analysis/modelling.Rmd
Untracked: analysis/sampleqc.Rmd
Untracked: analysis/wordpress_readability.Rmd
Untracked: bpcells_matrix/
Untracked: data/Caenorhabditis_elegans.WBcel235.113.gtf.gz
Untracked: data/GCF_043380555.1-RS_2024_12_gene_ontology.gaf.gz
Untracked: data/SeuratObj.rds
Untracked: data/arab.rds
Untracked: data/astronomicalunit.csv
Untracked: data/davetang039sblog.WordPress.2026-02-12.xml
Untracked: data/femaleMiceWeights.csv
Untracked: data/lung_bcell.rds
Untracked: m3/
Untracked: women.json
Unstaged changes:
Modified: analysis/isoform_switch_analyzer.Rmd
Modified: analysis/linear_models.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/tcell.Rmd) and HTML
(docs/tcell.html) files. If you’ve configured a remote Git
repository (see ?wflow_git_remote), click on the hyperlinks
in the table below to view the files as they were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | 993148d | Dave Tang | 2026-03-25 | Learning about T cells |
Notes inspired by the landmark study: Restriction of in vitro T cell-mediated cytotoxicity in lymphocytic choriomeningitis within a syngeneic or semiallogeneic system (Zinkernagel and Doherty, 1974).
This study demonstrated that cytotoxic T cells can only kill virus-infected target cells that share the same major histocompatibility complex (MHC) alleles, establishing the concept of MHC restriction. This discovery was awarded the Nobel Prize in Physiology or Medicine in 1996.
The T cell receptor is a heterodimeric cell-surface protein responsible for antigen recognition. There are two forms:
Each TCR chain consists of:
Unlike antibodies, the TCR is always membrane-bound and is never secreted. Each T cell expresses a single TCR specificity (allelic exclusion).
The TCR itself has very short cytoplasmic tails and cannot signal on its own. It associates with the CD3 complex, which consists of:
The CD3 chains contain immunoreceptor tyrosine-based activation motifs (ITAMs) in their cytoplasmic domains. The \(\zeta\)-chain homodimer alone contributes 6 ITAMs. Upon TCR engagement, ITAMs are phosphorylated by the Src family kinase Lck, initiating downstream signalling.
| Feature | TCR | Antibody (BCR) |
|---|---|---|
| Chains | \(\alpha\beta\) or \(\gamma\delta\) | Heavy + light |
| Antigen form | Peptide-MHC complex | Native antigen (any shape) |
| Secreted form | No | Yes (immunoglobulins) |
| Somatic hypermutation | No | Yes |
| Valency | Monovalent | Bivalent (or higher for IgM) |
| Isotype switching | No | Yes |
| Diversity mechanism | V(D)J recombination | V(D)J + SHM |
TCR diversity is generated through V(D)J recombination, the same mechanism used by B cells for antibody diversity:
The estimated diversity of the \(\alpha\beta\) TCR repertoire is >10^15, driven largely by:
Critically, unlike antibodies, TCRs do not undergo somatic hypermutation. TCR affinity for antigen is therefore fixed after thymic selection.
Major histocompatibility complex (MHC) molecules present peptide fragments on the cell surface for T cell recognition. In humans, MHC is called HLA (human leukocyte antigen).
| Feature | MHC class I | MHC class II |
|---|---|---|
| Genes (human) | HLA-A, HLA-B, HLA-C | HLA-DP, HLA-DQ, HLA-DR |
| Structure | \(\alpha\) chain + \(\beta_2\)-microglobulin | \(\alpha\) chain + \(\beta\) chain |
| Expression | All nucleated cells | Professional APCs (dendritic cells, macrophages, B cells) |
| Peptide source | Intracellular (cytosolic) | Extracellular (endosomal) |
| Peptide length | 8-10 amino acids | 13-25 amino acids |
| Recognised by | CD8+ T cells | CD4+ T cells |
| Binding groove | Closed ends | Open ends |
MHC class I pathway (endogenous/cytosolic):
MHC class II pathway (exogenous/endosomal):
Cross-presentation: Dendritic cells can present exogenous antigens on MHC class I molecules, enabling CD8+ T cell responses to extracellular pathogens and tumour antigens. This is critical for anti-tumour immunity and vaccination.
T cell precursors originate in the bone marrow and migrate to the thymus for maturation. Thymic development involves several stages:
Thymocytes initially express neither CD4 nor CD8 (CD4\(^-\)CD8\(^-\)). The DN stage is subdivided based on CD44 and CD25 expression:
| Stage | CD44 | CD25 | Key events |
|---|---|---|---|
| DN1 | + | - | Thymic entry, Notch signalling |
| DN2 | + | + | TCR \(\beta\) gene rearrangement begins |
| DN3 | - | + | \(\beta\)-selection checkpoint |
| DN4 | - | - | Proliferation |
\(\beta\)-selection: At DN3, a productive TCR \(\beta\) chain rearrangement is tested by pairing with a surrogate pre-T\(\alpha\) chain. Successful \(\beta\)-selection triggers proliferation and progression to the double-positive stage.
Thymocytes express both CD4 and CD8 (CD4\(^+\)CD8\(^+\)). The TCR \(\alpha\) chain is rearranged, generating a complete \(\alpha\beta\) TCR. Two critical selection events follow:
Positive selection (thymic cortex):
Negative selection (thymic cortex and medulla):
Mature thymocytes express either CD4 or CD8 and exit the thymus as naive T cells into the peripheral circulation.
CD4+ T cells recognise peptide-MHC class II complexes and orchestrate immune responses by secreting cytokines. Upon activation, naive CD4+ T cells differentiate into specialised subsets:
| Subset | Key transcription factor | Signature cytokines | Primary function |
|---|---|---|---|
| Th1 | T-bet | IFN-\(\gamma\), TNF-\(\alpha\) | Intracellular pathogens, macrophage activation |
| Th2 | GATA-3 | IL-4, IL-5, IL-13 | Helminth defence, allergic responses |
| Th17 | ROR\(\gamma\)t | IL-17A, IL-17F, IL-22 | Extracellular bacteria, fungi, mucosal defence |
| Tfh | Bcl-6 | IL-21, IL-4 | B cell help in germinal centres |
| Treg | FoxP3 | IL-10, TGF-\(\beta\) | Immune suppression, self-tolerance |
| Th9 | PU.1 | IL-9 | Anti-helminth, allergic inflammation |
| Th22 | AHR | IL-22 | Epithelial barrier function |
Subset differentiation is driven by the cytokine milieu at the time of T cell activation. Plasticity between subsets has been observed, particularly under inflammatory conditions.
CD8+ T cells recognise peptide-MHC class I complexes and directly kill target cells (virus-infected cells, tumour cells). Killing mechanisms include:
After pathogen clearance, most effector CD8+ T cells die by apoptosis (contraction phase), but a subset survives as memory T cells.
Memory T cells provide rapid and enhanced responses upon re-encountering the same antigen. Key subsets:
\(\gamma\delta\) T cells represent ~5% of peripheral blood T cells but are enriched at mucosal surfaces (skin, gut, lung). Key features:
Naive T cell activation requires three signals:
The TCR recognises a specific peptide-MHC complex on an antigen-presenting cell (APC). The co-receptors CD4 or CD8 bind to conserved regions of MHC class II or class I, respectively, stabilising the interaction and bringing the kinase Lck into proximity with CD3 ITAMs.
Key downstream signalling events:
Co-stimulatory signals are required to prevent T cell anergy (functional unresponsiveness). Key co-stimulatory and co-inhibitory molecules:
| Molecule | Ligand | Effect | Expression |
|---|---|---|---|
| CD28 | CD80 (B7-1), CD86 (B7-2) | Co-stimulation | Constitutive on naive T cells |
| CTLA-4 | CD80, CD86 | Co-inhibition | Upregulated after activation |
| PD-1 | PD-L1 (B7-H1), PD-L2 (B7-DC) | Co-inhibition | Upregulated after activation |
| ICOS | ICOS-L | Co-stimulation | Upregulated after activation |
| 4-1BB (CD137) | 4-1BBL | Co-stimulation | Upregulated after activation |
| OX40 (CD134) | OX40L | Co-stimulation | Upregulated after activation |
| LAG-3 | MHC class II | Co-inhibition | Upregulated after activation |
| TIM-3 | Galectin-9, CEACAM1 | Co-inhibition | Upregulated after activation |
| TIGIT | CD155, CD112 | Co-inhibition | Upregulated after activation |
TCR engagement without co-stimulation (Signal 1 alone) leads to anergy or deletion, a mechanism of peripheral tolerance.
Cytokines produced by APCs and surrounding cells direct the differentiation programme of activated T cells. For example:
Chronic antigen stimulation (persistent viral infections, cancer) drives T cells into a dysfunctional state called exhaustion. Exhausted T cells are characterised by:
T cell exhaustion is a major barrier to effective anti-tumour immunity and is the target of immune checkpoint blockade therapies.
Common markers used to identify T cell populations by flow cytometry or single-cell RNA sequencing:
| Marker | Expression | Function |
|---|---|---|
| CD3 | All T cells | TCR signalling complex |
| CD4 | Helper T cells | MHC class II co-receptor |
| CD8 | Cytotoxic T cells | MHC class I co-receptor |
| CD45RA | Naive and T\(_{EMRA}\) cells | Phosphatase isoform |
| CD45RO | Memory T cells | Phosphatase isoform |
| CCR7 | Naive and T\(_{CM}\) cells | Lymph node homing |
| CD62L | Naive and T\(_{CM}\) cells | Lymph node homing |
| CD69 | Recently activated, T\(_{RM}\) cells | Tissue retention |
| CD25 | Activated T cells, Tregs | IL-2 receptor \(\alpha\) chain |
| FoxP3 | Tregs | Lineage transcription factor |
| PD-1 | Activated/exhausted T cells | Inhibitory receptor |
| Ki-67 | Proliferating cells | Proliferation marker |
Blocking co-inhibitory receptors can reinvigorate exhausted T cells in the tumour microenvironment:
The discovery of cancer therapy by inhibition of negative immune regulation was awarded the Nobel Prize in Physiology or Medicine in 2018 to James Allison (CTLA-4) and Tasuku Honjo (PD-1).
Chimeric antigen receptor (CAR) T cells are engineered T cells that express a synthetic receptor combining:
CAR generations differ in their intracellular signalling domains:
| Generation | Signalling domains | Features |
|---|---|---|
| 1st | CD3\(\zeta\) only | Poor persistence and expansion |
| 2nd | CD3\(\zeta\) + one co-stimulatory domain (CD28 or 4-1BB) | Improved persistence and efficacy |
| 3rd | CD3\(\zeta\) + two co-stimulatory domains | Enhanced signalling |
| 4th (“armoured”) | 2nd gen + cytokine/ligand expression cassette | Modifies tumour microenvironment |
FDA-approved CAR-T products (as of 2024) target CD19 (B cell malignancies) or BCMA (multiple myeloma):
TCR-engineered T cells are modified to express a specific TCR targeting a tumour-associated peptide-MHC complex. Unlike CAR-T cells, TCR-T cells can recognise intracellular antigens (presented via MHC class I), greatly expanding the range of targetable tumour antigens (e.g., NY-ESO-1, MAGE-A4, TP53 neoantigens).
Tumour-infiltrating lymphocytes (TILs) are harvested from a patient’s tumour, expanded ex vivo, and reinfused. TIL therapy has shown durable responses in melanoma and was FDA-approved in 2024 (lifileucel/Amtagvi).
sessionInfo()
R version 4.5.2 (2025-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.9.5 forcats_1.0.1 stringr_1.6.0 dplyr_1.2.0
[5] purrr_1.2.1 readr_2.2.0 tidyr_1.3.2 tibble_3.3.1
[9] ggplot2_4.0.2 tidyverse_2.0.0 workflowr_1.7.2
loaded via a namespace (and not attached):
[1] sass_0.4.10 generics_0.1.4 stringi_1.8.7 hms_1.1.4
[5] digest_0.6.39 magrittr_2.0.4 timechange_0.4.0 evaluate_1.0.5
[9] grid_4.5.2 RColorBrewer_1.1-3 fastmap_1.2.0 rprojroot_2.1.1
[13] jsonlite_2.0.0 processx_3.8.6 whisker_0.4.1 ps_1.9.1
[17] promises_1.5.0 httr_1.4.8 scales_1.4.0 jquerylib_0.1.4
[21] cli_3.6.5 rlang_1.1.7 withr_3.0.2 cachem_1.1.0
[25] yaml_2.3.12 otel_0.2.0 tools_4.5.2 tzdb_0.5.0
[29] httpuv_1.6.17 vctrs_0.7.2 R6_2.6.1 lifecycle_1.0.5
[33] git2r_0.36.2 fs_2.0.0 pkgconfig_2.0.3 callr_3.7.6
[37] pillar_1.11.1 bslib_0.10.0 later_1.4.8 gtable_0.3.6
[41] glue_1.8.0 Rcpp_1.1.1 xfun_0.57 tidyselect_1.2.1
[45] rstudioapi_0.18.0 knitr_1.51 farver_2.1.2 htmltools_0.5.9
[49] rmarkdown_2.30 compiler_4.5.2 getPass_0.2-4 S7_0.2.1