Multimodal framework for the joint analysis of single-cell RNA and T cell receptor sequencing data predicts T cell response to cancer immunotherapy

Domain: chemistry
Published: 2026-03-12
Editorial outcome: minor_revision

Abstract
Tcellstatesareprognosticindifferentcancertypes.Recent
technologies enable joint profiling of T cell RNA and T cell receptor
(TCR) sequences at single-cell resolution. Here we present the TCR-
RNAIntegratingModel(TRIM),amulti-modalvariationalautoencoder
framework that integrates RNA-TCR data and predicts T cell clonal-
ity and transcriptional states. TRIM learns a shared representation of
thedataconditionedonpatient,tissuesource,andtreatmenttimepoint.
We applied TRIM to three independent datasets that included T cells
collectedbeforeandaftercheckpointinhibitortreatment,sourcedeither
frombloodandtumorbiopsiesinpatientswithheadandnecksquamous
cell carcinoma and colorectal cancer, or from tumor and adjacent tis-
sue in a pan-cancer dataset. In all settings, TRIM accurately predicted
intra-tumor T cell clonal expansion and transcriptional status based on
T cells from blood or normal tissue before treatment, demonstrating its
utilityinmodelingmultimodalTcelldataandpredictingTcellresponse
to treatment and disease progression.

Introduction
Tcellsplayadefiningroleintheadaptiveimmuneresponse,andunderstanding
and modulating their activities has become a central focus in immunotherapy
[1,2].ThereactivityofaTcellisdeterminedbyitsuniqueTcellreceptor(TCR),
which can specifically recognize foreign antigens presented by cell surface MHC
molecules on antigen-presenting cells [3,4]. In presence of cancer, circulating
na¨ıve T cells are activated in tumor-draining lymph nodes, enabling migration
into tumors [5]. A na¨ıve T cell becomes activated when it recognizes a cancer
antigenthroughitsTCRandthenundergoesclonalexpansionanddifferentiation
either into an effector T cell that kills the cancer cells or a memory T cell that
protects during additional encounters with the same caSncer [6]. Cancer cells
acquire many mechanisms to evade the T cell response [7]. This observation
S
hasspurredmajorimmunotherapydevelopments–includingimmune-checkpoint
E
blockade, adoptive T cell therapy, and cancer vaccines– all designed to restore
the T cell response [8]. To develop more effectRive cancer immunotherapies, we
need a multifaceted understanding of the TPcell response that accounts for the
responsebeingbothhighlydynamicandcoordinatedacrossmultipletissuesites.
The advent of single-cell RNA sequNencing (scRNAseq) has greatly enhanced
the resolution of T cell subsets, revealing the underlying heterogeneity in tran-
I
scriptional states, which is especially pronounced in tumors, with variation be-
tween patients and across tumEor types. Despite this heterogeneity, recent pan-
cancertranscriptomicatlasesthatprofiletumor-infiltratingTcellsacrosstumor
L
types identified shared T cell states and developmental paths. Signals from the
C
cancer microenvironment often drive the T cells towards an exhausted state
characterized by incrIeased expression of T cell inhibitory receptors (e.g. PD1,
CTLA4,LAG3),lTossofeffectorkillingfunction,reducedcytokinesecretion,and
ultimately tumRor immune evasion [9,10,11,12,13]. A recurring theme is that pa-
tients who do not successfully respond to cancer immunotherapy often have
A
tumor-infiltratingTcellsinanexhaustedstate[14],indicatingthatTcellstates
are an important predictive biomarker.
While transcriptomics is powerful for identifying T cell states, the sequence
of the TCR is ultimately what drives cancer antigen recognition and a protec-
tive immune response. Single-cell TCR sequencing (scTCRseq) determines both
the TCR α-chain and β-chain sequences constituting the TCR and allows us to
defineclonalityinapopulationofTcells,identifyingTcellcloneswiththesame
TCR that have expanded in response to an antigen from clones that have not
expanded[15,16].WhenpairedwithscRNAseqfromthesamecell,thisprovides
a powerful link between a T cell clonotype and its cell state, which has resulted
in many insights into the activities of expanded T cell clones. For instance,
in a study of glioma-infiltrating T cells, analysis of clonally expanded T cells
identified a novel subset expressing the inhibitory receptor KLRB1, which when
blockedresultedinenhancedkillingofgliomacells [17].TheTCRsequencenot
onlyreportstheTcellclonotypebutalsocanactasamolecularbarcodetotrace
T cells across time and in different tissue sites [18]. For example, in a clinical
trial of neoadjuvant immune-checkpoint blockade in head and neck squamous
2
ARTICLE IN PRESS
cell carcinomas (HNSCC), both tumor-infiltrating T cells and peripheral blood
T cells were concurrently collected before and after treatment [19]. Joint, multi-
modal analyses of TCR sequences and T cell transcriptomes identified CD8+ T
cells that were clonally expanded during therapy, had pre-existed in the tumor
priortotreatment,expressedtissue-residentmemoryandcytotoxicityprograms,
and whose clonotypes could be detected systemically in the blood.
Multimodal profiling of the immune system during disease treatment and
across tissue sites enables the discovery of clinical biomarkers predictive of pa-
tient prognosis and immunotherapy response. A promising approach is to link
measurements in the peripheral blood to measurements in the tumor tissue,
as blood collection is clinically routine and can be repeatedly performed over
S
the course of patient treatment [20]. For example, FDA-approved Epi proColon
analyzes blood samples for Septin 9 methylated DNASshed from tumors as a
biomarker for colorectal cancer [21]. Similarly, peripheral immune cells can also
E
serve as cancer biomarkers. Multiple peripheral T cell biomarkers have been
R
identified to date including a link between peripheral and intratumoral clonal
expansion in response to anti-PD-1/PD-L1Pimmunotherapy, early peripheral T
cell proliferation predicting response to i mmune-checkpoint blockade, and cell
surface markers NKG2D, CD39, andNCX3CR1 in peripheral T cells identifying
tumor-infiltrating T cells in melanoIma [22,23,24].
These recent discoveries in th e predictive capacity of peripheral blood to-
E
wardstumordynamicsunderscorethegreatneedformultimodaldataintegration
and translation. Different dLata modalities, including tabular, text, and images,
are routinely profiled inCcells and tissues, and their integration provides insight
by unifying multipleIbiological perspectives [25,26]. However very few multi-
modal studies colTlecting immune samples longitudinally over cancer treatment
and across multiple tissue sites have been performed, as they are costly, chal-
R
lenging in the clinical setting, and require novel, integrative analyses [19,27,28].
A
Integrating datasets across different modalities is complicated by technical vari-
ability and the unique features of each modality. In the single-cell context, the
heterogeneity of multiple complex distributions provides challenges but also op-
portunitiesforthistypeofanalysis[29,30,31].Forinstance,severalmethods,in-
cluding CoNGA, tessa, and mvTCR, integrate jointly measured transcriptomes
andTCRsequencesfromsinglecells[32,33,34].Furthermore,anincreasingnum-
berofmethodsallowtranslationfromonemodalitytoanother[35],forexample
predicting scRNAseq data in CD4+ T cells from paired chromatin accessibility
of the cells [29]. Many of these methods are built on variational autoencoders
(VAEs), effective neural network architectures for multi-modal integration that
afford great flexibility in modeling different data distributions and integrating
them into a shared representation [36,37]. However to our knowledge, there are
no multimodal models for T cells that can predict treatment response in the
tumor tissue from measurements of the peripheral blood alone.
WeintroduceamultimodaldataintegrationmethodthatmodelspairedscR-
NAseq and scTCRseq measured at multiple time points and across multiple tis-
sue sites (Fig. 1a). By integrating these two data modalities through a VAE
3
ARTICLE IN PRESS
architecture, we can elucidate the relationship between the transcriptome and
clonalityofTcellsandidentifyfunctionallyrelatedTcellsubsets(Fig.1b).Our
TCR-RNA integrating model (TRIM) not only integrates these two modalities
butcanalsogeneratepredictionsforanunmeasuredtimepointortissuesite.We
test TRIM on an extensively profiled clinical cohort of HNSCC patients receiv-
ing immune-checkpoint blockade therapy, with paired scRNAseq and scTCRseq
measurementsfromthetumorandperipheralbloodpre-andpost-treatment[19].
We also tested TRIM on a similar dataset containing paired single-cell RNA-
seqandTCR-seqdatafromcolorectalcancer(CRC)patients [27],andapaired
RNAandTCRpan-cancerdatasetcollectedfromtumorandadjacenttissue[11],
demonstratingourmodelgeneralizesbeyondthedatasetsonwhichitwasdevel-
oped.OurframeworkmakesaccuratepredictionsabouthowStumor-infiltratingT
cellschangeaftertreatmentbyonlylookingatTcellsintheperipheralbloodbe-
S
foretreatment.WeexpectTRIMtobeapowerfulmodelingframeworkinclinical
E
cohorts, where profiling all tissues of interest at every timepoint is challenging,
as well as in the discovery of biomarkers forRtumor prognosis and treatment
response. P

