TESSA (TCR and Expression Joint Clustering) is a Bayesian model that integrates T-cell receptor (TCR) sequence profiling with transcriptomes of T cells...
TESSA (TCR and Expression Joint Clustering) is a Bayesian model that integrates T-cell receptor (TCR) sequence profiling with transcriptomes of T cells. It maps the functional landscape of the TCR repertoire by learning unified representations across modalities. The process employs BriseisEncoder to capture TCR sequence features, creating numerical embeddings that reconstruct Atchley Factor matrices and CDR3 sequences. This enables discovery of functional T-cell clusters based on combined TCR and gene expression information.
ScRepCombiningExpression with data that has both TRA and TRB chains[TESSA]
cache = true # Enable caching (default: true)
[TESSA.in]
# Type: CombinedInput (requires both TCR and RNA data)
# Required: yes
# Description: Data generated by ScRepCombiningExpression process
# Format: RDS or qs/qs2 format
screpdata = ["ScRepCombiningExpression"]
Critical requirement: Input data must have both TRA and TRB chains. Cells with only single-chain TCRs will be excluded from analysis.
[TESSA.envs]
# python: str - Path to Python interpreter with TESSA dependencies (default: "python")
# Required: yes if not in PATH
python = "/path/to/python_with_tessa"
# within_sample: flag - TCR network construction scope (default: false)
# false: Construct TCR networks using ALL TCRs in metadata (cross-sample)
# true: Construct networks only within same sample/patient (within-sample)
within_sample = false
# assay: str - Which assay to extract expression matrix from (default: auto)
# Only applies if input is Seurat RDS file
# Auto-detects "SCT" if SCTransform performed, otherwise "RNA"
assay = "SCT" # or "RNA"
# predefined_b: flag - Use predefined b vector in MCMC (default: false)
# true: TESSA will not update b in MCMC iterations
# false: b vector will be updated during MCMC
# See TESSA paper for details about the b vector
predefined_b = false
# max_iter: int - Maximum MCMC iterations (default: 1000)
# Higher values = more convergence but slower runtime
# Typical range: 500-2000
max_iter = 1000
# save_tessa: flag - Save detailed TESSA results (default: false)
# true: Saves detailed results to sobj@misc$tessa
# false: Only saves cluster assignments and sizes
# Recommended for debugging but increases object size
save_tessa = false
[TESSA]
[TESSA.in]
screpdata = ["ScRepCombiningExpression"]
[TESSA]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = false # Networks across all samples
max_iter = 1000
assay = "SCT"
[TESSA]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = true # Networks within each patient/patient
max_iter = 1500
predefined_b = false
[TESSA]
[TESSA.envs]
python = "/usr/bin/python3"
max_iter = 500
save_tessa = true # Save full TESSA results for inspection
[TESSA]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = false
max_iter = 500 # Faster, less convergence
predefined_b = true # Use predefined b for speed
save_tessa = false
Analyzing T cells from viral infection (e.g., COVID-19, influenza, HIV) to identify virus-specific T cells.
[TESSA]
[TESSA.in]
screpdata = ["ScRepCombiningExpression"]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = true # Keep within patient to avoid cross-contamination
max_iter = 1000
assay = "SCT"
save_tessa = true # Inspect viral-specific clusters
Use case: Distinguish SARS-CoV-2-specific T cells from bystanders in COVID-19 patient samples. TESSA clusters can reveal functional states specific to viral recognition.
Analyzing T cells in tumor microenvironment to identify tumor-recognizing T cells.
[TESSA]
[TESSA.in]
screpdata = ["ScRepCombiningExpression"]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = false # Combine across tumor samples
max_iter = 1200
assay = "SCT"
predefined_b = false
save_tessa = true
Use case: Identify tumor-specific TIL clusters and their functional states across multiple tumor samples from different patients. Helps discover shared tumor antigen recognition patterns.
Analyzing T cell evolution across time points in same individual.
[TESSA]
[TESSA.in]
screpdata = ["ScRepCombiningExpression"]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = true # Networks within individual + timepoint
max_iter = 1000
assay = "SCT"
save_tessa = false
Use case: Track T cell functional changes during treatment or disease progression. Each time point analyzed separately to understand temporal dynamics.
Analyzing T cell responses to vaccination across multiple subjects.
[TESSA]
[TESSA.in]
screpdata = ["ScRepCombiningExpression"]
[TESSA.envs]
python = "/usr/bin/python3"
within_sample = false # Find shared vaccine-specific clusters across subjects
max_iter = 1500
assay = "SCT"
predefined_b = false
save_tessa = true
Use case: Identify vaccine-specific T cell clusters shared across multiple vaccinated individuals. Higher iterations ensure convergence in cross-subject analysis.
ScRepCombiningExpressionScRepLoading (provides TCR data)SeuratPreparing (provides RNA data)SeuratClustering (for comparison with TESSA clusters)TESSA output adds two columns to Seurat metadata:
TESSA_Cluster: Cluster assignments (use for clustering visualization)TESSA_Cluster_Size: Cluster cell counts (use for cluster statistics)Common downstream analyses:
SeuratClusterStats: Visualize TESSA clusters on UMAPClusterMarkers: Find markers specific to each TESSA clusterScFGSEA: Pathway enrichment per TESSA clusterCellCellCommunication: Analyze communication within/between TESSA clustersScrnaMetabolicLandscape: Metabolic profiling of functional T cell statestessa Python package and dependencies installedenvs.python if TESSA not in default Python pathCause: Input data lacks both TRA and TRB chains or has insufficient cells.
Solutions:
ScRepCombiningExpression output includes TCR dataScRepLoading.envs.chain = "both" to ensure both chains loadedCause: TESSA dependencies not installed in specified Python environment.
Solutions:
pip install tessa[TESSA.envs] python = "/path/to/python"python -c "from BriseisEncoder import *"Cause: MCMC iterations or dataset too large.
Solutions:
max_iter to 500-800predefined_b = true (skip b vector updates)within_sample = true for parallel per-sample processingCause: Insufficient convergence or inappropriate network scope.
Solutions:
max_iter to 1500-2000within_sample based on biological question:within_sample = falsewithin_sample = truepredefined_b = false to allow full MCMC learningCause: Assay not specified when input is RDS file.
Solutions:
[TESSA.envs] assay = "SCT"assay = "RNA" for standard assayTESSA_Cluster: Integer cluster assignments (1, 2, 3, ...)TESSA_Cluster_Size: Count of cells in each cluster (per row)When save_tessa = true, detailed results saved to sobj@misc$tessa:
Access in R: tessa_results <- srtobj@misc$tessa
ScRepCombiningExpression processwithin_sample setting:max_iter = 1000, increase if convergence issuessave_tessa = true for first run to inspect results