Results
TRIM uses a conditional var iational autoencoder to predict
treatment effect in tumor from pre-treatment blood
To integrate the information from RNA and TCR sequences in T cells, and
make predictions on T cell states in unseen tissue-sites and time points, we pro-
pose TRIM, a generaItive model based on a conditional VAE (Fig. 1b, Methods
TRIM). TRIM isTtrained on paired single-cell RNA and TCR sequencing data
fromTcellsinRcirculatingbloodbeforetreatment,anditthenpredictsthestate
of the T cell population at the single-cell level in both pre- and post-treatment
tumors, as well as in post-treatment blood samples (Fig. 1b). TRIM learns a
joint representation of gene expression and clonality by using two separate en-
coderstomaptheRNAprofileandtheTCRsequenceofacellintoajointlatent
space, conditioned on the source (blood or tumor), timepoint (pre-treatment or
post-treatment), and patient. To ensure that the joint latent space captures in-
formation from both the cell’s RNA profile and its TCR sequence, TRIM uses
two separate decoders to reconstruct the two modalities (Fig. 2a).
When multiple paired modalities are present, traditional autoencoders min-
imize the error when translating between modalities using the encoder of one
andthedecoderoftheother.Thisstrategyhasbeeneffectiveinintegratingvar-
ious single-cell modalities, such as RNA-seq, ATAC-seq, and chromatin imag-
ing [38,39,35]. A reconstruction loss is applied to encourage the output to be
close to the original points. For the RNA space, this loss is calculated using the
L2 norm (Methods). The TCR representations used in our model are derived
from embeddings learned through a convolutional autoencoder, which we train
as a pre-processing step. Specifically, each TCR is represented by the CDR3
amino acid sequence of its β chain, encoded as a null-padded sequence where
4
ARTICLE IN PRESS
each amino acid is represented by its Atchley factors—biochemically informed
numerical descriptors that capture properties such as polarity, charge, and hy-
drophobicity[40](Methods).Weextracttheembeddingsfromthemiddlelatent
layer of the trained convolutional autoencoder to serve as input to the TRIM
model. Despite focusing on the highly variable CDR3 sequence of the TCRs
β chain, the model implicitly learns the contributing V and J gene segments,
resulting in a learned representation space organized in a biologically meaning-
ful manner (Supplementary Fig. 1). We focus on the β chain for practical and
biologicalreasons.First,insingle-cellV(D)Jsequencing,α–β pairingisoftenin-
complete.Inbloodsamplesprofiledin[19],87%ofcellshavepairedchains,with
β recovered more frequently than α (95% vs. 89%). More broadly, large pub-
lic TCR resources are predominantly β-only, with 94% ofSsequences containing
only the β chain [41]. Second, prior studies that include both chains report only
S
marginalperformancegains,likelybecausetheCDR3β sequenceisthedominant
E
determinant of peptide–MHC specificity [42,43]. Given these experimental con-
straints and data availability, we use the β chaRin to maximize sample coverage
while retaining most of the relevant signal. P
We also observe that RNA-seq profiles contain limited information about a
N
cell’sTCRsequencebeyonditsclonality(aswewilldiscussinmoredetaillater),
a direct translation between TCRIand RNA is not possible. To address this
limitation, we model T cell clona lity rather than TCR sequences. To preserve
local structure in the TCR space without penalizing unrelated variations, we
introduce the contrastive cLlonality loss. This loss encourages T cells from the
sameclonetobeclosetCogetherinthelatentspacewhileensuringdifferentTcell
clones remain separated by a margin (Methods, contrastive clonality loss). This
I
approachshiftsthTefocusfromexactTCRrepresentationtopreservingclonality.
InadditionR,ourmodelincorporatespatient,source,andtimepointconditions
asinputs,representedbyfixed-lengthvectorslearnedjointlywiththerestofthe
model through a separate embedding network, F (Fig. 2a). In contrast to the
standardapproach,whichlearnsconditionalvectorsbyindexingintoarandomly
initializedembeddingmatrix(withtheparametersofthismatrixlearnedduring
training), our method is designed to learn the vector representations of condi-
tions using the RNA and TCR profiles associated with each condition. Namely,
the network F processes a subset of training cells, S , and maps them into
emb
a d -dimensional latent space. To calculate the embedding vector for a spe-
emb
cificcondition,TRIMaveragestherepresentationsofcellscorrespondingtothat
condition.Forexample,thepre-treatmenttimepointvectoriscalculatedbyaver-
agingovertherepresentationsofpre-treatmentcellsinS (Methods,Learning
emb
condition embeddings). For patient embeddings, we specifically focus on blood
pre-treatmentcells,asthisistheavailabledataforunseenpatients.Theembed-
dingsarelearnedfrombothRNAandTCRdata,usingtwonetworks,F and
RNA
F , whose outputs are averaged to form the final embedding. Importantly,
TCR
our model can make use of the fact that a patient’s RNA or TCR distribution
from one source/timepoint is highly informative of their distributions in other
settings. We show that this approach is more effective in generating accurate
5
ARTICLE IN PRESS
RNA and TCR distributions across conditions, and crucially, enables accurate
extrapolation to new, unseen patients. During model evaluation, we discretize
thedecoder’scontinuousoutputstoestimateTCRclones,assigningpseudoclones
usingagreedyalgorithmthatgroupspointswithinamarginintothesameclone
(Fig.2b,Methods,Pseudocloneassignment).Tomaximizetheutilityofthedata
and test its generalizability, we train on all but one patient’s data, and test the
model on the held-out patient. We repeat this procedure in a cross-validation
process for each patient to obtain the full set of predictions. This allows com-
paring the output to the ground truth across the full dataset, but have it all be
from out-of-sample heldout predictions.
Single-cell RNA and TCR sequences are related only via clone count
To explore the relationship between TCR and RNA, we analyzed paired scR-
NAseq and scTCRseq data from 27 HNSCC patients [19]. The dataset includes
measurements from both circulating blood andRtumor-infiltrating T cells taken
before and after immune checkpoint inhibitPor therapy. It consists of 73,961 T
cells with RNA expression measured on 29,750 genes, paired with TCR CDR3
β-chain sequences. While each RNA eNxpression profile is unique, many cells are
clones with identical TCR sequences, with only 69.8% of T cells having unique
I
TCRs.WhilepriorstudiessuggestthatidenticalTcellclonessharesimilarRNA
expressions [32], many questioEns remain regarding the relationship between the
RNA expression space and the TCR space.
L
Towardsthis,wefirstvisualizethescRNAseqdatausingUMAP[44](Fig.3a).
C
Strong overlap in individual patient distributions can be observed (Fig. 3a [44],
bottom left), with foIur distinct clusters: T cells from blood are separated from
those in the tumoTr, and CD4+ T cells are distinct from CD8+ T cells in both
sources. WhileRcell types are are clearly separated in the transcriptomic space,
treatment effect is more subtle. There is no discernible shift in blood cells, but
A
a slight shift occurs in tumor cells, particularly in CD8+ cells. When assigning
to each cell its clone count (corresponding to the number of cells expressing the
same TCR), higher clonality can be observed in regions of the RNA expression
space corresponding to parts of the CD8+ T cells clusters. Larger clone sizes
are more frequent in CD8+ cells and in the tumor compared to CD4+ cells and
those in the blood (Supplementary Fig. 2)
To evaluate the hypothesis about clones being closer in RNA expression, we
comparedcellsbypairwisedistanceintheRNAspaceversuspairwiseHamming
distance in the TCR space (Fig. 3b). The distribution of RNA distances among
identical TCR clones (Hamming distance of zero) is substantially lower than
the RNA distances for cells farther apart in the TCR space. Interestingly, once
we get beyond identical TCR clones, there is very little relationship between
two cells’ TCR sequence and their RNA expression. To find any relationship,
we have to filter for clones with count greater than one, and even then, the dif-
ference between the mean RNA distance between clones 0-Hamming apart and
1-Hamming apart is 4 times bigger than the difference between the means of
cells 1-Hamming and 10-Hamming apart. In other words, two cells whose TCR
6
ARTICLE IN PRESS
sequences differ at only a single position are just as far in the RNA space as
twocellswithcompletelydifferentTCRsequences.Wenotethatthisistruenot
only at the dataset level, but also if restricted to just within a patient, within
a source (blood/tumor), within a cell type (CD4+/CD8+), or within a time-
point (pre-treatment/post-treatment) (Supplementary Fig. 3a). We conducted
the same analysis using the Levenshtein pairwise distance, and the results re-
mainedconsistent(SupplementaryFig.3b).Thesamefindingsholdwhenweuse
neuralnetworkembeddingstorepresentTCRsequences,suchasTCR-BERTor
our convolutional autoencoder (Fig. 3c, Supplementary Fig. 3c). At the gene
level, only genes encoding TCR chains show weak positive correlations (Supple-
mentary Fig. 3d).
S
In addition, we investigated another dataset containing paired single-cell
RNA-seq and TCR-seq data from 20 colorectal canceSr (CRC) and 2 duodenal
cancer patients [27]. This dataset includes samples from tumor tissue, adjacent
E
normal tissue, and peripheral blood collected before and after anti–PD-1 treat-
R
ment. For consistency with our main analysis, we focused on tumor and periph-
eral blood samples and restricted the analyPsis to T cells with paired RNA-seq
and TCR-seq (Supplementary Fig. 4a, M ethods). This resulted in 201,048 T
cells with RNA expression profiles mNeasured across 36,027 genes, each paired
with a corresponding TCR CDR3 βI-chain sequence. As in the HNSCC dataset,
T cells sharing identical TCR clo nes were closer in RNA expression space than
random cell pairs (SupplemenEtary Fig. 4b). Furthermore, RNA–TCR distance
correlations remained weakLeven when using TCR-BERT or CNN autoencoder
embeddings(SupplemenCtaryFig.4c),reinforcingthebroaderapplicabilityofour
pseudoclone framework and model.
I
Building on thTese findings, we next evaluated TRIM in a broader disease
contextusingalargepan-cancerdatasetwithpairedRNAandTCRsequencing
R
data [11]. We filtered the dataset for patients that had both an adjacent normal
A
tissuesampleandatumorsample,eachwithatleast1000cells,andforacancer
type that had at least five patients (Supplementary Fig. 5a). The final filtered
dataset includes 19 patients across 3 cancer types (esophageal cancer, thyroid
cancer, endometrial cancer) and 87,304 T cells. Despite some variation across
cancer types, we consistently observe that identical TCR clones are closer in
RNAspacethanrandomcells(SupplementaryFig.5b-c),similartotheHNSCC
datasetandtheCRCdataset.Additionally,thelackofcorrelationbetweenRNA
and TCR distances, even with TCR-BERT or CNN autoencoder embeddings,
persists (Supplementary Fig. 5d), supporting the broader applicability of our
pseudoclone concept and model. In summary, across multiple settings we con-
firm that there is little relationship between TCR sequence similarity and RNA
expression: clones with very different TCR sequences can present similar RNA
expression profiles.
Next,wetestedwhetherthisholdstruealsoforlargecloneswhereweexpect
to have cells in different activation states. We hypothesized that even within
the RNA expression regions where high clonality cells are, any individual clone
will have cells with RNA expression that are closer to each other than to those
7
ARTICLE IN PRESS
of other clones. To evaluate this hypothesis, we used the HNSCC dataset. As
mentioned before, cells with high clone counts (greater than 10) are enriched in
theRNAspacecorrespondingtotheCD8+Tcells,whilecellswithclonecounts
no more than 10 are distributed across the whole RNA space (Fig. 4a). We cal-
culatedtheaveragepairwiseRNAdistancebetweencellsofthesameTCRclone
(intra-clone distance) and compared it to the average RNA distance between
cellsofdifferentclones(inter-clonedistance)forhigh-countCD8+ Tcellsclones
in the blood (Fig. 4b), and in the tumor (Fig. 4c-d). For the tumor-infiltrating
CD8+ T cells, we distinguished between cytotoxic and non-cytotoxic cells based
on the gene signature reported in [19] (by averaging the expression of PRF1,
GZMA, GZMB, GZMH, NKG7, GNLY). In all cases, intra-clone distances were
significantlysmallerthaninter-clonedistancesonaverageinStheRNAspace(one-
sided t-test, p<0.01; Fig. 4b-d). To ensure that this relationship was not solely
S
drivenbycellsbeingfromthesametissuesource(bloodortumor)orsharingthe
E
same state, we repeated the analysis within individual cell state clusters. The
same pattern held across these finer-grained suRbsets (Supplementary Fig. 6a).
Lastly, we extended the analysis to the smaPll number of high-clonality CD4+ T
cells in the tumor and observed the same trend of higher inter-clone compared
to intra-clone RNA distances (SupplemNentary Fig. 6b).
Thus,ouranalysisdemonstratesthathigh-clonalityTcells,especiallyCD8+
I
cells, exhibit a strong relationship between TCR clonality and RNA expression.
Cells from the same clone areEconsistently closer to each other in RNA space
than to cells from different clones, even within fine-grained clusters.
L
C
TRIM accurately models the RNA distribution space and TCR
I
clonality
T
To evaluate ouRr model’s capability to integrate the RNA and TCR modalities,
we compared the out-of-sample generated data to the ground truth data. We
A
first evaluated TRIM on the HNSCC dataset. The model output in the RNA
space generally matches the ground truth: this is shown to be the case across
each conditional distribution, for held-out patients (Supplementary Fig. 7a).
Importantly, as shown in Fig. 5a, the UMAP of the RNA space for ground
truth cells colored by the true TCR clone count visually matches the UMAP of
the generated RNA cells and their corresponding pseudoclone count. To assess
whether TRIM captures the structure of the RNA space, we performed a clus-
tering analysis. Specifically, we clustered cells in RNA expression space using
k-means (with k = 10, 25, and 50), calculated the median clone count in each
cluster for both real and generated data, and then calculated the correlation
between these values. In other words, we divided the RNA space into distinct
groups and evaluated whether TRIM reproduced the corresponding patterns in
TCR space. Across all clustering resolutions, the correlations were consistently
high (r = 0.92, 0.95, and 0.92 for k = 10, 25, and 50, respectively; Supplemen-
tary Fig. 7b). This demonstrates that our model accurately captures the joint
space at a distribution-level, and that the pseudoclone discretizations are com-
parabletotheinnatelydiscreterealclones.Whiletheseareglobalfeaturesofall
8
ARTICLE IN PRESS
oftheTcellsinthedataset,nextweevaluatewhetherourmodelalsoaccurately
models more granular slices of the data, such as marginal distributions along
each condition.
We next examined the clonotype diversity captured by TRIM for each con-
dition, quantified using Shannon entropy (Methods). The true clonal diversity
and the corresponding predicted pseudoclone diversity were strongly correlated
(r = 0.74; Fig. 5b). To further assess this relationship, we also measured diver-
sityastheproportionofuniqueTCRsineachsample,calculatedbydividingthe
number of distinct TCRs by the total number of cells. This alternative metric
yieldedasimilarlyhighcorrelationbetweentrueandpredictedvalues(r =0.80;
Supplementary Fig. 7c). Together, these results indicate that TRIM effectively
S
captureskeyfeaturesoftheTCRrepertoirewithinitslearnedembeddingspace,
across both tissue sources (blood and tumor) and trSeatment timepoints (pre-
and post-treatment).
E
We then evaluated TRIM on the CRC dataset to assess its generalizability.
R
The model outputs in RNA space closely matched the ground truth, and the
P
correlation between real and predicted clonotype diversity was high (r = 0.67;
SupplementaryFig.8a-b).Amoredetailed clusteringanalysisalsodemonstrated
N
strong agreement between real and generated data, with high correlations in
median TCR clone counts across cluIstering resolutions (r =0.94, 0.85, and 0.86
for k =10, 25, and 50, respective ly; Supplementary Fig. 8c).
E
To examine the robustness of TRIM across different patient populations, we
L
investigated factors such as age and sex using the CRC dataset. We also ex-
plored how varying theCnumber of patients in the training data affected model
performance. SpecificIally, we performed a leave-group-out analysis, where en-
tiresubgroupsweTreexcludedduringtraining—forexample,excludingallfemale
patients, or pRatients in the upper or lower 15th percentile for age or sample
count—and used these groups for testing (Supplementary Fig. 9a). Across these
A
different conditions, TRIM consistently captured the joint RNA–TCR space at
the distribution level, as indicated by high correlations across multiple cluster-
ing resolutions (k =10, 25, and 50; Supplementary Fig. 9b–f).We observed that
higher-resolution clustering makes predicting median TCR clone counts more
challenging,andthisdifficultyisfurtheramplifiedwhenevaluatingsampleswith
few cells, as smaller clusters contain very limited information for accurate esti-
mation.However,TRIMmaintainedstrongperformanceinpredictingclonotype
diversity, with high correlations between real and predicted values (Supplemen-
taryFig.9b–f,rightpanels).Wedidobservereducedgeneralizabilitywhenolder
patients were left out of training (Supplementary Fig. 9d). We hypothesize that
this difficulty in generalization may be due to the distinct properties of this pa-
tients’ subpopulation, which shows reduced T cell clonal diversity. Nonetheless,
the results across all subgroup analyses were consistent, indicating that TRIM
is robust to demographic and sample-size variations.
We also evaluated our model on the pan-cancer dataset [11] (Supplemen-
tary Fig. 10a). To quantitatively assess TRIM’s predictions, we clustered cells
in the RNA space using k means (k = 20) and then calculated the real and
9
ARTICLE IN PRESS
predictedclonaldiversityandmeanclonecountforthatcluster(Supplementary
Fig. 10b). We found a high degree of correlation in both cases, r = 0.97 and
r = 0.97, respectively. In addition, the UMAP projections of the real data and
our model’s predicted data showed that the model had learned to generate, for
held-out patients, accurate RNA expression profiles based on the source (nor-
mal tissue/tumor) and cancer type (esophageal cancer or ESCA, thyroid cancer
or THCA, uterine corpus endometrial carcinoma or UCEC) (Supplementary
Fig. 10c, left plots). Furthermore, the model also learned to match pseudoclone
count in each region of the RNA space to the corresponding ground truth clone
count for that region (Supplementary Fig. 10c, right plots). Together, these re-
sults indicate that the model achieves strong accuracy at both the dataset and
cluster levels. S
S
TRIM accurately predicts clonal expansionEand activation status of
T cells post-treatment
R
Next, we considered the most granular resoPlution: expansion prediction at the
levelofindividualcells.IntheHNSCCdataset,thebloodsamplespre-treatment
included15,147uniqueTCRclones.AmNongthese,725persistedinpost-treatment
blood, with 185 expanded post-treatment. Notably, 66 of these 185 expanded
I
clones(36%)werealsodetectedinthepost-treatmenttumor.And64ofthese66
TCRs expanded in the tumorEpost-treatment. This observation supported prior
findings of a connection between peripheral (blood) and tumor-associated T-
L
cell dynamics [19], motivating us to model T-cell expansion using blood-derived
C
data alone. Due to the challenge of directly predicting TCR sequences, as we’ve
shownbeforethatsinIgle-cellRNAandTCRsequencesarerelatedonlyviaclone
count, we modeleTd expansion at the clone level and restricted the analysis to
TCRs presentRin both conditions. Given a specific TCR and its clone count in
the blood pre-treatment, we aimed to predict whether its clone count would in-
A
crease or decrease post-treatment (normalized by the total number of cells in
each condition). In order to do this, we mapped the TCR in question to the
latent space and obtained the corresponding latent vector z. We then swapped
outthelearnedconditionalembeddingfor”pre-treatment”andinsteadusedthe
learned embedding for ”post-treatment”, and decoded as usual. We compared
the resulting pseudoclone count to the pseudoclone count obtained from decod-
ing the original latent vectors, and if it was higher, predicted expansion. We
defined expansion in the ground truth data as a TCR that is observed in both
timepoints and whose count in the post-treatment distribution is higher than
in the pre-treatment distribution, normalized by the total number of cells in
each condition (see Methods for more details). As shown in Fig. 5c our model
achieved an Area under the Receiver Operating Characteristic Curve (AUC) of
0.92 for this prediction task. In contast, baselines methods, such as a K-nearest
neighbor (KNN) classifier or a multilayer perceptron (MLP), performed similar
totherandombaseline(diagonalline)onpredictingabinarylabelofexpansion,
when given as input the RNA expression, the TCR autoencoder embeddings, or
the concatenation of the two.
10
ARTICLE IN PRESS
Similarly, we evaluated TRIM on the CRC dataset. In leave-one-out evalua-
tion,TRIMachievedanAUCof0.83forpredictingpost-treatmentclonalexpan-
sion, whereas baseline models (KNN and MLP) performed worse than or near
random (even after extensive greedy hyperparameter optimization) regardless
of whether they used RNA expression, TCR embeddings, or their combination
as input (Supplementary Fig. 11a-d, Methods). To further assess robustness,
we tested TRIM in leave-group-out settings, where the test patients had post-
treatmentmeasurements.TRIMmaintainedcompetitiveperformance,achieving
AUCs of 0.68, 0.81, and 0.78 for leave-female-out, leave-young-out, and leave-
more-cells-out evaluations, respectively, while baseline models again performed
near random (Supplementary Fig. 12).
S
We then evaluated TRIM’s ability to predict clonal expansion at individual
cell level in the pan-cancer dataset (SupplementarySFig. 10d). We predicted
whetheraparticularTCRfoundintheadjacentnormaltissuehadahigherclone
E
count in the tumor. We performed this prediction task in the same conditional
R
generative way as in the HNSCC dataset, subset to only TCRs that appear in
both conditions. P
As before, the KNN classifier and neural network baselines that received the
N
concatenation of the RNA and TCR representations performed similar to the
randombaseline,whileourmodelcleIarlyoutperformedthesebaselines.However,
the AUC is lower than in the H NSCC dataset (0.57 vs. 0.92), which can be
E
explainedbytheTcellpopulationsinthecirculatingperipheralbloodcontaining
more information on T cellLpopulations in the tumor than those in the adjacent
normaltissue.WehypotChesizethatthemodel’sabilitytopredictTcellexpansion
in the tumor from adIjacent normal tissue better than random at all is due to
signalingandcomTmunicationbetweentheseTcellpopulations,albeittoalower
degree than with the circulating T cells in the blood.
R
To validate the usefulness of our model for downstream biological analyses,
A
we compared its predictions based on pre-treatment blood data to analyses on
tumor and post-treatment T-cell phenotypes reported in [19] on the HNSCC
dataset (Fig. 5d-e, Supplementary Fig. 13). In [19], the authors reported an ex-
pansion of CD38+/HLA-DR+ proliferative CD8 T cells in the blood over the
course of treatment and found that the frequency of activated KLRG1-negative
PD-1+ CD8 T-cells in the blood pre-treatment and on-treatment was strongly
associated with intra-tumor pathological response. First, we calculated the per-
centage of proliferative CD38+/HLA-DR+ T cells for each condition based on
ourpredicteddataandfoundthatthispopulationincreasesinthepost-treatment
conditions (Supplementary Fig. 13). On a per-patient and timepoint basis, our
model’s predictions are well correlated with the ground truth for this statistic
(r =0.89).Theslopeparameterofaregressionofrealvaluesofthismetricwith
the predicted values inferred from our model’s output is also shown, yielding
β =0.82. Next, we modeled KLRG1 expression in PD-1+ CD8 cells and found
1
that it decreases more for patients that have a pathological response than for
those that do not, with a per-patient correlation of 0.82 (Fig. 5d). Lastly, we
isolatedpredictedCD8+cells,calculatedtheproportionthatareCD38+/HLA-
11
ARTICLE IN PRESS
DR+ and found that this is also strongly correlated with pathological response
(Fig.5e).Ourmodel’spredictionsarehighlycorrelatedwiththerealper-patient
data(r =0.90).Overall,theseanalysesshowthatTRIMgeneratesaccurateand
meaningful predictions of clonal expansion.
TRIM identifies genes associated with clonal expansion
Tofurtheranalyzetheexpansionpredictionaspectofourmodel,weinvestigated
the features it used to perform this task. Namely, we performed a differential
gene expression analysis when comparing all pseudoclones predicted to expand
by our model to those not predicted to expand in the blood T-cells. We then
ranked the genes by their log fold change, subject to thSe restriction of being
expressed in at least 10% of cells. We repeated this process for the ground truth
S
data based on real observed expansion and their measured gene expression in
each condition. We then compared the two rankedElists by considering the in-
tersection of their first k elements, for increasinRg values of k. A random model’s
overlapwouldbeonthediagonalline,onlygettinganintersectionof k genes
P ngenes
in expectation. We first evaluated TRIM on the HNSCC dateset. Our model’s
AUC with respect to this baseline isN0.92 (Fig. 6a). We repeated this process
separately for CD4+ and CD8+ T cell subsets, resulting in AUCs of 0.80 and
I
0.77, respectively (Supplementary Fig. 14a). We also evaluated this aspect of
our model by taking a gene sigEnature of expansion and a gene signature of non-
expansionthatwerepreviouslyidentifiedin[19].Whenwerestrictedouranalysis
L
to these genes and ranked them by log-fold change, expansion-signature genes
C
were more likely to be up-regulated in clones the model predicted to expand
(Fig. 6a). QuantificatIion using a Wilcoxon ranksum test [45] for the hypothesis
whether the modTel ranks the expansion signature genes higher than the non-
expansion signRature genes resulted in a p-value of 0.064. Because the signatures
werederivedfromtumortissuewhereasouranalysismodelsexpansioninblood,
A
weexpectsomeattenuation;nonetheless,theresultshowsadirectionallyconsis-
tentenrichmentandalignswithpriorevidencethattumor-associatedexpansion
programsaredetectableinblood.Thisshowsthatourmodelaccuratelypredicts
notonlywhichcloneswillexpandbutalsowhatgeneswillbecomedifferentially
expressed through that expansion.
Taking this analysis a step further, we probed the model for genes that
are predicted to be differentially expressed (DE) from pre-treatment to post-
treatmentbypseudoclonespredictedtoexpandinblood(SupplementaryFig.14b).
Gene set enrichment analysis of the DE genes revealed enrichment for cell cy-
cle and cell proliferation pathways, expected to be involved in clonal expansion
(SupplementaryFig.14c).Theseresultssupporttheaccuracyofourpseudoclone
gene expression predictions.
We then evaluated TRIM’s ability to identify differentially expressed genes
ontheCRCdataset.Inleave-one-outevaluation,TRIMachievedAUCof0.85for
all T cells, 0.82 for CD4 cells, and 0.79 for CD8 cells (Supplementary Fig. 15a).
Acrossdifferentsubgroupanalyses,TRIMmaintainedstrongperformance,with
AUCsforallTcellsof0.83,0.90,and0.81forleave-female-out,leave-young-out,
12
ARTICLE IN PRESS
and leave-more-cells-out, respectively; for CD4 cells, 0.83, 0.83, and 0.81; and
for CD8 cells, 0.72, 0.84, and 0.72 (Supplementary Fig. 15b-d). These results
further validate TRIM’s ability to generalize to different cancer types as well as
across diverse patient conditions.
ToidentifythegenesthatthemodelutilizesforpredictingCD8Tcellclonal
expansion, we conducted a saliency analysis. This involved creating a classifier
for clonal expansion based on the network’s latent space and examining the
gradients in relation to each input gene. Through this saliency analysis, we gen-
eratedarankingofgenesbasedontheirpredictivepowerforexpansion,ranging
from those strongly negatively predictive to those strongly positively predictive.
We compared this ranking (gradient) with the results of routine DE analyses to
S
evaluate its relevance. Specifically, we examined three DE scenarios: (1) post-
treatment expanded versus non-expanded groups, (2)Spre-treatment expanding
versus non-expanding groups, and (3) a simulatedEcase with no post-treatment
data, comparing cells with large clone sizes versus small clone sizes. For each
R
method,weidentifiedimportantgenesbasedoncorrectedp-values(forDEanal-
P
yses)orrankingscores(inourmethod).Pearsoncorrelationanalysesshowedthat
thegenesidentifiedasimportantforourm odeltopredictclonalexpansionalign
N
more closely with the pre-treatment expanding versus non-expanding compari-
son (0.52) than with the other twoIDE approaches (-0.07 and 0.22) (Fig. 6b).
FromFig.6c,weobservethatgrad ientgeneshavelimitedoverlapwiththegenes
E
identifiedthroughlog-foldchangesinpost-treatmentandclone-sizecomparisons,
and a relatively larger numLber of shared genes with the pre-treatment DE list.
C
To further assess the biological relevance of the genes identified by each ap-
proach, we performedIGene Ontology (GO) term enrichment analysis using the
gseapy package [4T6] (Supplementary Fig. 16, Methods). We found that the gene
sets identifiedRas enriched among gradient based genes largely agreed with gene
sets identified using the more standard DE analyses (Supplementary Fig. 16).
A
We then queried ChatGPT to compile a list of genes associated with T-cell
expansion and analyzed the resulting lists across methods (Fig. 6d). This anal-
ysis was inspired by the findings in [47], which demonstrated the potential of
largelanguagemodelsforannotatinggenesets.Ourmethod(“Gradient”),along
with the supervised methods that utilized post-treatment labels (“Expanded
vs.non-expanded”and“Expandingvs.Non-expanding”),successfullyidentified
genes involved in cell cycle (AURKA, CENPU, DUT), T cell effector function
and cytotoxicity (PRF1, GZMA, GZMH, GNLY, NKG7, CST7), T cell acti-
vation and co-stimulation (CTLA4, TNFRSF9), mitochondrial and metabolic
pathways (ATP5PF, VDAC2, DHTKD1, IBA57), and T cell migration (CCR7,
CCL5, IL6R, FOXO1). Notably, the CD38+ CD8 T cells that expanded in
blood during treatment were previously shown to exhibit activation and prolif-
erative signatures; here, the identification of a T cell migration signature is new
and suggests these cells may traffic to the tumor and lymph nodes, which is
consistent with this population having TCRs that expanded in tumors during
therapy. Importantly, while the supervised differential expression (DE) analyses
serveastheoreticalupperbounds—becausetheyrelydirectlyonpost-treatment
13
ARTICLE IN PRESS
labels—ourmethodwasabletorecoversimilarbiologicalsignalswithoutrequir-
ing post-treatment measurements at inference time. Although TRIM requires
access to paired pre- and post-treatment data during training, once trained, it
can be applied to new pre-treatment-only samples to identify gene programs
associated with T-cell expansion. This capability provides both model inter-
pretability—bydemonstratingthatitspredictionsaredrivenbymeaningfulbio-
logical signals—and clinical relevance, as it provides these predictive insights in
a common clinical setting where post-treatment samples are unavailable. This
enables TRIM to provide meaningful insights in settings where post-treatment
measurements are not available, bridging the gap between supervised analyses
and real-world applicability. In contrast, differentially expressed genes identified
by comparing large versus small clones pre-treatment weSre enriched for cyto-
toxic, effector, and immune-regulatory programs but did not show significant
S
enrichment for expansion-related programs (assessed via hypergeometric tests
E
per gene set with FDR correction; enrichment shown as −log FDR-adjusted
10
p-values in Fig. 6d). This suggests that TRIMRprovides a more informative and
biologically grounded view of T-cell expansiPon under real-world constraints.

Methods
TRIM
Let the data be captured by two matrices X
RNA
∈ Rn×dRNA and X
TCR
∈
Rn×dTCR where n is the number of cells and d
RNA
and d
TCR
are the dimen-
sions of the RNA modality and TCR modality, respectively. Each cell also has
associatedconditionlabelsl composedof:patientl ∈{0...n },treatment
p patient
timing l ∈ {pre-treatment,post-treatment}, source l ∈ {blood,tumor}, where
t b
n denotes the number of patients in the dataset.
patient
Our model consists of two encoders E (x|l), E (x|l) and two decoders
RNA TCR
D (z|l), D (z|l). The encoders take as input cells from their respective
RNA TCR
modality x ∼X and x ∼X and produce latent representations
RNA RNA TCR TCR
µ
RNA
,σ
RNA
,µ
TCR
,σ
TCR
in the latent space Rn×dz, where d
z
is the chosen
dimensionality for the latent space. These latent representations are averaged
into one vector along the latent dimensions µ = mean(µ ,µ ) and σ =
RNA TCR
mean(σ ,σ ). They are then used to parameterize a normal distribution
RNA TCR
which is sampled from and then given to the decoder along with the original
conditions to produce outputs x˜ ,x˜ respectively. Taken together, this
RNA TCR
16
ARTICLE IN PRESS
produces:
µ ,σ =E (x |l) (1)
RNA RNA RNA RNA
µ ,σ =E (x |l) (2)
TCR TCR TCR TCR
z∼N(mean(µ ,µ ),mean(σ ,σ )) (3)
RNA TCR RNA TCR
x˜ =D (z|l) (4)
RNA RNA
x˜ =D (z|l) (5)
TCR TCR
The encoders and decoders are trained jointly under a variational autoen-
coderregime[52].ThereisaKL-divergencelossthatencouragesthelatentvector
to be distributed as a normal:
S
L =KL(N(µ,σ),N(0,I)). (6)
KL
S
Contrastive clonality loss E
The reconstruction loss encourages the output tRo be close to the original points.
FortheRNAspace,weusethestandardL
2
loPss.FortheTCRspace,weintroduce
the contrastive clonality loss:
(cid:88) N
L = I ·d +(1−I )·max(0,δ−d ), (7)
cc ij ij ij ij
I
i,j
where d
ij
= ||x˜
TCRi
−x˜
TCRj
|E|
1
, I
ij
= 1 if i = j and I
ij
= 0 if i ̸= j, and δ is a
chosen margin. Thus the full reconstruction loss is:
L
LC=||x −x˜ || +L . (8)
recon RNA RNA 2 cc
The contrastive cIlonality loss operates on the decoder output in the TCR
space; it uses anTindicator variable to select reconstructions of cells that are
identical TCRRclones and minimizes the distance between their reconstructions.
Forallotherpairsofcells,theirreconstructionsintheTCRspacemustbesepa-
A
ratedbyatleastthemarginδ.ThereconstructedTCRspacethuspreservessome
aspects of the original space, namely that TCR clones are close together. The
reconstructedTCRspaceisnotenforcedtopreservetheglobalstructureoutside
of clones, though. The idea to only preserve local clone information in our joint
RNA and TCR model, rather than a) preserve global TCR space information,
or b) preserve no TCR space information is motivated by our observations in
Figures 3 and 4. TCR clones are closer in the RNA space than random, even
after accounting for factors such as cell type, so including that information is
valuable for the representation. But outside of exact clones, no embedding of
the TCR space yielded a distance structure that was predictive of the RNA
space. Using instead the standard L reconstruction loss, the model would have
2
to store enough information in the latent space z to fully reconstruct the TCR
representationsofallpoints.SincetheTCRspacedoesnotsharethesamepair-
wisedistancestructureastheRNAspace,forcingthemodeltofullyreconstruct
the TCR space would worsen its performance in the RNA space. In summary,
our contrastive clonality loss enforces the model to learn a reconstruction that
preserves only the local TCR structure that is informative for the RNA space.
17
ARTICLE IN PRESS
Pseudoclone assignment
Since our generative model samples from a continuous random distribution, its
decoded output in the TCR space is also continuous. To compare metrics based
onclonecount,whichaswe’veshowninFigures3and4istheonlysignalshared
between the RNA and TCR spaces, the generated output must be discretized.
The procedure we use to do this is a greedy algorithm that chooses a random
generatedcell’sTCRrepresentationandassignsallothercells’TCRrepresenta-
tions to the same clone if they are within δ (the margin used in the contrastive
clonality loss) and belong to the same patient. We call these assigned clones
pseudoclones, emphasizing that the generated TCR space is not globally simi-
lar to the real TCR space. This process continues until aSll cells have received
a pseudoclone assignment. During data preprocessing, TCR clone counts were
S
computed at the dataset level rather than per patient. This may slightly affect
E
expansion counts for TCRs shared across patients, though such cases are rare
(less than 1%). R
P
Learning condition embeddings N
I
TRIM is a conditional model that takes as input conditions corresponding to
the patient, source, and timepoint of the cell being encoded or decoded. These
E
conditions are represented as fixed-length vectors that are learned jointly with
L
the rest of the model through the use of a separate embedding network F. As
C
depicted in Figure 2a. This network takes in cells from a fixed subset of n
emb
trainingcells,acollecItionwhichwewillrefertoasS ,andoutputsthemintoa
emb
d -dimensionalTspace.Thesesamecellsarethengroupedandaveragedbyeach
emb
differentcondiRtionallabeltocalculatetheembeddingvectorforthatconditional
label.Forexample,thed -dimensionalvectorforthepre-treatmenttimepoint
A emb
is calculated by averaging over the representation in the output space of F for
pointsinS thatarepre-treatment,eachofwhichisad -dimensionalvector.
emb emb
More generally, the representation for condition c is calculated as:
n
1 (cid:88)
v = I ·F(x ), (9)
c n (cid:80)embI li=c i
li=c i=1
i=1
wherex andl arethescRNAseqvectorandconditionofcelli,respectively.For
i i
the patient embedding, we first subset the embedding points to just the blood
source and pre-treatment timepoint, as our use case requires extrapolating to a
patientwhereonlythesecellsareavailable.Itisimportanttonotethatthemodel
doesnotusethearbitrarypatientIDasadirectfeature.Instead,thepatientID
serves as a grouping key. The model learns a patient-specific embedding vector
by aggregating the pre-treatment blood-derived RNA and TCR data for that
specific patient (as described above). This learned vector, which captures the
patient’suniquebiologicalbaseline,iswhatisusedasthepatient-levelcondition.
18
ARTICLE IN PRESS
These embeddings are learned using both the RNA and TCR representation
of each cell, i.e., F consists of two networks F and F , and F(x) is the
RNA TCR
dimension-wise average of F (x ) and F (x ).
RNA RNA TCR TCR
The motivation behind this method of learning embeddings is that the stan-
dard way of learning a conditional vector would be to index into a randomly
initiated embedding matrix whose parameters are learned during training. This
works for the source and timepoint vectors, because these are low cardinality
variables (each can take on only two possible values), and our predictions will
not take place on novel values of these variables. For the patient embedding,
however, there is no obvious and effective way of learning an appropriate vector
thatwillallowforaccurateextrapolationtonewunseenpatients.Weattempted
to use patient metadata, but the model was unable to acScurately generate in-
formative RNA or TCR distributions. We found that oSnly the patient’s RNA or
TCRdistributioninonesource/timepointcouldaccuratelypredictthatpatient’s
E
RNAorTCRdistributioninanothersource/timepoint.Thus,weformulatedthe
R
problem as a conditional generation of a patient’s blood post-treatment, tumor
pre-treatment, and tumor post-treatment dPistributions based on a patient em-
beddinglearnedfromthebloodpre-treatm entfromthatpatientandthegeneral
embeddings for the source and timepoNint effect learned in this way.
I
Shannon entropy E
L
ShannonentropywasuCsedtoquantifyTCRclonediversity.Foreachsample,we
identifiedallobservedT-cellclones,countedthefrequencyofeachuniqueclone,
I
and converted theTse counts to probabilities by dividing by the total number of
observations. Entropy was then calculated as
R
A (cid:88)
H =− p log p , (10)
i 2 i
i
where p represents the probability of clone i.
i
Saliency analysis
The saliency analysis on the HNSCC dataset was done to evaluate how TCR
expansion in CD8 T cells is being predicted from the pre-treatment blood data
inthepresentedmodelframework.Todothis,wereplacedthelatentlayerofthe
autoencoder with a binary prediction layer that outputs a one-hot vector corre-
spondingtowhethertheinputcell’sTCRexpandsinthepost-treatmentsample,
withoutusingthedecoderlayer.Wetrainedanotherwiseidenticalversionofthe
model and usde the PyTorch autograd function to evaluate the gradient of the
expansion prediction output with respect to each input gene [53]. The gradients
were then averaged across all cells in the distribution to get the reported mean.
19
ARTICLE IN PRESS
Differential gene expression analysis
To compare with routine analysis, we calculated log-fold changes of genes under
differentconditions:betweenexpandedandnon-expandedclonespost-treatment,
between expanding and non-expanding clones pre-treatment, between clones
with sizes greater than 10 and smaller than 10 pre-treatment, and between
clones with sizes greater than 1 and smaller than 1 pre-treatment. These log-
fold changes were calculated using the FindMarkers function from the Seurat
package [54].
To identify significant genes detected by each method, we applied specific
criteria: for the log-fold change method, we selected genes with an adjusted p-
value < 0.01, and for the gradient-based method, we selected the top 1% of
S
genes with the highest or lowest gradients. To further understand the biological
S
relevanceofthesegenes,weperformedgenesetenrichmentanlaysisusinggseapy
package [46]. For visualization, we selected the topE15 significantly enriched GO
terms (adjusted P-value < 0.1) from each meRthod, and plotted the union of
these terms in Supplementary Fig. 16. Full enrichment results are provided in
P
Supplementary Data 1. Furthermore, we compiled the union of significant genes
identified across all methods and used ChatGPT to identify and highlight gene
N
sets specifically relevant to T-cell expansions, drawing on the findings in [47].
I
Datasets E
L
HNSCC dataset:Thisdatasetisderivedfromthepubliclyavailabledatafrom
C
[19]. We used paired scRNAseq and scTCRseq data from 28 patients across
4 different conditionIs: blood pre-treatment, blood post-treatment, tumor pre-
treatment and tuTmor post-treatment. The pre-treatment and post-treatment
timepoints areRthe B1 and B2 timepoints in the reference paper, respectively.
Colorectal cancer dataset:Thisdatasetisderivedfromthepubliclyavailable
A
data from [27]. We used paired scRNAseq and scTCRseq data from 22 patients
across 4 different conditions: blood pre-treatment, blood post-treatment, tu-
mor pre-treatment and tumor post-treatment. In the source study, “pre-” and
“post-treatment” correspond to baseline and on-treatment visits. Because some
patientshadmultipleon-treatmentsamples,weaggregatedthosemeasurements
at the patient level for each condition to make full use of the data.
Pan-cancer dataset: This dataset is derived from the publicly available data
from [11]. We applied filtering for patients with samples containing at least
1000 cells in both the tumor and adjacent normal tissue. This resulted in 19
patientsand3cancertypes:ESCA(esophagealcancer,5patients),THCA(thy-
roid carcinoma, 8 patients), and UCEC (uterine corpus endometrial carcinoma,
6 patients).
Processing of single-cell data
Welog-transformedandnormalizedtheRNAexpressionofeachcellandtrained
ourmodelonthefirst100principalcomponentsofthedata.WepaddedtheTCR
20
ARTICLE IN PRESS
sequencetolength80(themaximumlength)oftheone-hotrepresentationsofthe
aminoacidsandanulltokenwhenperformingstringprocessing.Wenormalized
the TCR counts by the total number of cells in each slice of interest (e.g. when
comparing pre-treatment counts to post-treatment counts, the respective total
numberofcellsineachdistributionwasusedasthedenominator).Thesamewas
done for turning generated pseudoclone counts into proportions for comparison.
Expansion across a variable, for example “treatment”, was then defined as a
TCR being observed in both distributions and having a higher proportion in
post-treatment than pre-treatment distributions.
TCR representations
S
The TCR representations used in TRIM are based onSthe trained embeddings
obtained from a CNN autoencoder that we learnEed in a pre-processing step.
Each TCR was represented by its CDR3 sequence from β chain, which was
R
input to the model as a null-padded sequence of amino acids. Each amino acid
was encoded using its corresponding AtchPley factors. The CNN autoencoder
consists of an encoder with 3 layers, bat ch norm, and leaky ReLU activation
that maps into the 100-dimensional lNatent space. The decoder is a symmetric
convolutional network. It is trainedIfor 50,000 steps and then the middle latent
layer is extracted and used as the input to TRIM.
E
L
Heldout patient prediction
C
TomaximizetheutiliItyofthedata,wetrainedonallbutonepatient’sdata,and
thenusedtheheldT-outpatientfortesting.Werepeatedthisinacross-validation
process for eaRch patient to obtain the full set of predictions. To assess model
robustness, we additionally performed a leave-group-out evaluation, in which
A
patients with predefined characteristics were excluded during training, and the
model was evaluated on this entire held-out group.
When generating cells for each patient, we used a fully generative sampling
process that does not simply autoencode/decode the real input points. Namely,
wesampledrandomlyfromanisotropicGaussian,concatenatedthetargettime-
point and source embedding (e.g. “tumor” and “post-treatment”), and then
decoded:
z∼N(0,I),
x˜ =D (z|l),
RNA RNA
x˜ =D (z|l).
TCR TCR
As a result, the predictions of our generative model cannot be compared to real
data on a cell-by-cell basis, as each z sampled from the Gaussian distribution is
random.However,thedistributionofcellsperconditioncanbecomparedtothe
realdistributionofcellsforthatcondition,andlikewiseforanyotheridentifiable
subset of conditions, or even the distribution across the whole dataset.
21
ARTICLE IN PRESS
Metric for benchmarking
The performance of TRIM and baseline methods for predicting TCR expan-
sion was evaluated using the Area Under the Receiver Operating Characteristic
(ROC) Curve (AUC) metric. The AUC measures the ability of the model to
distinguish between positive and negative classes by calculating the area under
the ROC curve, which plots the true positive rate against the false positive rate
across various classification thresholds. This metric is used to assess the over-
all discriminative ability of a model, with higher AUC values indicating better
performance.
S
Data availability
S
All datasets used in this project have been previoEusly published and are pub-
licly available. The Head and Neck Squamous Cell Carcinoma (HNSCC) T cell
R
dataset [19] is available in the Gene Expression Omnibus (GEO) database un-
deraccessioncodeGSE200996.TheColorectPalCancer(CRC)Tcelldataset[27]
is available in the GEO database under accession code GSE236581. The pan-
cancer T cell dataset [11] is availableNin GEO database under accession code
GSE156728. I
E
Code availability
L
C
All code for this project is available at https://github.com/uhlerlab/TRIM
and on Zenodo httpIs://doi.org/10.5281/zenodo.18421428. The repository
T
also contains a list of the required open-source packages with version numbers,
a tutorial forRdata pre-processing, the code for reproducing the figures in the
manuscripAt.
22

Peer review rounds
[{"round": 1, "reviewer_comments": {"reviewer_1": "He, C., Amodio, M. et al. introduces TRIM (TCR-RNA Integrating Model), a multimodal conditional variational autoencoder designed to jointly analyze T cell RNA and TCR sequence data. TRIM aims to learn a shared representation of transcriptomic and TCR clonality information, conditioned on key clinical and biological covariates such as patient identity, tumor vs other tissue, and treatment timepoint. The authors apply the model to two datasets: one comprising head and neck squamous cell carcinoma (HNSCC) patients sampled before and after checkpoint inhibition from blood and tumor, and another consisting of a pan-cancer RNA-TCR dataset with tumor and normal-juxta tissue. The model demonstrates predictive capabilities for T cell clonal expansion and transcriptional states, highlighting its potential utility in modeling T cell responses under treatment.\nThe study is timely and introduces a new approach for integration of these single-cell data modalities. The manuscript is clearly motivated, and the proposed method shows promising results in the field of immunotherapy outcome predictions. However, several aspects of the methodology and evaluation require clarification or expansion. Below, I provide detailed major and minor comments that could strengthen the manuscript.\nMajor Comments:\n• The authors highlight repeatedly that in their analyses, although cells with identical TCRs are very close in gene expression space, gene expression differences between cells with different TCRs is unrelated to TCR similarity. This seems to be in strong contrast to reports showing that the TCR sequence can be predictive of T cell fate such as DOI: 10.1016/j.celrep.2024.115098, DOI: 10.1101/2025.05.31.657155, DOI: 10.1038/s41587-021-00989-2, DOI: 10.1038/s41590-022-01129-x. This apparent discrepancy needs to at least be extensively discussed, and preferably explained, in the current manuscript.\n• What is the rationale for using only the beta chain? Clarifying this choice would help assess how much signal is potentially missed by excluding the alpha chain.\n• Why was Hamming distance used for TCR similarity, whereas Levenshtein distance is more commonly adopted in TCR studies? Levenshtein allows exploration of amino acid-level mismatches that Hamming does not.\n• Performance on the pan-cancer dataset appears notably more modest than on HNSCC. This suggests potential limitations in generalization, and questions its contribution on a clinical perspective. Perhaps the difference comes from the source of healthy tissue (blood in HNSCC, juxta-tumor in pan-cancer). Can the authors identify another public dataset with blood and tumor (inline with the HNSCC cohort) to evaluate this possibility ?\n• Page 10, towards end of last paragraph “When we isolated this subset of genes in our model’s ranking by log fold change, we found that, as expected, the expansion signature genes were more likely to be differentially expressed in clones that the model predicted to expand (Fig. 5a).” : Given that the p value for this test is 0.064, I do not understand why it is described as a positive result.\nMinor Comments:\n• Consider comparing TCR-derived distances to those in the gene expression PCA space as a control of model latent space structure (and deformation).\n• How do VDJ gene usages structure the TCR space? This could provide insight into how biologically meaningful the learned representations are, and also how just using these information could be sufficient for the model.\n• Figure 4A, for comparing real vs generated data patterns, it would be helpful to include a more quantitative analysis than the two UMAPs. Eg perhaps a clustering analysis or “contour line” visualization would be more informative.\n• Fig 4B and middle of first full paragraph on page 8 “We found that the true clonal diversity for each condition and the predicted pseudoclone diversity for that condition are strongly correlated (r = 0.80)” : Including other repertoire metrics like Shannon entropy could help quantify clonal diversity more robustly.\n• Extended Fig 6C and end of last full paragraph on page 8 “Furthermore, the model also learned to match pseudoclone count in each region of the RNA space to the corresponding ground truth clone count for that region (Extended Data Fig. 6c, right plots). Together, these results indicate that the model achieves strong accuracy at both the dataset and cluster levels.” : Consider including more quantitative metrics of “accuracy” beyond clonal expansion and UMAP visualization, such as Euclidean distance in PCA space based on TRIM embedding or directly in TRIM latent space.\n• Clone count distribution should be shown at the dataset level for both real and generated data to assess the generative model’s ability to reproduce this distribution.\n• UMAP: It is unclear which embedding is being visualized, TRIM’s latent space or the gene expression PCA? This needs clarification at the beginning of the paper or in the Methods.\n• Page 6 4th line of 2nd full paragraph, page 7 middle of first full paragraph, and page 12 5th line from top use the word “significantly” but it’s not clear a statistical test has been performed. Please clarify with details of the test or choose a different word.\n• The list of genes identified across different methods in Figure 5 should be made available as supplementary material to enhance transparency and reproducibility.\n• Is the scRNA-seq data log-transformed before analysis? This detail should be stated explicitly.\n(Remarks on code availability)\nI verified that the github page exists but I did not try installing or running the code. From my brief look, it seems this code is only to reproduce the figures of the manuscript, not to actually run the model on new datasets", "reviewer_2": "The study reported TRIM as a promising tool for predicting T cell states and responses to cancer immunotherapies using peripheral blood measurements. While the initial findings are encouraging and highlight the potential for clinical application, there are several areas that warrant further clarification and expansion to enhance the study's impact and translational relevance.\nMajor comments:\n1. The study would be strengthened by a more in-depth analysis of inter-individual variability in immune responses. Key factors such as age, sex, race, and genetic background are known to significantly impact immune cell behavior and responses to immunotherapy. It remains unclear whether TRIM accounts for these sources of variation or how its predictive performance may differ across diverse patient populations. Including data analysis based on clinicopathological features in the patient cohorts would provide a more comprehensive assessment of TRIM’s potential for equitable application in clinical practice.\n2. In this study, the authors applied TRIM to T cells isolated from both blood and tumor biopsies of patients with HNSCC. However, the rationale behind selecting HNSCC as the disease model is not clearly explained.\n3. The patient data used to validate the predictive value of TRIM were all derived from relatively less prevalent cancer types, including HNSCC, ESCA, THCA, and UCEC. While these datasets provide initial support for TRIM’s utility, validation in more common and clinically impactful cancer types, such as breast and prostate cancer, would significantly strengthen the generalizability and translational relevance of the findings. Including such high-prevalence cancers for data validation is required to enhance the clinical applicability of the tool.\n4. While the study identifies numerous genes and gene signatures through the application of TRIM, there is a lack of in- depth interpretation and biological context provided for these findings. Further analysis and discussion are needed to clarify the functional relevance of these genes, their potential roles in T cell biology or immunotherapy response,\n5. It would be great to discuss on how sample size of patients contributes to the predictive power of the TRIM model.\n(Remarks on code availability)", "reviewer_3": "This study takes single cell RNA transcriptomic data and TCR data from blood and tumour and integrates them into a single low dimensional latent variable (coded as a Gaussian of specified mean and variance in a space of predetermined dimension), which can then be decoded so as to produce a generative model of transcriptional state and TCR. It adds to a growing body of literature which addresses integration of multimodal data. The model is used to investigate the relationship between TCR and transcription, and to predict population-level features as well as individual cell expansion in tumour and blood pre-and post- treatment , based on pretreatment blood alone.\nI would summarise the most important findings as 1. Transcriptional state of T cells from the same clone are more similar to each other than to other clones, but for non-identical TCRs there is no relationship to transcriptional state. 2. The expansion potential of a TCR can be predicted from its pre-treatment transcriptional state (as shown in the original paper).\nI was less convinced by the comparisons between TRIM and other ML approaches to prediction – its hard to directly compare, and to ensure that the other methods have been optimised at hyperparameter level. I was also not completely convinced about the insights into the gene prediction section. Why do the authors think that prediction of genes driving expansion is better or more complete than using the actual differential gene expression profiles for those T cells which expand Is the imposition of similar transcriptional profiles for the same clone somehow reducing the noise in some way?\nI wondered why patient id is encoded in the model? Surely id is a totally arbitrary field ? Why does its encoding need learning ?\nI am not convinced of the predictive features of the model – leave-one-out prediction from a single data set is not equivalent to validating in an independent cohort, even with the same treatment and/or cancer, let alone more broadly. And, at least to my understanding, the validation in a second data set involved re-learning the model with the second set of data. So its unclear how generalizable the models are.\nIn summary, the concept of TRIM is elegant and the fact that it is possible to encode the combined TCR/transcription profile in a low dimensional latent Gaussian variable and retain useful information is interesting. I am not convinced that the findings from application of the model so far substantially advance the field.\n(Remarks on code availability)\nI did not have time to install adn test teh code on an HPC."}, "author_response": "We thank the reviewer for recognizing the importance of our work and their careful review. We address the issues raised by the reviewer in our point-by-point response below. Edits to the manuscript in response to the reviewer’s comments are highlighted in red in the revised manuscript.\nMajor Comments:\n• The authors highlight repeatedly that in their analyses, although cells with identical TCRs are very close in gene expression space, gene expression differences between cells with different TCRs is unrelated to TCR similarity. This seems to be in strong contrast to reports showing that the TCR sequence can be predictive of T cell fate such as DOI: 10.1016/j.celrep.2024.115098, DOI: 10.1101/2025.05.31.657155, DOI: 10.1038/s41587-021-00989-2, DOI: 10.1038/s41590-022-01129-x. This apparent discrepancy needs to at least be extensively discussed, and preferably explained, in the current manuscript.\nWe thank the reviewer for this question. This is an important point raised by the reviewers, and we have added a deeper discussion of the relationship between TCR sequence and T cell state, and how fate is shaped by TCR-intrinsic vs extrinsic factors. Briefly, the model raised by the reviewer is that T cells with similar TCR sequences have similar transcriptional programs because their TCRs have similar antigen specificity, signaling strength, and encounter similar tissue microenvironments that then drive convergence to similar functional states. As a counterpoint, even T cells with shared TCR sequences may diverge in their functional states due to TCR-extrinsic factors: variable antigen and cytokine exposure, variable costimulatory molecules, epigenetic plasticity, and stochastic cell fate bifurcations, e.g. one daughter T cell acquires a memory fate and the other an effector fate (DOI: 10.1016/j.coi.2009.05.021 and DOI: 10.1038/s41590-022-01337-5).\nCoNGA was one of the first frameworks for systematically identifying correlations between TCR sequence and gene expression (DOI: 10.1038/s41587-021-00989-2). Interestingly, these correlations often highlighted unconventional T cells such as mucosal-associated invariant T (MAIT) cells and invariant natural killer T (iNKT) cells, and the authors noted that successfully applying their method required a large number of clonotypes (100s) and an even larger number of T cells (10s of thousands). This observation is held up in the authors’ recent, more expansive effort metaCoNGA (DOI: 10.1101/2025.05.31.657155) that analyzed 6 M T cells across 91 studies. Again, the authors observed TCR-gene expression correlations in unconventional T cells (iNKT, MAIT, KIR+ CD8+ T cells), as well as in T cells with TCRs sharing the same target antigen. While significant, this was not a widespread correlation; only 9% of CD8+ and 2% of CD4+ T cell gene expression graph neighborhoods showed significantly similar TCR CDR3 sequences. So similarities in TCR sequence and antigen specificity do drive similar T cell fates, but this effect does not explain the majority of the T cell phenotypes.\nIn parallel work, Raychaudhuri et al. (DOI: 10.1038/s41590-022-01129-x) identified TCR features that promoted the Treg cell fate and then developed a scoring system (TiRP) to predict cell fate (Treg or Tconv) based on those TCR features. They then expanded this work (DOI: 10.1016/j.celrep.2024.115098), using ML models and TCR biophysical features to define four TCR scoring functions that quantify T cell fates encoded by the TCR: “TCR-innate’” to predict the innate-like, PLZFhigh state, “TCR-CD8” to predict the CD8+ state, “TCR-reg” to predict the Treg cell state, and “TCR-mem” to predict the memory state. Consistent with the CoNGA work, the strongest relationships between TCR sequence and transcriptional cell fate were found in unconventional or very specific T cell subsets, like MAIT cells and KIR+ HELIOS+ CD8 T cells. The authors also acknowledged the contributions of TCR-extrinsic effects: the amount of variance in T cell state explained by the TCR is significant but modest considering the full diversity of the repertoire. For any given TCR, specific antigenic contacts and co-stimulatory signals are likely the major determinants of T cell phenotype.\nTo summarize, the above four works establish that TCR sequence provides information on both antigen specificity and transcriptional cell fate, but the effect is largest in unconventional T cells and still, TCR-extrinsic effects are the larger determinant of fate. Our study does not contradict these findings. Although we found little relationship between TCR sequence similarity and RNA expression–measured by Hamming distance or Levenshtein distance (see below)-- activated and expanded T cells clones with very different TCR sequences can present similar RNA expression profiles. We leveraged this relation to generate accurate RNA and TCR distributions across conditions, and extrapolate clonal expansion and gene expression for unseen patients or conditions. In response to the reviewer, we cover this seeming discrepancy in the discussion. A major contribution of our work is to also show that clonal expansion, derived from the TCR sequence, also informs T cell fate. We performed additional analysis to check our datasets for the presence of unconventional T cells, verifying lack of expression of marker genes TCRD, TCRG, and very low level of expression for RORC (Response Fig. 1).\nResponse Figure 1. Expression distribution of gene RORC in the HNSCC dataset.\nIn response to this comment, we added the following text to the Discussion: “We observed little relationship between cells’ similarity in their TCR sequences and their gene expression values, contrasting with reports that TCR sequences can predict T cell fate outcomes. T cells with similar TCR sequences may have similar transcriptional programs because their TCRs have similar antigen specificity, signaling strength, and encounter similar tissue microenvironments that then drive convergence to similar functional states. However, even T cells with shared TCR sequences may diverge in their functional states due to TCR-extrinsic factors: variable antigen and cytokine exposure, variable costimulatory molecules, epigenetic plasticity, and stochastic cell fate bifurcations [48,49]. Previous studies, including CoNGA, metaCoNGA, and a range of TCR scoring frameworks (TiRP, TCR-innate, TCR-CD8, TCR-reg, TCR-mem), systematically examined the relationships between TCR sequence and gene expression, and established that TCR sequence provides information on both antigen specificity and transcriptional cell fate [32,40,50,51]. However this effect was largest in unconventional T cells, which are not present in our data, and TCR-extrinsic effects were the larger determinant of T cell fate.”\n• What is the rationale for using only the beta chain? Clarifying this choice would help assess how much signal is potentially missed by excluding the alpha chain.\nWe thank the reviewer for this question. A known experimental limitation of single cell V(D)J-Seq is that the TCR alpha and beta chains are not always paired, due to difficulty in capturing their transcripts in single cells. In a typical scV(D)J-Seq experiment (e.g., in the blood samples in PMID 35803260), 87% of cells have both the alpha and beta chain sequence recovered, and the beta chain is recovered at a higher frequency compared to the alpha chain (95% vs 89%). Across the largest TCR sequence databases, 94% of sequences contain only the beta chain (PMID 36755161). This is an area for further development as scV(D)J-Seq technology advances. In other publications that model both chains, performance increases, albeit marginally, and this is likely because the CDR3 beta sequence is the largest contributor in the TCR sequence to determining peptide-MHC interaction specificity (PMID 11696602, PMID 10542151).\nWe have added the following text to the second paragraph of Results section 1 to clarify this aspect: “We focus on the β chain for practical and biological reasons. First, in single-cell V(D)J sequencing, α–β pairing is often incomplete. In blood samples profiled in [19], 87% of cells have paired chains, with β recovered more frequently than α (95% vs. 89%). More broadly, large public TCR resources are predominantly β-only, with 94% of sequences containing only the β chain [41]. Second, prior studies that include both chains report only marginal performance gains, likely because the CDR3β sequence is the dominant determinant of peptide–MHC specificity [42,43]. Given these experimental constraints and data availability, we use the β chain to maximize sample coverage while retaining most of the relevant signal.”\n• Why was Hamming distance used for TCR similarity, whereas Levenshtein distance is more commonly adopted in TCR studies? Levenshtein allows exploration of amino acid-level mismatches that Hamming does not.\nWe thank the reviewer for raising this point. To address this concern, we repeated the analysis using Levenshtein distance instead of Hamming distance. The results are presented in two new figure panels (Extended Fig. 2b and Extended Fig. 4c) and are copied below in Response Figure 2 for convenience. We found that the findings remain consistent: Cells from the same clone (0-Levenshtein) are generally closer in RNA space. For non-clonal pairs, their relative positions in RNA space are approximately the same regardless of whether their TCRs differ by a single amino acid or by many.\nResponse Figure 2. Comparison of pairwise cell distances in RNA and TCR spaces via Levenshtein distances for the HNSCC dataset (Extended Data Fig. 2b) and the Pan-cancer dataset (Extended Data Fig. 4c)\n• Performance on the pan-cancer dataset appears notably more modest than on HNSCC. This suggests potential limitations in generalization, and questions its contribution on a clinical perspective. Perhaps the difference comes from the source of healthy tissue (blood in HNSCC, juxta-tumor in pan-cancer). Can the authors identify another public dataset with blood and tumor (inline with the HNSCC cohort) to evaluate this possibility?\nWe thank the reviewer for this comment. This is an important point, and we agree that the source of healthy tissue (peripheral blood vs. normal adjacent tissue) is a potential confounder. To directly evaluate this possibility and assess the generalizability of TRIM, we have validated our model on a new, independent dataset as suggested. We identified a recent colorectal cancer (CRC) cohort from Chen et al. (2024, Cancer Cell, PMID 38981439), which, like our HNSCC cohort, includes paired single-cell RNA-seq and TCR-seq data from tumor tissue and peripheral blood samples, collected both before and after anti-PD-1 treatment.\nWe focused our analysis on 201,048 T cells from the tumor and peripheral blood samples among 22 patients. The corresponding results are reported in the new Extended Data Figures 3,7,10,14 and copied below. We first confirmed that this dataset exhibits the same core challenge as the HNSCC data: while T cells sharing identical TCR clones are closer in RNA expression space, the overall RNA-TCR distance correlations remain weak, even when using advanced TCR embeddings (Extended Data Fig. 3b-c). This reinforces the broad applicability and necessity of our pseudoclone framework.\nWe then evaluated TRIM's performance on this new CRC dataset with the following results:\n1. Model fidelity: The model's outputs in RNA space closely matched the ground truth data. We observed a high correlation between real and predicted clonotype diversity (r = 0.67; Extended Data Fig. 7a-b) and strong agreement in clustering analysis across various resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).\n2. Clinical relevance (clonal expansion): In a leave-one-patient-out evaluation, TRIM demonstrated strong predictive power, achieving an AUC of 0.83 for predicting post-treatment clonal expansion. In contrast, baseline models (KNN and MLP) performed worse than or near random (Extended Data Fig. 10a-d).\n3. Clinical relevance (gene identification): The model also excelled at identifying differentially expressed genes associated with clonal expansion in a leave-one-out evaluation, achieving an AUC of 0.85 for all T cells (0.82 for CD4 and 0.79 for CD8 cells; Extended Data Fig. 14a).\nWe consider these results strong given that this CRC dataset introduces greater temporal complexity than the HNSCC dataset. In the new dataset, treatment timepoints span a larger timeframe compared to the HNSCC dataset (up to 250 days vs. 14 days from treatment start). To boost the signal, we aggregated the \"on-treatment\" measurements from the source study as our \"post-treatment\" timepoint (Methods). This longer time span and necessary aggregation introduce significant additional heterogeneity, which likely accounts for the slight difference in the clonal expansion metric (AUC = 0.83 in CRC vs. AUC = 0.92 in HNSCC). However, in both cohorts, baseline models performed at best near random. In summary, we believe these results on a new, clinically relevant dataset that matches the tissue-sourcing criteria (tumor and peripheral blood) supports the model's generalizability across different cancer types, and its potential clinical contribution.\nWe have added the following paragraphs to the Results section to describe this new analysis and its findings. The new Extended Figures are also provided.\n● Results section 2: “In addition, we investigated another dataset containing paired single-cell RNA-seq and TCR-seq data from 20 colorectal cancer (CRC) and 2 duodenal cancer patients [27]. This dataset includes samples from tumor tissue, adjacent normal tissue, and peripheral blood collected before and after anti–PD-1 treatment. For consistency with our main analysis, we focused on tumor and peripheral blood samples and restricted the analysis to T cells with paired RNA-seq and TCR-seq (Extended Data Fig. 3a, Methods). This resulted in 201,048 T cells with RNA expression profiles measured across 36,027 genes, each paired with a corresponding TCR CDR3 β-chain sequence. As in the HNSCC dataset, T cells sharing identical TCR clones were closer in RNA expression space than random cell pairs (Extended Data Fig. 3b). Furthermore, RNA–TCR distance correlations remained weak even when using TCR-BERT or CNN autoencoder embeddings (Extended Data Fig. 3c), reinforcing the broader applicability of our pseudoclone framework and model.”\n● Results section 3: “We then evaluated TRIM on the CRC dataset to assess its generalizability. The model outputs in RNA space closely matched the ground truth, and the correlation between real and predicted clonotype diversity was high (r = 0.67; Extended Data Fig. 7a-b). A more detailed clustering analysis also demonstrated strong agreement between real and generated data, with high correlations in median TCR clone counts across clustering resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).”\n● Results section 4: “Similarly, we evaluated TRIM on the CRC dataset. In leave-one-out evaluation, TRIM achieved an AUC of 0.83 for predicting post-treatment clonal expansion, whereas baseline models (KNN and MLP) performed worse than or near random (even after extensive greedy hyperparameter optimization) regardless of whether they used RNA expression, TCR embeddings, or their combination as input (Extended Data Fig. 10a-d, Methods).”\n● Results section 5: “We then evaluated TRIM’s ability to identify differentially expressed genes on the CRC dataset. In leave-one-out evaluation, TRIM achieved AUC of 0.85 for all T cells, 0.82 for CD4 cells, and 0.79 for CD8 cells (Extended Data Fig. 14a).”\n● Methods: “Colorectal cancer dataset: This dataset is derived from the publicly available data from [27]. We used paired scRNAseq and scTCRseq data from 22 patients across 4 different conditions: blood pre-treatment, blood post-treatment, tumor pre-treatment and tumor post-treatment. In the source study, “pre-” and “post-treatment” correspond to baseline and on-treatment visits. Because some patients had multiple on-treatment samples, we aggregated those measurements at the patient level for each condition to make full use of the data.”\nNew Extended Fig. 3: Analysis on colorectal cancer dataset. a, UMAP visualizations of the top 100 RNA principal components for T cells from Chen et al. [27], colored by source (top left), cell type (top center), condition (top right), patients (bottom center) and clone count (bottom right), and quantification of the number of cells per patient per condition (bottom left). b, Plots comparing the pairwise distance between cells in the RNA PCA space using the first 100 principal components (y-axis) and the TCR space (x-axis) using the Hamming distance. The same patterns hold as in the HNSCC dataset. c, Plots showing no relationship in non-clones between their pairwise distance in RNA space (computed in the RNA PCA space using the first 100 principal components) and their pairwise TCR distance, using either TCR-BERT embeddings or our CNN-based autoencoder embeddings.\nNew Extended Fig. 7: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, UMAP visualizations of the real RNA-seq data from all patients (left) and the TRIM-generated data (right), colored by clone count. The model’s generated RNA and pseudoclone counts accurately match the real RNA and clone counts of the data at a distribution level. b, Plot comparing the model’s generated TCR diversity (measured by Shannon entropy) to the real diversity for each patient, source, and timepoint. c, Plots comparing the median clone and generated pseudo-clone counts for each cluster in the k-means clustered RNA space; for values of k in 10, 25, and 50, the resulting correlations are 0.94, 0.85, and 0.86.\nNew Extended Fig. 10: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, TRIM accurately predicts whether a TCR in the blood pre-treatment given as input will expand (have higher clone count) in the blood post-treatment (left panel). b-d, A KNN or MLP trained to predict a binary expansion label on the same data performs worse than or similar to the random baseline (diagonal line), whether they are given the RNA only (b), the TCR only (c), or the concatenation of the two representations (d). For each baseline model, we also included a version with extensive hyperparameter optimization, performed via a greedy search on a validation split from the training data for each held-out patient.\nExtended Fig. 14a: Differential expression analysis of expanded clones in colorectal cancer dataset. a, Comparison of differentially expressed genes in TCR clones predicted to expand versus real differentially expressed genes that did expand in the ground truth. For both CD4+ and CD8+ subsets, the genes were ranked by their log-fold change in expression between expanded and non-expanded clones. The overlap between the top k genes from the predicted and the true ranked lists was computed for increasing values of k. Panel (a) shows results from the leave-one-patient-out analysis.\n• Page 10, towards the end of last paragraph “When we isolated this subset of genes in our model’s ranking by log fold change, we found that, as expected, the expansion signature genes were more likely to be differentially expressed in clones that the model predicted to expand (Fig. 5a).” : Given that the p value for this test is 0.064, I do not understand why it is described as a positive result.\nWe thank the reviewer for this question. We acknowledge the reviewer’s concern and agree that the phrasing could be misleading. Our intent was to emphasize the observed trend, rather than to claim a statistically significant result. We hypothesize that this signal is attenuated—and thus fails to reach full statistical significance—because the expansion signatures were derived from tumor tissue, while our analysis was modeling expansion in peripheral blood. Finding a positive trend in this cross-compartment comparison aligns with prior evidence that tumor-associated expansion programs are indeed detectable, if more weakly, in circulation.\nWe have revised the text to accurately reflect this, describing it as a \"positive trend\" rather than a significant finding: “When we restricted our analysis to these genes and ranked them by log-fold change, expansion-signature genes were more likely to be up-regulated in clones the model predicted to expand (Fig. 5a). Quantification using a Wilcoxon rank sum test [45] for the hypothesis whether the model ranks the expansion signature genes higher than the non-expansion signature genes resulted in a p-value of 0.064. Because the signatures were derived from tumor tissue whereas our analysis models expansion in blood, we expect some attenuation; nonetheless, the result shows a directionally consistent enrichment and aligns with prior evidence that tumor-associated expansion programs are detectable in blood.”\nMinor Comments:\n• Consider comparing TCR-derived distances to those in the gene expression PCA space as a control of model latent space structure (and deformation).\nWe thank the reviewer for this helpful suggestion. To clarify, this comparison was already performed in our analysis and is presented in Figure 3C, where we compared the TCR-derived distances with those from the gene expression PCA space. We have added a clarification in the legend of Fig. 3c: “Plots showing no relationship in non-clones between their pairwise distance in RNA space (computed in the RNA PCA space using the first 100 principal components) and their pairwise TCR distance, using either TCR-BERT embeddings or our CNN-based autoencoder embeddings.”\n• How do VDJ gene usages structure the TCR space? This could provide insight into how biologically meaningful the learned representations are, and also how just using these information could be sufficient for the model.\nWe thank the reviewer for this comment. We do not explicitly use V, D, and J gene segment information in our model, and instead use the CDR3 sequences from the β chains, which implicitly contain full information on the D segment, and partial information on the V and J segments. We have clarified this further in the Methods section: “The TCR representations used in TRIM are based on the trained embeddings obtained from a CNN autoencoder that we learned in a pre-processing step. For each TCR, its CDR3 β chain sequence was input to the model as a null-padded sequence of amino acids, with each amino acid encoded using its corresponding Atchley factors.”\nPrevious studies have established that including V/J gene segment information results in a richer TCR representation that improves performance on supervised prediction tasks (PMIDs 38070156, 33707415, 37556545), and that the frequency of TRAV/TRBV gene segments is shaped by genetic variation in the MHC locus (PMID 27479906). In models from these studies, the CDR3β sequence is the largest contributor to performance. scV(D)J-Seq is somewhat limited in full identification of the V and J gene segments. Here, we have visualized how structured the TCR representations learnt by our CNN autoencoder are by the V and J gene segments experimentally available (Response Fig. 3). For clarity, we colored cells by the top 5 most abundant V and J genes in the β chain. The clusters of CDR3 sequences clearly tend to be represented by a smaller number of V and J gene segments, indicating that these segments contribute to the TCR embedding structure and that our model implicitly learns about these segments through the CDR3β sequences.\n[FIGURE REDACTED]\nResponse Figure 3. UMAP of CNN-autoencoder TCR embeddings, colored by V- and J-gene usage (right and left), in the CRC dataset (Chen et al., 2024; Cancer Cell; PMID: 38981439).\n• Figure 4A, for comparing real vs generated data patterns, it would be helpful to include a more quantitative analysis than the two UMAPs. Eg perhaps a clustering analysis or “contour line” visualization would be more informative.\nWe appreciate the reviewer’s suggestion and agree that a more quantitative comparison would strengthen this figure. We would like to clarify that we have performed a clustering-based analysis in Extended Fig. 6b, where we computed the median clone count per RNA cluster and reported the Pearson correlation between real and generated distributions. This turns the UMAP visualization into a quantitative summary across clusters. We have made the following clarification in the Results section: “To assess whether TRIM captures the structure of the RNA space, we performed a clustering analysis. Specifically, we clustered cells in RNA expression space using k-means (with k = 10, 25, and 50), calculated the median clone count in each cluster for both real and generated data, and then calculated the correlation between these values. In other words, we divided the RNA space into distinct groups and evaluated whether TRIM reproduced the corresponding patterns in TCR space. Across all clustering resolutions, the correlations were consistently high (r = 0.92, 0.95, and 0.92 for k = 10, 25, and 50, respectively; Extended Data Fig. 6b). ”\n• Fig 4B and middle of first full paragraph on page 8 “We found that the true clonal diversity for each condition and the predicted pseudoclone diversity for that condition are strongly correlated (r = 0.80)” : Including other repertoire metrics like Shannon entropy could help quantify clonal diversity more robustly.\nWe thank the reviewer for this constructive suggestion. We agree that adding Shannon entropy provides a more robust quantification of clonal diversity. Following this suggestion, we adopted the Shannon entropy as a measure of clonal diversity in all our analyses, and updated Figure 4b to feature this metric. We found that the true clonal diversity (measured by entropy) and the predicted pseudoclone diversity remain strongly correlated (r = 0.74). We moved our original analysis (using the fraction-unique metric, r = 0.80) to Extended Data Fig. 6c as a complementary validation. The new figure is attached below.\nWe have added the following description to the Results section: “We next examined the clonotype diversity captured by TRIM for each condition, quantified using Shannon entropy (Methods). The true clonal diversity and the corresponding predicted pseudoclone diversity were strongly correlated (r = 0.74; Fig. 4b). To further assess this relationship, we also measured diversity as the proportion of unique TCRs in each sample, calculated by dividing the number of distinct TCRs by the total number of cells. This alternative yielded a similarly high correlation between true and predicted values (r = 0.80; Extended Data Fig. 6c). ”\nIn addition, we have included the following text in the Methods section to clarify how Shannon entropy was computed: “Shannon entropy was used to quantify TCR clone diversity. For each sample, we identified all observed T-cell clones, counted the frequency of each unique clone, and converted these counts to probabilities by dividing by the total number of observations. Entropy was then calculated as H = -∑ p log p, where p represents the probability of clone i.”\ni i 2 i i\nNew Fig. 4 (b) Plot comparing the model’s generated TCR diversity (measured by Shannon entropy) to the real diversity for each patient, source, and timepoint.\n• Extended Fig 6C and end of last full paragraph on page 8 “Furthermore, the model also learned to match pseudoclone count in each region of the RNA space to the corresponding ground truth clone count for that region (Extended Data Fig. 6c, right plots). Together, these results indicate that the model achieves strong accuracy at both the dataset and cluster levels.” : Consider including more quantitative metrics of “accuracy” beyond clonal expansion and UMAP visualization, such as Euclidean distance in PCA space based on TRIM embedding or directly in TRIM latent space.\nWe appreciate the reviewer’s suggestion to include additional quantitative accuracy metrics. We agree that quantitative evaluation is preferable to side-by-side UMAPs. We would like to clarify that we have provided a quantitative analysis in Extended Fig. 9b, which compares real vs. predicted clonal diversity per RNA cluster and real vs. predicted mean clonality per RNA cluster and reported the Pearson correlations. These metrics directly quantify the accuracy of TRIM’s generative performance at the cluster-level, independently of low-dimensional visualization.\nTo further highlight these quantitative results, we have added the following text to the Results section: “To quantitatively assess TRIM’s predictions, we clustered cells in the RNA space using k means (k = 20) and then calculated the real and predicted clonal diversity and mean clone count for that cluster (Extended Data Fig. 9b). We found a high degree of correlation in both cases, r = 0.97 and r = 0.97, respectively.”\nRegarding the specific suggestion to use Euclidean distance, we find this an interesting idea. However, we are unsure about how to implement it correctly to meet the reviewer's expectations. We would greatly appreciate any additional guidance from the reviewer on the most informative way to aggregate or compare these distances. We are happy to perform this additional analysis, if the reviewer finds it informative, once we are clear on the most valuable implementation.\n• Clone count distribution should be shown at the dataset level for both real and generated data to assess the generative model’s ability to reproduce this distribution.\nWe thank the reviewer for raising this important point. We would like to clarify that we visualized and compared the dataset-level clone count distributions for both the real and the TRIM-generated repertoires in the manuscript (Fig. 4a, Extended Data Fig. 7a, and Extended Data Fig. 11c).\nWe have added the following text to the Results section for further clarifications: “Importantly, as shown in Fig 4a, the UMAP of the RNA space for ground truth cells colored by the true TCR clone count visually matches the UMAP of the generated RNA cells and their corresponding pseudoclone count in the HNSCC dataset.” and “We further evaluated TRIM on the CRC dataset to assess its generalizability. The model outputs in RNA space closely matched the ground truth, and the correlation between real and predicted clonotype diversity was high (r = 0.67; Extended Data Fig. 7a-b). ”\n• UMAP: It is unclear which embedding is being visualized, TRIM’s latent space or the gene expression PCA? This needs clarification at the beginning of the paper or in the Methods.\nWe thank the reviewer for pointing this out. This is an important clarification.The UMAPs in Figure 3a are based on the gene expression PCA space, not TRIM’s latent space. We have updated the figure legends to state this explicitly.\nNew legend for Figure 3a: “UMAP visualizations of the top 100 RNA principal components for T cells from Luoma et al. [19], colored by source (blood and tumor, top left), cell type (CD4+ and CD8+ cells, top center), condition (pre- and post-treatment, top right), patients (bottom center) and clone count (bottom right), and quantification of the number of cells per patient per condition (bottom left).”\n• Page 6 4th line of 2nd full paragraph, page 7 middle of first full paragraph, and page 12 5th line from top use the word “significantly” but it’s not clear a statistical test has been performed. Please clarify with details of the test or choose a different word.\nWe thank the reviewer for highlighting this. We have revised the text in each location to either (i) remove inferential language where no formal test was performed or (ii) specify the statistical test and report the corresponding p-values.\n● Page 6: We have revised the text to remove the ambiguous term, as a statistical test was not performed in this specific instance: “The distribution of RNA distances among identical TCR clones (Hamming distance of zero) is substantially lower than the RNA distances for cells farther apart in the TCR space.”\n● Page 7: We have clarified that these comparisons were indeed based on one-sided t-tests, with p-values reported in the corresponding figures: “In all cases, intra-clone distances were significantly smaller than inter-clone distances on average in the RNA space (one-sided t-test, p < 0.01; Fig. 3e-g).”\n● Page 12: We have clarified that these enrichment analyses were performed using hypergeometric tests with FDR correction: “In contrast, differentially expressed genes identified by comparing large versus small clones pre-treatment were enriched for cytotoxic, effector, and immune-regulatory programs but did not show significant enrichment for expansion-related programs (assessed via hypergeometric tests per gene set with FDR correction; enrichment shown as − log10 FDR-adjusted p-values in Fig. 5d).”\n• The list of genes identified across different methods in Figure 5 should be made available as supplementary material to enhance transparency and reproducibility.\nWe fully agree with the reviewer’s suggestion. We provide the list of genes identified across the different methods in Figure 5 as Source Data Fig. 5 to enhance transparency and reproducibility.\n• Is the scRNA-seq data log-transformed before analysis? This detail should be stated explicitly.\nWe thank the reviewer for flagging this important detail. Yes, the scRNA-seq data were log-transformed prior to analysis. We have added the following text to the Methods section to clarify our processing steps: “We log-transformed and normalized the RNA expression of each cell and trained our model on the first 100 principal components of the data.”\nReviewer #1 (Remarks on code availability):\nI verified that the github page exists but I did not try installing or running the code. From my brief look, it seems this code is only to reproduce the figures of the manuscript, not to actually run the model on new datasets\nWe thank the reviewer for this comment. The previous version of the repository included instructions within the Experiments section for applying TRIM to new datasets, but we agree that this was not sufficiently clear.\nTo improve clarity, we have reorganized and refined the documentation as follows:\n1. Data Format Requirements – We now provide a dedicated section specifying how users should format their own datasets, along with example preprocessing scripts for guidance.\n2. Quick Start – We now include a step-by-step guide showing how to apply TRIM to a new (properly formatted) dataset by simply specifying the data path.\n3. Figures in the Paper – We clarified that this separate section is specifically for users who wish to reproduce the figures from the manuscript.\nReviewer #2 (Remarks to the Author):\nThe study reported TRIM as a promising tool for predicting T cell states and responses to cancer immunotherapies using peripheral blood measurements. While the initial findings are encouraging and highlight the potential for clinical application, there are several areas that warrant further clarification and expansion to enhance the study's impact and translational relevance.\nMajor comments:\n1. The study would be strengthened by a more in-depth analysis of inter-individual variability in immune responses. Key factors such as age, sex, race, and genetic background are known to significantly impact immune cell behavior and responses to immunotherapy. It remains unclear whether TRIM accounts for these sources of variation or how its predictive performance may differ across diverse patient populations. Including data analysis based on clinicopathological features in the patient cohorts would provide a more comprehensive assessment of TRIM’s potential for equitable application in clinical practice.\nWe thank the reviewer for this comment and agree with the reviewer that inter-individual variability in immune responses is an important consideration, and that factors such as age, sex, and genetic background play a significant role in shaping clinical outcomes. Given the limited nature of available single-cell TCR-RNA-seq clinical datasets, we designed TRIM around a leave-one-out evaluation strategy across patients, which is the most effective way to assess generalization under these data constraints.\nTo test the robustness of TRIM across different patient subgroups stratified by clinicopathological features, we conducted a new series of analyses based on the features available in a new colorectal cancer (CRC) dataset, which includes both tumor tissue and peripheral blood samples pre and post PD1-blockade with paired scRNAseq and scTCRseq.\nWe would like to note that this metadata is limited in the source publications: the HNSCC dataset did not release patient metadata, while the CRC dataset provided information on patient age and sex.\nUsing the available age and sex data from the CRC dataset, we performed a series of leave-group-out (LGO) analyses to test TRIM’s robustness. This involved holding out specific patient subgroups from training and evaluating the model's performance on them. We created subgroups for:\n1. All female patients\n2. Younger patients (defined as the lowest 15th percentile of the age distribution)\n3. Older patients (defined as the highest 15th percentile of the age distribution)\n(We noted that a 'leave-male-out' analysis was not feasible, as the small number of female patients was insufficient for robust model training (Extended Data Fig. 8a)).\nIn a similar LGO framework (and to address Reviewer Comment 5), we also tested TRIM’s robustness to a key technical variable: the number of cells sequenced per patient. We created subgroups for patients with few cells (lowest 15th percentile) and many cells (highest 15th percentile). At the same time, we acknowledge that the small sample sizes inherent to single-cell clinical studies place limitations on the statistical power of such subgroup analyses. These are limitations present in the original single-cell studies, which largely do not address inter-individual variability (PMIDs 35803260, 38981439).\n● Robust generalization: Across these different conditions, TRIM consistently captured the joint RNA–TCR space at the distribution level, as indicated by high correlations across multiple clustering resolutions (k = 10, 25, and 50; Extended Data Fig. 8b–f).We observed that higher-resolution clustering makes predicting median TCR clone counts more challenging, and this difficulty is further amplified when evaluating samples with few cells, as smaller clusters contain very limited information for accurate estimation. However, TRIM maintained strong performance in predicting clonotype diversity, with high correlations between real and predicted values (Extended Data Fig. 8b–f, right panels). We did observe reduced generalizability when older patients were left out of training. This difficulty in generalization appears linked to distinct properties of these patients’ immune repertoires.\n● Expansion prediction: We further tested TRIM’s ability of expansion prediction in leave-group-out settings, where the test patients had post-treatment measurements. TRIM maintained competitive performance, achieving AUCs of 0.68, 0.81, and 0.78 for leave-female-out, leave-young-out, and leave-more-cells-out evaluations, respectively, while baseline models again performed near random (Extended Data Fig. 11).\n● We similarly evaluated TRIM’s ability to identify differentially expressed genes in the CRC dataset. Across different subgroup analyses, TRIM maintained strong performance, with AUCs for all T cells of 0.83, 0.90, and 0.81 for leave-female-out, leave-young-out, and leave-more-cells-out, respectively; for CD4 cells, 0.83, 0.83, and 0.81; and for CD8 cells, 0.72, 0.84, and 0.72 (Extended Data Fig. 14b-d).\nThese results provide a more comprehensive assessment of TRIM’s performance across different patient conditions, and further validate TRIM’s ability to generalize to different cancer types as well as across diverse patient conditions. We have added the following paragraphs to the Results section to describe this new analysis and its findings. The new Extended Figures are also provided.\nIn Results section 3, we have added: “To examine the robustness of TRIM across different patient populations, we investigated factors such as age and sex using the CRC dataset. We also explored how varying the number of patients in the training data affected model performance. Specifically, we performed a leave-group-out analysis, where entire subgroups were excluded during training—for example, excluding all female patients, or patients in the upper or lower 15th percentile for age or sample count—and used these groups for testing (Extended Data Fig. 8a). Across these different conditions, TRIM consistently captured the joint RNA–TCR space at the distribution level, as indicated by high correlations across multiple clustering resolutions (k = 10, 25, and 50; Extended Data Fig. 8b–f).We observed that higher-resolution clustering makes predicting median TCR clone counts more challenging, and this difficulty is further amplified when evaluating samples with few cells, as smaller clusters contain very limited information for accurate estimation. However, TRIM maintained strong performance in predicting clonotype diversity, with high correlations between real and predicted values (Extended Data Fig. 8b–f, right panels). We did observe reduced generalizability when older patients were left out of training (Extended Data Fig. 8d). We hypothesize that this difficulty in generalization may be due to the distinct properties of this patients’ subpopulation, which shows reduced T cell clonal diversity. Nonetheless, the results across all subgroup analyses were consistent, indicating that TRIM is robust to demographic and sample-size variations.”\nIn Results section 4, we added: “To further assess robustness, we tested TRIM in leave-group-out settings, where the test patients had post-treatment measurements. TRIM maintained competitive performance, achieving AUCs of 0.68, 0.81, and 0.78 for leave-female-out, leave-young-out, and leave-more-cells-out evaluations, respectively, while baseline models again performed near random (Extended Data Fig. 11).”\nIn Results section 5, we added: “Across different subgroup analyses, TRIM maintained strong performance, with AUCs for all T cells of 0.83, 0.90, and 0.81 for leave-female-out, leave-young-out, and leave-more-cells-out, respectively; for CD4 cells, 0.83, 0.83, and 0.81; and for CD8 cells, 0.72, 0.84, and 0.72 (Extended Data Fig. 14b-d). These results further validate TRIM’s ability to generalize to different cancer types as well as across diverse patient conditions.”\nNew Extended Fig. 8: Robustness analysis of TRIM. a, Distribution of gender, age, and number of cells per patient in the colorectal cancer dataset. To assess model robustness, we performed leave-group-out analyses based on these attributes. b-f, plots showing the correlation between real versus generated by k-mean RNA clusters (for k=10, 25, and 50), and clonal diversity measured by Shannon entropy analysis of real versus generated TCR data for the following leave-group-out-analyses: (b) all female patients, (c) younger patients (age ≤ 15th percentile), (d) older patients (age ≥ 85th percentile), (e) patients with fewer cells (cell count ≤ 15th percentile), and (f) patients with more cells (cell count ≥ 85th percentile).\nNew Extended Fig. 11: Robustness of TRIM in predicting TCR expansion across patient subgroups. a-c, Evaluation of TRIM in predicting whether a TCR observed in pre-treatment blood will expand (i.e., increase in clone count) in post-treatment blood when leaving out (a) female patients, (b) younger patients, and (c) patients with more cells for testing. Analyses for older patients and patients with fewer cells were not performed due to the lack of post-treatment blood samples. In each case, baseline models (KNN, top right panels; MLP, bottom right panels) trained to predict binary expansion labels on the same data perform near the random baseline (diagonal line), regardless of whether they use RNA features only, TCR features only, or their concatenation.\nExtended Fig. 14: Differential expression analysis of expanded clones in colorectal cancer dataset. a-d, Comparison of differentially expressed genes in TCR clones predicted to expand versus real differentially expressed genes that did expand in the ground truth. For both CD4+ and CD8+ subsets, the genes were ranked by their log-fold change in expression between expanded and non-expanded clones. The overlap between the top k genes from the predicted and the true ranked lists was computed for increasing values of k. Panel (a) shows results from the leave-one-patient-out analysis; (b) excludes female patients for testing; (c) excludes younger patients; and (d) excludes patients with more cells. Analyses for older patients and patients with fewer cells were not performed due to the lack of post-treatment blood samples.\n2. In this study, the authors applied TRIM to T cells isolated from both blood and tumor biopsies of patients with HNSCC. However, the rationale behind selecting HNSCC as the disease model is not clearly explained.\nWe thank the reviewer for flagging this. To our knowledge, the HNSCC dataset on which we trained our model represents the first dataset that aligned with our specific experimental requirements: a multimodal dataset where T cells are profiled in blood and tumor tissue across multiple treatment timepoints. The number of such available datasets is still very small; 2 studies to our knowledge (PMIDs 35803260, 38981439). These datasets are challenging to collect in the clinic (requiring paired sampling of patient tissue and blood at multiple time points) and to process experimentally (requiring T cell isolation and joint RNA and TCR sequence profiling). However these datasets have enormous potential to inform patient diagnosis and treatment, and we expect the number of studies with this design to increase in the next few years, which is why we developed the TRIM model.\n3. The patient data used to validate the predictive value of TRIM were all derived from relatively less prevalent cancer types, including HNSCC, ESCA, THCA, and UCEC. While these datasets provide initial support for TRIM’s utility, validation in more common and clinically impactful cancer types, such as breast and prostate cancer, would significantly strengthen the generalizability and translational relevance of the findings. Including such high-prevalence cancers for data validation is required to enhance the clinical applicability of the tool.\nWe thank the reviewer for this comment and agree with the reviewer that demonstrating our model’s performance on the major cancer types is important. Thus, we tested our model’s performance on a newly collected multimodal dataset in colorectal cancer (CRC) (PMID 38981439), one of the most common cancer types. Currently, there is no public data from breast or prostate cancer with the desired experimental design.\nWe focused our analysis on 201,048 T cells from the tumor and peripheral blood samples among 22 patients. The corresponding results are reported in the new Extended Data Figures 3,7,10,14 and copied below. We first confirmed that this dataset exhibits the same core challenge as the HNSCC data: while T cells sharing identical TCR clones are closer in RNA expression space, the overall RNA-TCR distance correlations remain weak, even when using advanced TCR embeddings (Extended Data Fig. 3b-c). This reinforces the broad applicability and necessity of our pseudoclone framework.\nWe then evaluated TRIM's performance on this new CRC dataset with the following results:\n4. Model fidelity: The model's outputs in RNA space closely matched the ground truth data. We observed a high correlation between real and predicted clonotype diversity (r = 0.67; Extended Data Fig. 7a-b) and strong agreement in clustering analysis across various resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).\n5. Clinical relevance (clonal expansion): In a leave-one-patient-out evaluation, TRIM demonstrated strong predictive power, achieving an AUC of 0.83 for predicting post-treatment clonal expansion. In contrast, baseline models (KNN and MLP) performed worse than or near random (Extended Data Fig. 10a-d).\n6. Clinical relevance (gene identification): The model also excelled at identifying differentially expressed genes associated with clonal expansion in a leave-one-out evaluation, achieving an AUC of 0.85 for all T cells (0.82 for CD4 and 0.79 for CD8 cells; Extended Data Fig. 14a).\nWe consider these results strong given that this CRC dataset introduces greater temporal complexity than the HNSCC dataset. In the new dataset, treatment timepoints span a larger timeframe compared to the HNSCC dataset (up to 250 days vs. 14 days from treatment start). To boost the signal, we aggregated the \"on-treatment\" measurements from the source study as our \"post-treatment\" timepoint (Methods). This longer time span and necessary aggregation introduce significant additional heterogeneity, which likely accounts for the slight difference in the clonal expansion metric (AUC = 0.83 in CRC vs. AUC = 0.92 in HNSCC). However, in both cohorts, baseline models performed at best near random. In summary, we believe these results on a new, clinically relevant dataset that matches the tissue-sourcing criteria (tumor and peripheral blood) supports the model's generalizability across different cancer types, and its potential clinical contribution.\nWe have added the following paragraphs to the Results section to describe this new analysis and its findings. The new Extended Figures are also provided.\n● Results section 2: “In addition, we investigated another dataset containing paired single-cell RNA-seq and TCR-seq data from 20 colorectal cancer (CRC) and 2 duodenal cancer patients [27]. This dataset includes samples from tumor tissue, adjacent normal tissue, and peripheral blood collected before and after anti–PD-1 treatment. For consistency with our main analysis, we focused on tumor and peripheral blood samples and restricted the analysis to T cells with paired RNA-seq and TCR-seq (Extended Data Fig. 3a, Methods). This resulted in 201,048 T cells with RNA expression profiles measured across 36,027 genes, each paired with a corresponding TCR CDR3 β-chain sequence. As in the HNSCC dataset, T cells sharing identical TCR clones were closer in RNA expression space than random cell pairs (Extended Data Fig. 3b). Furthermore, RNA–TCR distance correlations remained weak even when using TCR-BERT or CNN autoencoder embeddings (Extended Data Fig. 3c), reinforcing the broader applicability of our pseudoclone framework and model.”\n● Results section 3: “We then evaluated TRIM on the CRC dataset to assess its generalizability. The model outputs in RNA space closely matched the ground truth, and the correlation between real and predicted clonotype diversity was high (r = 0.67; Extended Data Fig. 7a-b). A more detailed clustering analysis also demonstrated strong agreement between real and generated data, with high correlations in median TCR clone counts across clustering resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).”\n● Results section 4: “Similarly, we evaluated TRIM on the CRC dataset. In leave-one-out evaluation, TRIM achieved an AUC of 0.83 for predicting post-treatment clonal expansion, whereas baseline models (KNN and MLP) performed worse than or near random (even after extensive greedy hyperparameter optimization) regardless of whether they used RNA expression, TCR embeddings, or their combination as input (Extended Data Fig. 10a-d, Methods).”\n● Results section 5: “We then evaluated TRIM’s ability to identify differentially expressed genes on the CRC dataset. In leave-one-out evaluation, TRIM achieved AUC of 0.85 for all T cells, 0.82 for CD4 cells, and 0.79 for CD8 cells (Extended Data Fig. 14a).”\n● Methods: “Colorectal cancer dataset: This dataset is derived from the publicly available data from [27]. We used paired scRNAseq and scTCRseq data from 22 patients across 4 different conditions: blood pre-treatment, blood post-treatment, tumor pre-treatment and tumor post-treatment. In the source study, “pre-” and “post-treatment” correspond to baseline and on-treatment visits. Because some patients had multiple on-treatment samples, we aggregated those measurements at the patient level for each condition to make full use of the data.”\nNew Extended Fig. 3: Analysis on colorectal cancer dataset. a, UMAP visualizations of the top 100 RNA principal components for T cells from Chen et al. [27], colored by source (top left), cell type (top center), condition (top right), patients (bottom center) and clone count (bottom right), and quantification of the number of cells per patient per condition (bottom left). b, Plots comparing the pairwise distance between cells in the RNA PCA space using the first 100 principal components (y-axis) and the TCR space (x-axis) using the Hamming distance. The same patterns hold as in the HNSCC dataset. c, Plots showing no relationship in non-clones between their pairwise distance in RNA space (computed in the RNA PCA space using the first 100 principal components) and their pairwise TCR distance, using either TCR-BERT embeddings or our CNN-based autoencoder embeddings.\nNew Extended Fig. 7: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, UMAP visualizations of the real RNA-seq data from all patients (left) and the TRIM-generated data (right), colored by clone count. The model’s generated RNA and pseudoclone counts accurately match the real RNA and clone counts of the data at a distribution level. b, Plot comparing the model’s generated TCR diversity (measured by Shannon entropy) to the real diversity for each patient, source, and timepoint. c, Plots comparing the median clone and generated pseudo-clone counts for each cluster in the k-means clustered RNA space; for values of k in 10, 25, and 50, the resulting correlations are 0.94, 0.85, and 0.86.\nNew Extended Fig. 10: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, TRIM accurately predicts whether a TCR in the blood pre-treatment given as input will expand (have higher clone count) in the blood post-treatment (left panel). b-d, A KNN or MLP trained to predict a binary expansion label on the same data performs worse than or similar to the random baseline (diagonal line), whether they are given the RNA only (b), the TCR only (c), or the concatenation of the two representations (d). For each baseline model, we also included a version with extensive hyperparameter optimization, performed via a greedy search on a validation split from the training data for each held-out patient.\nExtended Fig. 14a: Differential expression analysis of expanded clones in colorectal cancer dataset. a, Comparison of differentially expressed genes in TCR clones predicted to expand versus real differentially expressed genes that did expand in the ground truth. For both CD4+ and CD8+ subsets, the genes were ranked by their log-fold change in expression between expanded and non-expanded clones. The overlap between the top k genes from the predicted and the true ranked lists was computed for increasing values of k. Panel (a) shows results from the leave-one-patient-out analysis.\n4. While the study identifies numerous genes and gene signatures through the application of TRIM, there is a lack of in-depth interpretation and biological context provided for these findings. Further analysis and discussion are needed to clarify the functional relevance of these genes, their potential roles in T cell biology or immunotherapy response,\nWe thank the reviewer for this question. We have performed deeper biological analyses on the genes highlighted by the TRIM model, focusing on genes identified by our saliency analysis to be associated with CD8 T cell clonal expansion. We now call out the specific pathways with their genes and highlight a pathway not discussed in the original HNSCC T cell analysis. We have added the following text to the last Results section: “Our method (”Gradient”), along with the supervised methods that utilized post-treatment labels (”Expanded vs. non-expanded” and ”Expanding vs. Non-expanding”), successfully identified genes involved in cell cycle (AURKA, CENPU, DUT ), T cell effector function and cytotoxicity (PRF1, GZMA, GZMH, GNLY, NKG7, CST7 ), T cell activation and co-stimulation (CTLA4, TNFRSF9 ), mitochondrial and metabolic pathways (ATP5PF, VDAC2, DHTKD1, IBA57 ), and T cell migration (CCR7, CCL5, IL6R, FOXO1 ). Notably, the CD38+ CD8 T cells that expanded in blood during treatment were previously shown to exhibit activation and proliferative signatures; here, the identification of a T cell migration signature is new and suggests these cells may traffic to the tumor and lymph nodes, which is consistent with this population having TCRs that expanded in tumors during therapy.”\n5. It would be great to discuss on how sample size of patients contributes to the predictive power of the TRIM model.\nWe appreciate the reviewer’s suggestion. As discussed in our response to question 1, to test TRIM’s robustness to the technical effects of sample size, we performed a leave-group-out (LGO) analysis on the new CRC dataset. We created subgroups for patients with \"few cells\" (lowest 15th percentile) and \"many cells\" (highest 15th percentile) based on the number of cells sequenced per patient (Extended Data Fig. 8a).\nThe model consistently captured the joint RNA–TCR space, maintaining high correlations for clonotype diversity and across multiple clustering resolutions (Extended Data Fig. 8e-f). TRIM also maintained strong predictive performance in this LGO setting. For the \"leave-more-cells-out\" evaluation, TRIM achieved an AUC of 0.78 for predicting clonal expansion, whereas baseline models performed near random (Extended Data Fig. 10c). For identifying differentially expressed genes, the model achieved strong AUCs of 0.81 (all T cells), 0.81 (CD4 cells), and 0.72 (CD8 cells) (Extended Data Fig. 14d).\nReviewer #3 (Remarks to the Author):\nThis study takes single cell RNA transcriptomic data and TCR data from blood and tumour and integrates them into a single low dimensional latent variable (coded as a Gaussian of specified mean and variance in a space of predetermined dimension), which can then be decoded so as to produce a generative model of transcriptional state and TCR. It adds to a growing body of literature which addresses integration of multimodal data. The model is used to investigate the relationship between TCR and transcription, and to predict population-level features as well as individual cell expansion in tumour and blood pre-and post- treatment , based on pretreatment blood alone.\nI would summarise the most important findings as 1. Transcriptional state of T cells from the same clone are more similar to each other than to other clones, but for non-identical TCRs there is no relationship to transcriptional state. 2. The expansion potential of a TCR can be predicted from its pre-treatment transcriptional state (as shown in the original paper).\nI was less convinced by the comparisons between TRIM and other ML approaches to prediction – its hard to directly compare, and to ensure that the other methods have been optimised at hyperparameter level.\nWe thank the reviewer for this comment. We agree completely that a fair comparison requires rigorous and transparent optimization of all methods. To address this, we have now added Extended Data Fig. 10 to explicitly and transparently detail our extensive hyperparameter optimization procedure.\nAs described in the updated figure legend and supplementary note 1, our procedure, performed on the new colorectal cancer (CRC) dataset, which includes both tumor tissue and peripheral blood samples pre and post PD1-blockade with paired scRNAseq and scTCRseq, ensures that each baseline was optimized for the task. Specifically, within each leave-one-patient-out (LOO) cross-validation fold, we performed an internal grid search:\n1. The training patients (all except the one held-out test patient) were further split into an 80% internal-training set and a 20% internal-validation set, stratified by patient.\n2. A grid search was performed over a pre-defined set of hyperparameters for both KNN and MLP models.\n3. The hyperparameter set yielding the best AUC on the internal-validation set was selected.\n4. A new model with these optimal parameters was re-trained on the entire LOO training set (all patients except the held-out test patient) and then evaluated on the held-out test patient.\nThe hyperparameter grids searched were as follows:\n● K-Nearest Neighbors (KNN):\n○ n_neighbors: [5, 10, 20, 50]\n● Multi-Layer Perceptron (MLP):\n○ hidden_layer_sizes: [(400, 200, 100), (256, 128), (128,), (512, 256, 64)]\n○ alpha: [0.0001, 0.001, 0.01]\n○ learning_rate_init: [0.0001, 0.001, 0.01]\nThis full optimization was repeated for each LOO fold and for each input modality (RNA-only, TCR-only, and combined RNA+TCR).\nDespite this extensive optimization, the baseline models performed near random for clonal expansion prediction, while TRIM achieved an AUC of 0.83 (Extended Fig. 10).\nFinally, while we believe this rigorous comparison is important, we would also like to re-emphasize that, to our knowledge, TRIM is the first model uniquely designed for the generative task of predicting complex cellular states across both time points and tissue compartments (e.g., from pre-treatment blood to post-treatment tumor). This is a fundamentally different and more complex task than that addressed by the baseline classifiers.\nNew Extended Fig.10: Generated data matches ground truth on held out patients in colorectal cancer dataset. (a) TRIM accurately predicts whether a TCR in the blood pre-treatment given as input will expand (have higher clone count) in the blood post-treatment (left panel). A KNN or MLP trained to predict a binary expansion label on the same data performs similar to the random baseline (diagonal line), whether they are given the RNA only, the TCR only, or the concatenation of the two representations. For each baseline model, we also included a version with extensive hyperparameter optimization, performed via a greedy search on a validation split from the training data for each held-out patient.\nI was also not completely convinced about the insights into the gene prediction section. Why do the authors think that prediction of genes driving expansion is better or more complete than using the actual differential gene expression profiles for those T cells which expand? Is the imposition of similar transcriptional profiles for the same clone somehow reducing the noise in some way?\nWe thank the reviewer for this insightful question. We apologize for the lack of clarity and have revised this section in the manuscript. Our intention is not to claim that our predictive gene set is \"better or more complete\" than a standard differential expression (DE) analysis. The reviewer is correct that a standard DE analysis, by comparing T cells that actually expanded to those that did not, is the established method for identifying the gene programs associated with an expanded state.\nOur model addresses a different, and complementary, clinical and biological question. The goal of our gene analysis is twofold:\n1. Model Interpretability: To demonstrate that our model's predictions are not a \"black box,\" but are driven by biologically relevant gene programs. By identifying the genes most salient to the model's prediction of expansion, we show that it has learned meaningful biological signals.\n2. Clinical Relevance: Our model is designed for a scenario where post-treatment samples are not available. A standard DE analysis is impossible in this \"baseline-only\" setting. The clinical utility of TRIM is to take a patient's pre-treatment sample and predict their post-treatment T cell dynamics.\nTherefore, the genes we identify are not necessarily the same as those from a standard DE analysis. A post-treatment DE analysis identifies the results of expansion. In contrast, our model's salient genes represent predictive, upstream features present in the pre-treatment baseline state. These features may represent the potential for clonal expansion before that expansion ever occurs.\nWe have added the following clarifications in our Results section: “Although TRIM requires access to paired pre- and post-treatment data during training, once trained, it can be applied to new pre-treatment-only samples to identify gene programs associated with T-cell expansion. This capability provides both model interpretability—by demonstrating that its predictions are driven by meaningful biological signals—and clinical relevance, as it provides these predictive insights in a common clinical setting where post-treatment samples are unavailable.”\nI wondered why patient id is encoded in the model? Surely id is a totally arbitrary field ? Why does its encoding need learning ?\nWe thank the reviewer for raising this important point, which highlights a key aspect of our model's design. The reviewer is correct that the patient ID itself (e.g., 'Patient 1', 'Patient 2') is an arbitrary label, and our model does not use this ID as a direct predictive feature.\nWe have clarified this in the manuscript. The patient ID is used only as a grouping key to aggregate a patient's baseline data (RNA-seq and TCR-seq in pre-treatment blood). As now explicitly stated in the 'Learning condition embeddings' subsection of the Methods, the model learns a single, patient-specific embedding vector from that patient's data.\nThis learned vector—which captures the patient's unique biological baseline—is what's used as the 'patient' condition, not the arbitrary ID. This allows the model to capture individual-specific variation. We have also added a clarifying sentence to the legend of Figure 2a to make this mechanism clear.\nWe added the following clarifications in the Methods section: “It is important to note that the model does not use the arbitrary patient ID as a direct feature. Instead, the patient ID serves as a grouping key. The model learns a patient-specific embedding vector by aggregating the pre-treatment blood-derived RNA and TCR data for that specific patient (as described above). This learned vector, which captures the patient’s unique biological baseline, is what is used as the patient-level condition.”\nWe further clarified this in Fig2. legend: “After learning the embedding vectors for the conditions with our condition-learning process by using condition ID as key to group features (bottom right, Methods), the encoders map them into the latent space as in a variational autoencoder.”\nI am not convinced of the predictive features of the model – leave-one-out prediction from a single data set is not equivalent to validating in an independent cohort, even with the same treatment and/or cancer, let alone more broadly. And, at least to my understanding, the validation in a second data set involved re-learning the model with the second set of data. So its unclear how generalizable the models are.\nWe appreciate the reviewer's important point regarding generalizability. We agree that the gold standard would be to train a model on a vast collection of data that could then be applied directly to a new, independent cohort without retraining.\nHowever, we believe the field is not at that stage yet, primarily due to the current scarcity and high cost of generating the necessary paired scTCR-RNA-seq clinical datasets. Our goal, therefore, is to demonstrate methodological generalizability: that the TRIM framework is not a \"one-off\" solution overfit to the HNSCC dataset, but a robust and general-purpose method that can be successfully applied to other complex, paired scTCR-RNA-seq datasets to yield strong, clinically relevant predictions. We envision the primary intended use of TRIM at this stage is for it to be trained on a new cohort to fill in missing experimental data within that specific cohort. For example, it could predict post-treatment outcomes for patients who only have pre-treatment samples, or impute missing timepoints or tissue sites. To our knowledge, TRIM is unique in its ability to make such predictions (T cell single-cell gene expression and clonal expansion) across time and tissues.\nWe have added the following text to the Discussion section: “While we recognize that a model trained on multiple cohorts, including a large variety of cancer types, could potentially be directly applicable to unseen cancer-type settings without retraining, given the current paucity of such datasets, we believe this is not currently achievable, nor the most accurate and cost-efficient strategy to address our problem at hand: being able to predict missing data in complex cohorts across time points and tissue-sites. No other computational method, to our knowledge, productively uses the RNA and TCR sequence to predict transcriptional states across tissues and time points; however, there are still many questions that the work presented here leaves open.”\nTo further support TRIM methodological generalizability, we validated it on a new, independent dataset.\nValidation on an independent CRC Cohort\nWe identified a recent colorectal cancer (CRC) cohort from Chen et al. (2024, Cancer Cell, PMID 38981439), which, like our HNSCC cohort, includes paired single-cell RNA-seq and TCR-seq data from tumor tissue and peripheral blood samples, collected both before and after anti-PD-1 treatment.\nWe focused our analysis on 201,048 T cells from the tumor and peripheral blood samples among 22 patients. The corresponding results are reported in the new Extended Data Figures 3,7,10,14 and copied below. We first confirmed that this dataset exhibits the same core challenge as the HNSCC data: while T cells sharing identical TCR clones are closer in RNA expression space, the overall RNA-TCR distance correlations remain weak, even when using advanced TCR embeddings (Extended Data Fig. 3b-c). This reinforces the broad applicability and necessity of our pseudoclone framework.\nWe then evaluated TRIM's performance on this new CRC dataset with the following results:\n7. Model fidelity: The model's outputs in RNA space closely matched the ground truth data. We observed a high correlation between real and predicted clonotype diversity (r = 0.67; Extended Data Fig. 7a-b) and strong agreement in clustering analysis across various resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).\n8. Clinical relevance (clonal expansion): In a leave-one-patient-out evaluation, TRIM demonstrated strong predictive power, achieving an AUC of 0.83 for predicting post-treatment clonal expansion. In contrast, baseline models (KNN and MLP) performed worse than or near random (Extended Data Fig. 10a-d).\n9. Clinical relevance (gene identification): The model also excelled at identifying differentially expressed genes associated with clonal expansion in a leave-one-out evaluation, achieving an AUC of 0.85 for all T cells (0.82 for CD4 and 0.79 for CD8 cells; Extended Data Fig. 14a).\nWe consider these results strong given that this CRC dataset introduces greater temporal complexity than the HNSCC dataset. In the new dataset, treatment timepoints span a larger timeframe compared to the HNSCC dataset (up to 250 days vs. 14 days from treatment start). To boost the signal, we aggregated the \"on-treatment\" measurements from the source study as our \"post-treatment\" timepoint (Methods). This longer time span and necessary aggregation introduce significant additional heterogeneity, which likely accounts for the slight difference in the clonal expansion metric (AUC = 0.83 in CRC vs. AUC = 0.92 in HNSCC). However, in both cohorts, baseline models performed at best near random. In summary, we believe these results on a new, clinically relevant dataset that matches the tissue-sourcing criteria (tumor and peripheral blood) supports the model's generalizability across different cancer types, and its potential clinical contribution.\nWe have added the following paragraphs to the Results section to describe this new analysis and its findings. The new Extended Figures are also provided.\n● Results section 2: “In addition, we investigated another dataset containing paired single-cell RNA-seq and TCR-seq data from 20 colorectal cancer (CRC) and 2 duodenal cancer patients [27]. This dataset includes samples from tumor tissue, adjacent normal tissue, and peripheral blood collected before and after anti–PD-1 treatment. For consistency with our main analysis, we focused on tumor and peripheral blood samples and restricted the analysis to T cells with paired RNA-seq and TCR-seq (Extended Data Fig. 3a, Methods). This resulted in 201,048 T cells with RNA expression profiles measured across 36,027 genes, each paired with a corresponding TCR CDR3 β-chain sequence. As in the HNSCC dataset, T cells sharing identical TCR clones were closer in RNA expression space than random cell pairs (Extended Data Fig. 3b). Furthermore, RNA–TCR distance correlations remained weak even when using TCR-BERT or CNN autoencoder embeddings (Extended Data Fig. 3c), reinforcing the broader applicability of our pseudoclone framework and model.”\n● Results section 3: “We then evaluated TRIM on the CRC dataset to assess its generalizability. The model outputs in RNA space closely matched the ground truth, and the correlation between real and predicted clonotype diversity was high (r = 0.67; Extended Data Fig. 7a-b). A more detailed clustering analysis also demonstrated strong agreement between real and generated data, with high correlations in median TCR clone counts across clustering resolutions (r = 0.94, 0.85, and 0.86 for k = 10, 25, and 50, respectively; Extended Data Fig. 7c).”\n● Results section 4: “Similarly, we evaluated TRIM on the CRC dataset. In leave-one-out evaluation, TRIM achieved an AUC of 0.83 for predicting post-treatment clonal expansion, whereas baseline models (KNN and MLP) performed worse than or near random (even after extensive greedy hyperparameter optimization) regardless of whether they used RNA expression, TCR embeddings, or their combination as input (Extended Data Fig. 10a-d, Methods).”\n● Results section 5: “We then evaluated TRIM’s ability to identify differentially expressed genes on the CRC dataset. In leave-one-out evaluation, TRIM achieved AUC of 0.85 for all T cells, 0.82 for CD4 cells, and 0.79 for CD8 cells (Extended Data Fig. 14a).”\n● Methods: “Colorectal cancer dataset: This dataset is derived from the publicly available data from [27]. We used paired scRNAseq and scTCRseq data from 22 patients across 4 different conditions: blood pre-treatment, blood post-treatment, tumor pre-treatment and tumor post-treatment. In the source study, “pre-” and “post-treatment” correspond to baseline and on-treatment visits. Because some patients had multiple on-treatment samples, we aggregated those measurements at the patient level for each condition to make full use of the data.”\nNew Extended Fig. 3: Analysis on colorectal cancer dataset. a, UMAP visualizations of the top 100 RNA principal components for T cells from Chen et al. [27], colored by source (top left), cell type (top center), condition (top right), patients (bottom center) and clone count (bottom right), and quantification of the number of cells per patient per condition (bottom left). b, Plots comparing the pairwise distance between cells in the RNA PCA space using the first 100 principal components (y-axis) and the TCR space (x-axis) using the Hamming distance. The same patterns hold as in the HNSCC dataset. c, Plots showing no relationship in non-clones between their pairwise distance in RNA space (computed in the RNA PCA space using the first 100 principal components) and their pairwise TCR distance, using either TCR-BERT embeddings or our CNN-based autoencoder embeddings.\nNew Extended Fig. 7: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, UMAP visualizations of the real RNA-seq data from all patients (left) and the TRIM-generated data (right), colored by clone count. The model’s generated RNA and pseudoclone counts accurately match the real RNA and clone counts of the data at a distribution level. b, Plot comparing the model’s generated TCR diversity (measured by Shannon entropy) to the real diversity for each patient, source, and timepoint. c, Plots comparing the median clone and generated pseudo-clone counts for each cluster in the k-means clustered RNA space; for values of k in 10, 25, and 50, the resulting correlations are 0.94, 0.85, and 0.86.\nNew Extended Fig. 10: Generated data matches ground truth on held out patients in colorectal cancer dataset. a, TRIM accurately predicts whether a TCR in the blood pre-treatment given as input will expand (have higher clone count) in the blood post-treatment (left panel). b-d, A KNN or MLP trained to predict a binary expansion label on the same data performs worse than or similar to the random baseline (diagonal line), whether they are given the RNA only (b), the TCR only (c), or the concatenation of the two representations (d). For each baseline model, we also included a version with extensive hyperparameter optimization, performed via a greedy search on a validation split from the training data for each held-out patient.\nExtended Fig. 14a: Differential expression analysis of expanded clones in colorectal cancer dataset. a, Comparison of differentially expressed genes in TCR clones predicted to expand versus real differentially expressed genes that did expand in the ground truth. For both CD4+ and CD8+ subsets, the genes were ranked by their log-fold change in expression between expanded and non-expanded clones. The overlap between the top k genes from the predicted and the true ranked lists was computed for increasing values of k. Panel (a) shows results from the leave-one-patient-out analysis.\nRobustness to Patient Subgroups\nTo test the robustness of TRIM across different patient subgroups stratified by clinicopathological features, we conducted a new series of analyses based on the features available in a new colorectal cancer (CRC) dataset, which includes both tumor tissue and peripheral blood samples pre and post PD1-blockade with paired scRNAseq and scTCRseq.\nWe would like to note that this metadata is limited in the source publications: the HNSCC dataset did not release patient metadata, while the CRC dataset provided information on patient age and sex.\nUsing the available age and sex data from the CRC dataset, we performed a series of leave-group-out (LGO) analyses to test TRIM’s robustness. This involved holding out specific patient subgroups from training and evaluating the model's performance on them. We created subgroups for:\n4. All female patients\n5. Younger patients (defined as the lowest 15th percentile of the age distribution)\n6. Older patients (defined as the highest 15th percentile of the age distribution)\n(We noted that a 'leave-male-out' analysis was not feasible, as the small number of female patients was insufficient for robust model training (Extended Data Fig. 8a)).\nIn a similar LGO framework (and to address Reviewer Comment 5), we also tested TRIM’s robustness to a key technical variable: the number of cells sequenced per patient. We created subgroups for patients with few cells (lowest 15th percentile) and many cells (highest 15th percentile). At the same time, we acknowledge that the small sample sizes inherent to single-cell clinical studies place limitations on the statistical power of such subgroup analyses. These are limitations present in the original single-cell studies, which largely do not address inter-individual variability (PMIDs 35803260, 38981439).\n● Robust generalization: Across these different conditions, TRIM consistently captured the joint RNA–TCR space at the distribution level, as indicated by high correlations across multiple clustering resolutions (k = 10, 25, and 50; Extended Data Fig. 8b–f).We observed that higher-resolution clustering makes predicting median TCR clone counts more challenging, and this difficulty is further amplified when evaluating samples with few cells, as smaller clusters contain very limited information for accurate estimation. However, TRIM maintained strong performance in predicting clonotype diversity, with high correlations between real and predicted values (Extended Data Fig. 8b–f, right panels). We did observe reduced generalizability when older patients were left out of training. This difficulty in generalization appears linked to distinct properties of these patients’ immune repertoires.\n● Expansion prediction: We further tested TRIM’s ability of expansion prediction in leave-group-out settings, where the test patients had post-treatment measurements. TRIM maintained competitive performance, achieving AUCs of 0.68, 0.81, and 0.78 for leave-female-out, leave-young-out, and leave-more-cells-out evaluations, respectively, while baseline models again performed near random (Extended Data Fig. 11).\n● We similarly evaluated TRIM’s ability to identify differentially expressed genes in the CRC dataset. Across different subgroup analyses, TRIM maintained strong performance, with AUCs for all T cells of 0.83, 0.90, and 0.81 for leave-female-out, leave-young-out, and leave-more-cells-out, respectively; for CD4 cells, 0.83, 0.83, and 0.81; and for CD8 cells, 0.72, 0.84, and 0.72 (Extended Data Fig. 14b-d).\nThese results provide a more comprehensive assessment of TRIM’s performance across different patient conditions, and further validate TRIM’s ability to generalize to different cancer types as well as across diverse patient conditions. We have added the following paragraphs to the Results section to describe this new analysis and its findings. The new Extended Figures are also provided.\nIn Results section 3, we have added: “To examine the robustness of TRIM across different patient populations, we investigated factors such as age and sex using the CRC dataset. We also explored how varying the number of patients in the training data affected model performance. Specifically, we performed a leave-group-out analysis, where entire subgroups were excluded during training—for example, excluding all female patients, or patients in the upper or lower 15th percentile for age or sample count—and used these groups for testing (Extended Data Fig. 8a). Across these different conditions, TRIM consistently captured the joint RNA–TCR space at the distribution level, as indicated by high correlations across multiple clustering resolutions (k = 10, 25, and 50; Extended Data Fig. 8b–f).We observed that higher-resolution clustering makes predicting median TCR clone counts more challenging, and this difficulty is further amplified when evaluating samples with few cells, as smaller clusters contain very limited information for accurate estimation. However, TRIM maintained strong performance in predicting clonotype diversity, with high correlations between real and predicted values (Extended Data Fig. 8b–f, right panels). We did observe reduced generalizability when older patients were left out of training (Extended Data Fig. 8d). We hypothesize that this difficulty in generalization may be due to the distinct properties of this patients’ subpopulation, which shows reduced T cell clonal diversity. Nonetheless, the results across all subgroup analyses were consistent, indicating that TRIM is robust to demographic and sample-size variations.”\nIn Results section 4, we added: “To further assess robustness, we tested TRIM in leave-group-out settings, where the test patients had post-treatment measurements. TRIM maintained competitive performance, achieving AUCs of 0.68, 0.81, and 0.78 for leave-female-out, leave-young-out, and leave-more-cells-out evaluations, respectively, while baseline models again performed near random (Extended Data Fig. 11).”\nIn Results section 5, we added: “Across different subgroup analyses, TRIM maintained strong performance, with AUCs for all T cells of 0.83, 0.90, and 0.81 for leave-female-out, leave-young-out, and leave-more-cells-out, respectively; for CD4 cells, 0.83, 0.83, and 0.81; and for CD8 cells, 0.72, 0.84, and 0.72 (Extended Data Fig. 14b-d). These results further validate TRIM’s ability to generalize to different cancer types as well as across diverse patient conditions.”\nNew Extended Fig. 8: Robustness analysis of TRIM. a, Distribution of gender, age, and number of cells per patient in the colorectal cancer dataset. To assess model robustness, we performed leave-group-out analyses based on these attributes. b-f, plots showing the correlation between real versus generated by k-mean RNA clusters (for k=10, 25, and 50), and clonal diversity measured by Shannon entropy analysis of real versus generated TCR data for the following leave-group-out-analyses: (b) all female patients, (c) younger patients (age ≤ 15th percentile), (d) older patients (age ≥ 85th percentile), (e) patients with fewer cells (cell count ≤ 15th percentile), and (f) patients with more cells (cell count ≥ 85th percentile).\nNew Extended Fig. 11: Robustness of TRIM in predicting TCR expansion across patient subgroups. a-c, Evaluation of TRIM in predicting whether a TCR observed in pre-treatment blood will expand (i.e., increase in clone count) in post-treatment blood when leaving out (a) female patients, (b) younger patients, and (c) patients with more cells for testing. Analyses for older patients and patients with fewer cells were not performed due to the lack of post-treatment blood samples. In each case, baseline models (KNN, top right panels; MLP, bottom right panels) trained to predict binary expansion labels on the same data perform near the random baseline (diagonal line), regardless of whether they use RNA features only, TCR features only, or their concatenation.\nExtended Fig. 14: Differential expression analysis of expanded clones in colorectal cancer dataset. a-d, Comparison of differentially expressed genes in TCR clones predicted to expand versus real differentially expressed genes that did expand in the ground truth. For both CD4+ and CD8+ subsets, the genes were ranked by their log-fold change in expression between expanded and non-expanded clones. The overlap between the top k genes from the predicted and the true ranked lists was computed for increasing values of k. Panel (a) shows results from the leave-one-patient-out analysis; (b) excludes female patients for testing; (c) excludes younger patients; and (d) excludes patients with more cells. Analyses for older patients and patients with fewer cells were not performed due to the lack of post-treatment blood samples.\nIn summary, while we acknowledge that re-training is currently necessary to account for the distinct biology of different cancer types, our new, extensive analyses on the CRC cohort demonstrate:\n1. The TRIM methodology is generalizable and highly effective on a new, independent, and more complex dataset.\n2. The model's performance is robust to demographic and technical variations.\nWe have added these new analyses, figures, and corresponding text to the Results and Methods sections to respond to this question, and the following paragraph to the Discussion:\n“We have demonstrated that our model structure generalizes well across cancer types [19,27], and it’s robust to factors that introduce intrasample variability, such as age and sex, or number of sequenced cells per patient. While we recognize that a model trained on multiple cohorts, including a large variety of cancer types, could potentially be directly applicable to unseen cancer-type settings without retraining, given the current paucity of such datasets, we believe this is not currently achievable, nor the most accurate and cost-efficient strategy to address our problem at hand: being able to predict missing data in complex cohorts across time points and tissue-sites.”\nIn summary, the concept of TRIM is elegant and the fact that it is possible to encode the combined TCR/transcription profile in a low dimensional latent Gaussian variable and retain useful information is interesting. I am not convinced that the findings from application of the model so far substantially advance the field.\nWe thank the reviewer for recognizing the elegance of our model design and the strengths of our approach. We hope our additional analyses and clarification sufficiently demonstrate how our method's application can advance the field by generating predictions to fill in gaps in experimental data within complex cohorts of cancer patients receiving immunotherapies.\nReviewer #3 (Remarks on code availability):\nI did not have time to install and test the code on an HPC.\nReviewer #1 (Remarks to the Author):\nThe authors have put a substantial effort into responding to my initial comments and the manuscript is greatly improved. The inclusion of the CRC dataset is an important extension of the previous results. They have done a much better job of contextualizing their study with regards to the current literature as well as more clearly and cautiously interpreting their results. I have no further comments.\nReviewer #1 (Remarks on code availability):\nI have verified that, as described in their point-by-point response to referee comments, the authors have updated the github page and it now clearly describes how to analyse new datasets as well as how to reproduce the figures of the paper. I have not actually installed the code and run it myself however.\nWe thank the reviewer for the thoughtful comments and suggestions that helped us improve the manuscript.\nReviewer #2 (Remarks to the Author):\nThe authors have addressed all the major concerns.\nWe thank the reviewer for the thoughtful comments and suggestions that helped us improve the manuscript.\nReviewer #3 (Remarks to the Author):\nThe authors have made a very extensive effort to address all the reviewers' comments. Even more importantly, from my perspective, they have highlighted the limitations in their model, and in its predictive power. I am therefore happy to recommend acceptance, and for the reader to be the ultimate judge of utility.\nReviewer #3 (Remarks on code availability):\nI did not have time to run the code.\nWe thank the reviewer for the thoughtful comments and suggestions that helped us improve the manuscript."}, {"round": 2, "reviewer_comments": {"reviewer_1": "The authors have put a substantial effort into responding to my initial comments and the manuscript is greatly improved. The inclusion of the CRC dataset is an important extension of the previous results. They have done a much better job of contextualizing their study with regards to the current literature as well as more clearly and cautiously interpreting their results. I have no further comments.\n(Remarks on code availability)\nI have verified that, as described in their point-by-point response to referee comments, the authors have updated the github page and it now clearly describes how to analyse new datasets as well as how to reproduce the figures of the paper. I have not actually installed the code and run it myself however.", "reviewer_2": "The authors have addressed all the major concerns.\n(Remarks on code availability)", "reviewer_3": "The authors have made a very extensive effort to address all the reviewers' comments. Even more importantly, from my perspective, they have highlighted the limitations in their model, and in its predictive power. I am therefore happy to recommend acceptance, and for the reader to be the ultimate judge of utility.\n(Remarks on code availability)\nI did not have time to run the code."}, "author_response": "We thank the reviewer for the thoughtful comments and suggestions that helped us improve the manuscript."}]

Decision letter