Differentiation of thymic epithelial cells (TECs) is dependent on the Foxn1 transcription factor28,29,30,31,32,33,34,35, and defects in epithelial specification and development are known to block T cell development, resulting in profound immunodeficiency and/or autoimmunity36,37. Because the thymic epithelium occupies such a central role in the formation and maintenance of cellular immunity, it has become an attractive target for immunomodulatory and regenerative therapies38,39,40,41,42,43 designed to correct congenital lack or iatrogenic loss of thymic tissue or to modify failing central tolerance. However, despite the immunological importance of TECs, central aspects of the biology of these cells remain unresolved. Progenitor activity in the embryonic thymus is associated with cells expressing Psmb11, encoding a thymus-specific component of the immunoproteasome1,24,25; however, the presence of a bipotent epithelial progenitor (or multiple bipotent progenitors)22,23 capable of giving rise to the cortical and medullary regions of the adult thymus, as well as the many different specialized epithelial subtypes11,12,13,14,15,16,17,18, has not yet been demonstrated. Here a high-resolution CRISPR–Cas9-based barcoding scheme combined with single-cell RNA sequencing (scRNA-seq) identifies bipotent progenitors in embryonic and adult TEC populations and shows their developmental relationship. Notably, we also demonstrate that continuous signalling via Fgfr2b causes a massive and sustained quantitative increase in TEC numbers, without altering the dynamic qualitative changes associated with the ageing thymic microenvironment.

Cellular heterogeneity among TECs

We used scRNA-seq by CEL-Seq2 (refs. 44,45) to examine the cellular heterogeneity of CD45EpCAM+ TECs from 4-week-old (postnatal day (P) 28) mice (Extended Data Fig. 1a, b). Cells with similar transcriptional profiles were identified by Louvain clustering using VarID46, and their predicted relationships were quantified by VarID transition probabilities. In agreement with previous studies1,11,12,13,14,15,16,17,18, the resulting Uniform Manifold Approximation and Projection (UMAP) plot (Fig. 1a) illustrates the complexity of the epithelial compartment in terms of gene expression profiles and cluster sizes (Fig. 1b and Extended Data Fig. 1c–f). At this age, few sex-related differences were apparent (Extended Data Fig. 1a, b).

Fig. 1: Heterogeneity of TECs.
figure 1

a, UMAP representation of transcriptome similarities among 6,959 individual TECs derived from 4-week-old wild-type male (n = 2) and female (n = 2) mice. Cell clusters and transition probabilities were inferred with VarID44; connections with probability P > 0.001 are shown, with transition probabilities indicated by line thickness and colour. The positions of clusters containing early and postnatal bipotent progenitors and mature cTEC and mTEC clusters are indicated. Colours mark cells in the identified cell clusters. b, Expression profiles of signature genes in individual TEC clusters. cf, UMAP plots highlighting the aggregated expression profiles of gene groups distinguishing early (c) and postnatal (d) progenitors and cTECs (e) and mTECs (f). gi, Age-dependent changes in the TEC compartment. Transcriptome features of TEC clusters are shown at various time points expressed as ratios of progenitor and mature TEC gene set transcript counts; the P28 time point was used as a reference. Assignment of clusters to the four main populations in the coordinate system is indicated in g; the sizes of dots correspond to the relative fraction in the TEC population. j, Summary of dynamic changes in the composition of the TEC compartment. yr, year.

Source data

Identification of putative progenitors

We next sought to identify candidate progenitor populations within the epithelial compartment. Cells in several of the transcriptionally defined clusters expressed genes associated with mature TECs, including medullary TECs (mTECs; Aire and Ivl), tuft cells (Trpm5), cortical TECs (cTECs; Prss16) and nurse cells (Prss16 and Cd3e co-expression, indicative of cTECs with enclosed thymocytes47), and were therefore excluded from our search, as mature TECs are unlikely to possess progenitor potential. Furthermore, we excluded highly proliferative cells (expressing Mki67) and those lacking expression of Foxn1, which is known to be expressed in TEC progenitor cells22,34 (Fig. 1b and Extended Data Fig. 1c–e). We then considered the transition probabilities (links) between the eight remaining candidate progenitor clusters (c1, c5, c6, c8, c11, c13, c19 and c20). Cluster c5 had links to mature cTECs (c3 and c4) and to c1 and c20, of which the latter two expressed Krt5, a marker of the mTEC lineage. Except for mature cTECs in c4, c5 exhibited the highest level of Psmb11 expression, which is indicative of mature cTECs48 but also cells possessing progenitor potential, at least during embryogenesis1,24,25 and in the early postnatal period49. Hence, c5 exhibited features consistent with a bipotent progenitor. The transcriptomes of c6, c11 and c19 were very similar and had affinity for c1, which itself was connected to c5, c8 and c13 (Fig. 1b and Extended Data Fig. 1d). Cells in c6, c8, c11, c13 and c19 expressed Krt5 but only low levels of Psmb11, in line with the view that, in contrast to the situation in the embryo24, adult mTECs do not directly originate from a Psmb11-expressing TEC compartment1,25. Collectively, these analyses suggest the presence of at least two potential bipotent progenitor cell types: one progenitor population exhibiting a bias towards cTEC development (represented by c5; henceforth referred to as ‘early progenitors’) and another more heterogeneous progenitor population exhibiting a distinct mTEC bias (represented by c1 and c6; henceforth referred to as ‘postnatal progenitors’).

Age-dependent dynamics of TEC populations

Given the presumed developmental dynamics of TEC progenitors, we tested the hypothesis that the early progenitor population dominates in the embryonic and perinatal stages of development, whereas the postnatal progenitor population is more prevalent in adolescent and adult stages. To do this, we assigned four largely non-overlapping gene sets to mark the two progenitor populations (Supplementary Tables 1 and 2, and Extended Data Fig. 2a, b) and the mature cTEC and mTEC populations (Supplementary Tables 3 and 4). Population-specific scores were calculated by summation of transcript counts in the four separate gene lists. Notably, although the genes in these sets showed different temporal dynamics, the aggregated scores were not dominated by individual highly expressed genes (for example, see Extended Data Fig. 2c, d); pathway analysis associated regulation of cell growth with the two progenitor populations and immune-related processes with the two mature TEC populations (Extended Data Fig. 2e). The aggregated expression levels of progenitor and mature TEC gene sets mark four distinct domains in the UMAP plot of 4-week-old (P28) mice (Fig. 1c–f). At embryonic day (E) 16.5, the transcriptional landscape of TECs was dominated by the cTEC signature and early progenitor cells (Extended Data Figs. 3a, e and 4a). In new-born mice (P0), the number of postnatal progenitors and mTECs began to increase (Extended Data Figs. 3b, f and 4b). At P28, cells with the postnatal progenitor signature were more numerous than those with the early progenitor signature; moreover, the cTEC compartment was much smaller than at earlier stages, with mTEC-like cells dominating the TEC population (Extended Data Figs. 3c, g and 4c). At 1 year of age, the TEC compartment exhibited signs of functional deterioration. At this time, mature cTECs and mTECs made up only a small fraction of the thymic epithelia; by contrast, an unusually large number of cells simultaneously exhibited signatures of both progenitor types. These features suggest that, in aged mice, expanded progenitor-like cells may have lost their defining characteristics and that this indistinct phenotype is associated with low differentiation potential of these aged progenitors (Extended Data Figs. 3d, h and 4d). In a previous study, a putative progenitor population was identified with a distinct mTEC bias1; on the basis of gene expression profiles, the ‘intertypical’ TECs described in the study are closely related to the postnatal progenitor population defined here (Extended Data Fig. 5).

To visualize dynamic age-related changes in the TEC compartment, we calculated the ratios of transcript scores for early and postnatal progenitors (EP/PP) and for mature cTEC and mTEC populations (C/M) for each cell cluster and plotted them with reference to the P28 time point (Fig. 1g–i). Whereas the E16.5 TEC compartment was dominated by cells closely resembling early progenitors and mature cTECs (Fig. 1g), the P0 time point reflected the transition from an embryonic to an adult TEC compartment, as exemplified by the composition at P28 (Fig. 1h). The 1-year time point was characterized by few mature TECs (Fig. 1i). At this stage, most cell clusters populating the postnatal progenitor compartment (c2, c6, c7, c8 and c9) exhibited increased EP/PP ratios when compared with the corresponding P28 cell clusters, as a result of increased expression levels of genes that are associated with early progenitors; we refer to TECs with this indistinct phenotype as ‘aged progenitors’ (Fig. 1i, j). Our results support the notion that progenitor compartment(s) increase with age1. The age-dependent differences in TEC composition are summarized in Fig. 1j.

Shared ancestry of Ly51+ and UEA-1+ TECs

To further explore potential progenitor–progeny relationships in the TEC compartment, we developed a high-resolution lineage tracing method based on CRISPR–Cas9-mediated scarring in exon 3 of the Hprt gene (Fig. 2a, b and Extended Data Fig. 6a, b). In the hU6-sgRNAHprt; Foxn1-cre; Rosa26-flox-STOP-flox-Cas9 triple-transgenic mice used here, TECs are marked in early embryogenesis as soon as Foxn1 expression begins at around E11.5 (ref. 50). Because essentially all embryonic and adult TECs have a history of Foxn1 expression34, the scars (Fig. 2c) introduced in individual epithelial cells of the thymic rudiment in early embryogenesis indelibly mark their subsequent progeny. As is the case with other barcoding schemes51,52, individual scars, referred to as barcodes below, are generated at different frequencies (Fig. 2d); the most frequent sequences were shared by different mice (Extended Data Fig. 6c–e). The total number of different barcodes per thymus was on the order of 500–1,000 (Fig. 2e), close to the number of medullary islets observed in adult mice (300–1,800)26. We found a significant enrichment (Extended Data Fig. 6f) of barcodes that were shared by the EpCAM+CD45Ly51+UEA-1 cTEC and EpCAM+CD45Ly51UEA-1+ mTEC subsets (Extended Data Fig. 7a–f) of male mice, at several pre- and postnatal time points (Fig. 2f), suggesting a common origin for these subsets. We then identified barcodes that were represented only twice in the purified TEC populations of all mice, referred to as rare barcodes for the purpose of this experiment, and determined the probabilities of their co-occurrence in cTECs and mTECs of the same mouse versus any other mouse. On average, the corresponding mTEC and cTEC samples from the same mouse shared 3.5% of rare barcodes, whereas samples from different mice shared only 0.27% of rare barcodes. Without prefiltering based on barcode frequency, the fraction of barcodes shared by mTEC and cTEC populations was >50%. The significant degree of co-occurrence of such rare barcodes in mTEC and cTEC samples from the same mouse (Fig. 2g) suggests that cTECs and mTECs have a shared ancestor.

Fig. 2: Barcoding shows the differentiation capacity of progenitor populations.
figure 2

a, Schematic of the CRISPR–Cas9-based barcoding system. DSB, double-strand break. b, Location of the target site in exon 3 of the mouse Hprt gene. c, Examples of barcodes; the germline sequence is shown with the sgRNA target and protospacer adjacent motif (PAM) sequences indicated at top. Nucleotide additions and deletions (dashes) are indicated in red. d, Frequencies of individual barcodes in decreasing order. e, Number of Foxn1-expressing TECs in the thymic rudiment of E12.5 embryos9 (left; n = 5) and numbers of different barcodes in the thymi of mice of different ages (right): E16.5, n = 6; P0, n = 5; P12–P15, n = 11; >P16, n = 12. The dotted lines indicate the range of the numbers of progenitors previously inferred from medullary islet counts in adult mice26. f, Enrichment of shared barcodes in the Ly51UEA-1+ mTEC and Ly51+UEA-1 cTEC fractions of mice of different ages. Enrichment values were significantly different in the comparison of mice at P0 and >3 weeks (w) (P = 0.009, one-sided Wilcoxon test). E16.5, n = 6; P0, n = 5; ~2 weeks, n = 11; >3 weeks, n = 11. For e and f, boxes extend from the 25th to 75th percentile; whiskers extend to the largest and smallest values; and the median is indicated. See the Methods for a definition of the enrichment value Em. g, Co-occurrence probability of rare barcodes across pairs of samples highlighting enhanced co-occurrence in mTEC (m) and cTEC (c) fractions of the same mouse; individual mice are identified by number. Data are shown for n = 18 mice. hk, P values (–log10) of barcode frequencies indicating co-occurrence of individual barcodes in progenitor and mature TEC fractions (as defined in Fig. 1c–f) at different time points. For gk, P values were calculated as described in the Methods and corrected for multiple testing by the Benjamini–Hochberg method. The red numbers refer to clones discussed in the text.

Source data

Combining scRNA-seq and barcode tracing

Next, we applied simultaneous scRNA-seq and barcode tracing to dissect progenitor–progeny relationships within the TEC compartments of mice of different ages (Fig. 2h–k). To gain insight into the distribution of individual barcodes, we compared the barcode frequencies in each compartment to the expected barcode frequencies obtained from the bulk samples of 33 mice (Fig. 2d and Extended Data Fig. 6g). At E16.5, about two-thirds of the barcode sequences were found in early progenitors; the majority of barcodes enriched in early progenitors were also over-represented in cTECs (for example, barcode 10) (Fig. 2h), confirming the notion19,21 that the early progenitor population has a distinct bias towards differentiation into cTECs. The presence of shared barcodes (for example, barcode 9) also indicated a developmental relationship between early and postnatal progenitor populations. Some early and postnatal progenitor cells had not yet contributed to cTECs or mTECs by this time in development (barcodes 62 and 65, respectively). At P0, the most notable additions to lineage relationships (Fig. 2i) concerned the presence of a postnatal progenitor giving rise predominantly to mTECs (barcode 56) and the presence of an embryonic progenitor giving rise to both cTECs and mTECs (barcode 8). At P28, cells with the transcriptional signature of early progenitors predominantly gave rise to mTECs (barcode 86) rather than bothmTECs and cTECs (barcode 85); the number of postnatal progenitors biased towards mTEC differentiation (barcode 96) increased (Fig. 2j), a pattern that was independent of the sex of the animal (Extended Data Fig. 7g, h). Interestingly, several barcodes uniquely over-represented in mTECs were also observed (for example, barcode 91), suggesting the existence of compartment-specific progenitor activity (Extended Data Fig. 8); the corresponding barcodes may no longer be detectable in the bipotent progenitor populations either because the particular progenitor clones have ceased to exist or because they have too low a frequency to be reliably sampled. Finally, although the TEC compartment of aged mice lacked evidence of productive early progenitor cell types, bipotent progenitors were present (barcode 5) (Fig. 2k); however, most barcodes in aged postnatal progenitors were linked to cells with the cTEC signature, in line with the notion that cTEC-like cells increase in frequency in aged mice2,9. Collectively, our results illustrate the advantage gained from using a barcoding scheme in the identification and characterization of progenitor populations and their progeny when this approach is combined with transcriptome data at single-cell resolution.

Fgf signalling does not exhaust bipotent progenitors

Next, we combined scRNA-seq and lineage analysis to examine the cellular composition of the TEC compartment under conditions of continuous fibroblast growth factor (Fgf) signalling, which is known to regulate the size of the TEC compartment. For instance, whereas functionally mature TECs are generated in the absence of Fgfr2b, the overall size of the TEC compartment is small, resulting in a hypoplastic thymus53; by contrast, mice treated with pharmacological doses of the Fgfr2b ligand KGF, the human homologue of Fgf7, exhibit an increase in the number of TECs54,55. However, it is not known whether Fgf stimulation targets progenitors, mature TECs or both. To examine this question, we generated several mouse models for continuous autocrine provision of an Fgfr2b ligand in the thymus. We established that, under physiological conditions, the extent of Fgf signalling in TECs (Extended Data Fig. 9) is determined by limiting levels of ligand(s), rather than the receptor (Extended Data Fig. 10); notably, we found that pharmacological supplementation of the Fgfr2b ligand Fgf7 could be mimicked in vivo by ectopic expression of Fgf7 in the TECs of Foxn1-Fgf7 transgenic mice (Extended Data Fig. 11). Continuous autocrine provision of Fgf7 within the epithelial compartment in this transgenic model increased the number of TECs and thymocytes (Fig. 3a–c) and resulted in a massive and sustained increase in thymus size (Fig. 3d). Except for an increase in the number of Ly51+ TECs at P28 (Extended Data Fig. 12a–d) and a small reduction in the CD4/CD8 double-positive thymocyte compartment in old age (Extended Data Fig. 12e–h), thymopoiesis occurred normally in transgenic mice. Age-related diminution of thymopoiesis still occurred under conditions of chronic Fgf stimulation; however, the thymus of aged transgenic mice remained much larger than that of P28 wild-type mice (Fig. 3d). It appears therefore that reduced provision of Fgfr2b ligands contributes to the age-related progressive diminution of TEC numbers. Of note, expression levels of the Fgfr2 genes in the different TEC populations were highest in early progenitors and cTECs at all time points (Extended Data Fig. 13a).

Fig. 3: Autocrine Fgf stimulation results in sustained thymic hyperplasia.
figure 3

ac, Quantitative assessment of thymopoiesis in wild-type (WT) and Foxn1-Fgf7 transgenic (Tg) mice at 4 weeks and 1 year of age. a, WT P28, n = 18;Tg P28, n = 19; WT 1 yr, n = 10;Tg 1 yr, n = 18. b, WT P28, n = 19; Tg P28, n = 21; WT 1 yr, n = 10; Tg 1 yr, n = 18. c, WT P28, n = 18; Tg P28, n = 19; WT 1 yr, n = 10; Tg 1 yr, n = 18. Data are shown as the mean ± s.d. P values are indicated from two-sided t tests. d, Representative photographs of thymi from the mice analysed in a; scale bar, 10 mm. eg, Transcriptome features of TEC clusters expressed as ratios of progenitor and mature TEC gene set transcript counts. Assignment of clusters to the four main populations in the coordinate system is indicated in e; the sizes of dots correspond to the relative fraction in the TEC population. h, Summary of dynamic changes in the composition of the TEC compartment. i, j, P values (–log10) of barcode frequencies indicating co-occurrence of individual barcodes in progenitor and mature TEC fractions (as defined in Fig. 1c–f) at two time points. P values were calculated as described in the Methods and corrected for multiple testing by the Benjamini–Hochberg method. The red numbers correspond to clones discussed in the text. k, Schematic indicating the divergent developmental trajectories of embryonic and postnatal epithelial progenitors. Line thickness corresponds to lineage bias; the dashed line indicates the presumptive lineage relationship of the two progenitor populations.

Source data

At the P28 and 1-year time points, the Fgf-stimulated thymic microenvironment also exhibited considerable heterogeneity, in terms of both transcriptional diversity and cluster size (Extended Data Fig. 13b–g). As indicated by the changes in flow cytometry profiles (Extended Data Fig. 12a), the proportion of cells exhibiting the cTEC signature was increased at P28, as was the proportion of early progenitors (Extended Data Fig. 12i). In aged transgenic mice, the TEC compartment exhibited the indistinct phenotype of aged postnatal progenitors (Extended Data Fig. 12j) that was observed in their wild-type siblings (Fig. 1j). The relative shifts in populations under conditions of continuous Fgf stimulation away from mTECs at P28 and away from mature cell types at 1 year of age (Extended Data Fig. 12j) were also apparent from the representation of cell clusters in the coordinate system discriminating the transcriptional signatures of progenitor cells and mature TECs (Fig. 3e–g), a feature summarized in Fig. 3h.

The lineage relationships of Fgf-stimulated TECs at P28 (Fig. 3i) showed the presence of barcodes that were shared by both types of progenitors and mature cTECs and mTECs (for example, barcode 43) and of barcodes that connected both progenitor types and cTECs (for example, barcode 78). The lineage structure in 1-year-old mice (Fig. 3j) showed a large number of progenitors that did not give rise to differentiated progeny (barcode 119). Other postnatal progenitors gave rise to either cTECs (barcode 116) or mTECs (barcode 8). In contrast to the dominance of lineage-biased progenitors, bipotent progenitors were rare (barcode 113). Collectively, our data indicate that TEC progenitors are not depleted by autocrine Fgf stimulation and actively contribute to the microenvironment in aged mice.


Our study provides firm evidence for the contribution of early and postnatal bipotent progenitors to the formation and maintenance of the thymic epithelial microenvironment and reveals several new aspects of TEC biology. First, the two progenitor populations, an early cTEC-biased progenitor type and a postnatal mTEC-biased progenitor type, are already born during embryonic development and co-exist at E16.5, suggesting that some bipotent postnatal progenitors may be descendants of the early progenitor population (Fig. 3k). Second, the identification of private barcodes in both progenitor populations suggests that not all TEC progenitors are active at the same time, a phenomenon that is referred to as dormancy and known from other stem cell systems56. Third, the presence of private barcodes in mature cTECs and mTECs suggests the possibility that their corresponding progenitor(s) have been lost, in line with the notion that not all progenitor cells are long-lived24,25. Our current barcoding scheme does not allow us to determine whether these mature TECs can self-renew; resolution of this question awaits the use of an inducible version of the current marking scheme. Fourth, because the half-life of TECs is measured in weeks7, we conclude that long-term maintenance of the TEC compartment is associated with the activity of the postnatal progenitors identified here. Fifth, although continuous stimulation of thymic epithelia via autocrine secretion of an Fgfr2b ligand greatly increases the number of TECs, the qualitative characteristics of the thymic epithelium remain the same. However, the identification of progenitor populations provides new opportunities for focused pharmacological interventions to modulate the activity of the thymic microenvironment.



C57BL/6 mice were maintained in the Max Planck Institute of Immunobiology and Epigenetics. Foxn1-eGFP57, Foxn1-cre58, Rosa26-LSL-EYFP59, Foxn1-s-Fgfr2IIIb60, pLck-cre61, Rosa26-LSL-Cas9-EYFP62 and Foxn1-mCardinal9 transgenic mice have been described previously. The Foxn1-Fgf7 transgene was created by inserting a cDNA fragment corresponding to nucleotides 347–934 in GenBank accession number NM_008008 as a NotI fragment into pAHB14 (ref. 63); in some aged female Foxn1-Fgf7 transgenic mice (FVB/N-tg(Foxn1-Fgf7)1Tbo/Mpie), the two thymic lobes were asymmetric in size and shape; these mice were not included in our analysis. The Foxn1-Fgfr2IIIb transgene was created by inserting a cDNA fragment corresponding to nucleotides 1214–3366 in GenBank accession number NM_201601.2 as a NotI fragment into pAHB14 (ref. 63) and used to generate transgenic mice (FVB/N-tg(Foxn1-Fgfr2)1Tbo/Mpie). The hU6-sgRNAHprt transgene was cloned as a NotI fragment into the Bluescript vector and consists of the human U6 promotor (nucleotides 1–264 in GenBank accession number JN255693) followed by the mouse Hprt target sequence (5′-GATGGGAGGCCATCACATTGG-3′; nucleotides 255–274 in GenBank accession number J00423), the sgRNA backbone (nucleotides 218–139 (reverse complement) in Addgene plasmid 42250) and a short 3′ sequence (TTTTTTGGAA); for injection into fertilized eggs, the construct was linearized with SacI. Transgenic mice were generated on an FVB/N background (FVB/N-tg(hU6-sgRNA-Hprt)1Tbo/Mpie) and subsequently backcrossed to a C57BL/6J background. For timed matings, the day of plug detection was designated as E0.5. Genotyping information is summarized in Supplementary Table 15. Mice were kept in the animal facility of the Max Planck Institute of Immunobiology and Epigenetics under specific pathogen-free conditions. All animal experiments were performed in accordance with the relevant guidelines and regulations, approved by the review committee of the Max Planck Institute of Immunobiology and Epigenetics and Regierungspräsidium Freiburg, Germany (licences 35-9185.81/G-12/85; 35-9185.81/G-16/67).

KGF treatment

At the age of 4 weeks, male mice received nine intraperitoneal injections of KGF (Kepivance, Biovitrum, lot D120961G; 5 mg kg–1 body mass) at days 1, 2, 3, 8, 9, 10, 15, 16 and 17; the mice were killed on day 21.


Embryos for RNA in situ hybridization (ISH) were fixed in 4% paraformaldehyde (PFA) and subsequently embedded in paraffin using standard techniques.


The Applied Biosystems 7500 Fast system was used to detect the signal generated with gene-specific primers combined with 5′-FAM (6-carboxyfluorescein)-labelled hydrolysis probes from Universal Probe Library (Roche). Primer sequences were as follows: Fgf7, 5′-TGGCTGACACCATGACTAGC-3′ and 5′-GGCTACAGGCTGTCGTTTTT-3′ (probe 42); Fgf10, 5′-CGGGACCAAGAATGAAGACT-3′ and 5′-GCAACAACTCCGATTTCCAC-3′ (probe 80); CD31 (Pecam), 5′-CGGTGTTCAGCGAGATCC-3′ and 5′-ACTCGACAGGATGGAAATCAC-3′ (probe 45); Ly51 (Enpep), 5′-TGGACTCCAAAGCTGATCCT-3′ and 5′-TCAGCCCATCTGACTGGAAT-3′ (probe 83). Expression levels were normalized to those of Hprt, using primers 5′-TCCTCCTCAGACCGCTTTT-3′ and 5′-CCTGGTTCATCATCGCTAATC-3′ (probe 95).


RNA ISH on paraffin sections was performed using DIG-labelled probes as described64. Sequence coordinates in GenBank accession numbers were as follows: Foxn1, nucleotides 2181–3584 in XM_006532266.3; Fgf7, nucleotides 153–877 in NM_008008.3; Fgf10, nucleotides 859–1570 in NM_008002.3; Fgfr1, nucleotides 761–1614 in NM_001079909.2; Fgfr2, nucleotides 328–800 in EF143340; Fgfr2_exon3b, nucleotides 1819–1964 in NM_201601.2; Fgfr2_exon3c, nucleotides 2169–2306 in NM_010207.2; Hspb1, nucleotides 224–632 in NM_013560.2; Trpm5, nucleotides 499–962 in NM_020277.2.


Thymi were fixed in 4% PFA, washed in PBS, incubated in 20% sucrose overnight and embedded in OCT. Sections of 8–10 µm were dried overnight at room temperature and before staining were moistened in PBS followed by a 30-min blocking step (PBS with 0.5% BSA, 0.2% Tween and anti-mouse IgG (1:50)). Antibody staining was performed at room temperature in staining buffer (PBS with 0.5% BSA, 0.2% Tween and 3% serum). Sections were stained for 2 h with primary antibodies (Supplementary Table 6) and then for 45 min with secondary antibodies and streptavidin. Sections were washed with PBS between incubations. After staining, sections were mounted in Fluoromount G.

Image analysis

Images were acquired on Zeiss microscopes (Axioplan 2 or Imager Z1 with ApoTome attachment) equipped with AxioCam MRc 5 cameras.

Flow cytometry

To generate single-cell suspensions for analytical and preparative flow cytometry of TECs, the procedures described in refs. 18,65 were followed. Relevant staining reagents are listed in Supplementary Table 16. The enzymatic cocktail required to liberate TECs destroys the extracellular domains of the CD4 and CD8 surface markers (but not that of the CD45 molecule); hence, when analysis of thymocyte subsets was desired, thymocyte suspensions were prepared in parallel by mechanical liberation, achieved by gently pressing thymic lobes through 40-µm sieves. To isolate thymic mesenchymal and endothelial cells, the cell suspension of total thymocytes was depleted of CD45+ cells; the EpCAMCD45 cell population was stained for Ly51 and CD31 to purify EpCAMCD31Ly51+ mesenchymal and EpCAMCD31+Ly51 endothelial cells. Cell sorting and analytical flow cytometry were carried out using MoFlow and Fortessa instruments, respectively (both from Dako Cytomation-Beckman Coulter); flow cytometry experiments were carried out using FACSDiva and FlowJo software. The fraction of Foxn1-expressing cells was determined by eGFP fluorescence emanating from the Foxn1-eGFP transgene57, which faithfully recapitulates acute levels of Foxn1 expression18,34. The thymopoietic index was calculated by dividing the total number of thymocytes by the number of TECs.

Single-cell RNA amplification and library preparation

scRNA-seq was performed using the CEL-Seq2 method45 with several modifications44. A fivefold volume reduction was achieved using a nanolitre-scale pipetting robot (Mosquito HTS, TTP Labtech)66. EpCAM+CD45 TECs were sorted into 384-well plates containing 240 nl of primer mix67 and 1.2 μl of mineral oil (Sigma-Aldrich) replacing Vapor-lock. Sorted plates were centrifuged at 2,200g for 3 min at 4 °C, snap-frozen in liquid nitrogen and stored at −80 °C before further processing. To convert RNA into cDNA, 160 nl of reverse-transcription reaction mix including 0.4 µM template-switch oligonucleotide (5′-AAGCAGTGGTATCAACGCAGAGTGAATrGrGrG-3′; adapted from ref. 68) and 2.2 μl of second-strand reaction mix were added.

For the purpose of simultaneous transcriptome and barcode analysis, the volume of each well was equally split in half; that is, 1.1 µl per well was transferred to a new 384-well plate. The original plate (including the mineral oil) was used for barcode analysis, while the copy of the plate was used for analysis of individual cell transcriptomes.

For barcode analysis, all transcripts in each well were amplified by template-switch PCR (5′-AAGCAGTGGTATCAACGCAGAGT-3′ (template-switch oligonucleotide primer) and 5′-CAGAGTTCTACAGTCCGA-3′ (short P5 primer)), followed by amplification of the scar region of Hprt transcripts (5′-GCCGGTAATACGACTCACTATAGGGAGTTCTACAGTCCGACGATC-6bp UMI-6bp cell barcode-CCAGTTAAAGTTGAGAGATCATCTCC-3′ (Hprt barcoding primer), 5′-GCCTTGGCACCCGAGAATTCCATAGCGATGATGAACCAGGTTATGACC-3′ (Hprt short P7 primer)) using the PrimeSTAR GXL system (Takara Bio). Libraries were completed by addition of full-length adaptors by PCR (RP1, RPI1-48 TruSeq Small RNA Illumina adaptor sequences). Libraries from 96 cells were pooled before clean-up. In total, 32 libraries (E16.5 time point), 32 libraries (P0 time point), 28, 40 and 80 libraries (three P28 time points), 32 libraries (1-year time point), 44 libraries (Foxn1-Fgf7 transgenic mice, P28 time point) and 60 libraries (Foxn1-Fgf7 transgenic mice, 1-year time point) were sequenced on the MiSeq sequencing system (2 × 300 bp) at a depth of ≥4,000 reads per cell.

Transcriptomes were generated as described previously66; for the P28 wild-type dataset from a non-barcoded mouse, the whole sample volume was used for transcriptome generation. cDNAs from 96 cells were pooled before clean-up and in vitro transcription, generating four libraries from one 384-well plate. For all purification steps, 0.8 μl of AMPure/RNAClean XP beads (Beckman Coulter) was used per 1 μl of sample, including in library clean-up.

In total, 32 libraries (E16.5 time point), 32 libraries (P0 time point), 28, 40 and 80 libraries (three P28 time points), 28 libraries (non-barcoded dataset of P28 time point), 32 libraries (1-year time point), 44 libraries (Foxn1-Fgf7 transgenic mice at P28 time point) and 60 libraries (Foxn1-Fgf7 transgenic mice at 1-year time point) (each library was generated by pooling 96 cells) were sequenced on the Illumina HiSeq 2500 or NovaSeq 6000 sequencing system (paired-end multiplexing run, high-output mode) at a depth of ~170,000 reads per cell.

Quantification of transcript abundance

Paired-end reads were aligned to the transcriptome using bwa (version 0.6.2-r126) with default parameters69. The transcriptome contained all gene models based on the mouse ENCODE VM9 release downloaded from the UCSC genome browser, comprising 57,207 isoforms, with 57,114 isoforms mapping to fully annotated chromosomes (1 to 19, X, Y, mitochondria). All isoforms of the same gene were merged to a single gene locus. Furthermore, gene loci overlapping by >75% were merged to larger gene groups. This procedure resulted in 34,111 gene groups. The right mate of each read pair was mapped to the ensemble of all gene loci and to the set of 92 ERCC spike-ins in the sense direction70. Reads mapping to multiple loci were discarded. The left read contained the barcode information: the first six bases corresponded to the cell-specific barcode followed by six bases representing the unique molecular identifier (UMI). The remainder of the left read contained a poly(T) stretch. The left read was not used for quantification. For each cell barcode, the number of UMIs per transcript was counted and aggregated across all transcripts derived from the same gene locus. On the basis of binomial statistics, the number of observed UMIs was converted into transcript counts71.

scRNA-seq data analysis

Clustering analysis and visualization of all datasets were performed with the VarID algorithm46. Cells with a total number of transcripts of <1,000 (1-year wild-type dataset), <1,500 (wild-type and Foxn1-Fgf7 transgenic P28 datasets) and <3,000 (wild-type E16.5, wild-type P0 and Foxn1-Fgf7 transgenic 1-year datasets) were discarded, and the count data of the remaining cells were normalized by downscaling. Notably, before normalization, cells yielding transcriptomes containing >2% Kcnq1ot1 transcripts, a previously identified marker of low-quality cells, were removed from the analysis72. Moreover, transcripts correlating to Kcnq1ot1 with a Pearson’s correlation coefficient of >0.65 were also removed. Furthermore, mitochondrial genes as well as Hprt were excluded. The following genes and correlating gene groups were removed from the analysis using the CGenes parameter (all datasets): Jun, Fos and predicted genes with Gm identifiers. For the wild-type P28 datasets, Malat1, Xist and Neat1 were excluded using the FGenes parameter. A pruned k nearest neighbour (kNN) matrix was inferred using the pruneKnn function of VarID with default parameters except alpha (set to 1) and no_cores (set to 10). The UMAP representation was used for cell cluster visualization73. Transition probabilities between clusters were computed using the transitionProbs function of VarID with the P value set to 0.001. Differentially expressed genes between two subgroups of cells were identified similarly to in a previously published method74. First, negative binomial distributions reflecting the gene expression variability within each subgroup were inferred on the basis of the background model for the expected transcript count variabilitycomputed by the RaceID3 algorithm44. Using these distributions, a P value for the observed difference in transcript counts between the two subgroups was calculated and corrected for multiple testing with the Benjamini–Hochberg method.

High-resolution lineage tracing

The lineage tracing method developed here was based on CRISPR–Cas9-mediated scarring in exon 3 of the Hprt gene (Fig. 2a). Repair of Cas9-induced double-strand breaks results in a number of different sequence outcomes, which we refer to here as barcodes because they indelibly mark all cell progeny. Most barcodes carry deletions (Fig. 2b), preventing secondary modifications of their sequence; however, in rare instances, we recorded cells with two barcodes of similar sequence, presumably originating from ongoing modifications of the target sequence or from relaxed X-chromosome inactivation. In bulk and single-cell analyses of male mice, barcodes can be unambiguously read out on both the DNA and transcript level from the single X chromosome. In female mice, which carry two X chromosomes, DNA analysis at the level of cell populations yields ambiguous results; however, for single-cell analysis, the phenomenon of dosage compensation enables unambiguous barcode analysis at the RNA level. For the bulk analyses described here, we therefore used only male mice, whereas single-cell transcriptome analyses were conducted in both male and female mice. In the hU6-sgRNAHprt; Foxn1-cre; Rosa26-LSL-Cas9-EYFP triple-transgenic mice used here, TECs are marked in early embryogenesis, as soon as Foxn1 expression begins; our previous analysis indicated that, at the onset of Foxn1 expression, the thymic rudiment harbours ~4,000 epithelial cells9, thus placing an upper limit on the number of barcodes that can be observed in TECs at later developmental stages. However, the observed number of barcodes was three- to fourfold lower, presumably because the outcome of the repair process is not random; hence, some barcodes, although independently generated, are identical in sequence. The different frequencies of barcode generation must be taken into account when reconstructing lineage relationships; rare barcode sequences are more informative than frequently generated barcodes. On the basis of previous experiments using our Foxn1-cre transgenic line and the accessibility of the Rosa26 locus in TECs34, we assume that the overwhelming majority of TECs (>95%) are barcoded early in embryogenesis. However, we cannot exclude the possibility that some cells in the thymic rudiment are recruited into the Foxn1-positive lineage at later stages of development. If so, this would however only lessen the ability to identify clonal relationships across all time points.

Single-cell barcoding analysis

Paired-end fastq files were used for the identification of scar sequences in single cells. The first six bases of the left read contained the UMI information, followed by six bases representing the cell barcode. The remainder of the left read contained the Hprt scar sequence. The right mate of the paired-end reads also contained the overlapping Hprt scar sequence; that is, both reads contained the full scar sequences. Primers (forward, 5′-GCTCGAGATGTCATGAAGG-3′; reverse, 5′-GGGGGGCTATAAGTTCTT-3′) were used to extract the targeted region of the Hprt gene containing the edited sequence. Because both the left and right mates of the paired-end reads contain the full scar sequences, only sequences that appeared in both paired-end reads were used for further analysis. Moreover, only cells yielding ≥200 reads were included in the analysis; cells were excluded from further analysis if more than one scar sequence was detected in male cells (the threshold for the second sequence was set at ≥10% of the major sequence) and if more than two scar sequences were detected in female cells (the threshold for the third sequence was set at ≥10% of the second sequence).

Barcodes shared by cTECs and mTECs

DNA was isolated from sorted EpCAM+CD45Ly51+UEA-1 (cTEC) and EpCAM+CD45Ly51UEA-1+ (mTEC) populations from each mouse, and the region of exon 3 of the Hprt gene was amplified using the following primers: 5′-ACACTCTTTCCCTACACGACGCTCTTCCGATCTTTCATAGAGACAAGGAATGTGTCC-3′ (forward, P5-DD302)and 5′-GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTAGTTGATTATGTAGCAtAGTTTGACAAG-3′ (reverse, P7-DD305). Libraries were sequenced at a depth of ~250,000 reads per sample on the MiSeq sequencing system (2 × 300 bp).

Next, a table containing the counts of all barcodes across cTECs and mTECs for each mouse (n = 33 mice) was constructed, and the frequency distribution of barcodes was determined (Fig. 2d). To quantify enrichment of shared barcodes between the cTEC and mTEC samples for a given mouse, we first extracted the set of all barcodes Bi for sample i that were observed no more than twice in all animal samples; then, we determined the number of barcodes within set Bi co-occurring in another sample j and divided this by the number of barcodes in Bi to compute the co-occurrence probability of rare barcodes, termed Pij:

$${P}_{{ij}}=\frac{\sum _{k\in {B}_{i}}{\chi }_{{B}_{j}}\left(k\right)}{\sum _{k\in {B}_{i}}{\chi }_{{B}_{i}}\left(k\right)}$$

Here χT(x) denotes the indicator function; that is, χT(x) = 1 if xTχT(x) = 0 otherwise.

If i and j denote mTEC and cTEC samples from the same mouse, we would like to test whether Pij is relatively increased compared with cases where i and j denote samples from different mice.

An increased co-occurrence probability in corresponding samples compared with all other mice is indicative of a common barcode repertoire and is interpreted to mean that cTEC and mTEC populations in a mouse arise from common progenitors marked by particular barcodes; conversely, a similar ratio across all animals suggests the random occurrence of rare barcodes and argues against a common origin. The observation that some of the rare barcodes are not shared by cTEC and mTEC populations from the same mouse can be explained by the low frequency of these rare barcodes, resulting in sampling dropouts, but may also have a biological explanation, for example, if either mTEC or cTEC progeny derived from the same progenitor have died out. In this context, it is worth noting that, without prefiltering based on barcode frequency, the fraction of barcodes shared by mTEC and cTEC populations was >50%.

To quantify a single enrichment value Em for a given animal m, the ratios calculated for a corresponding pair of cTEC and mTEC samples, mcTEC and mmTEC, from the same mouse were divided (with cTECs or mTECs as a reference) by the average of the ratios for pairings involving either the respective cTEC or mTEC sample and a sample from any other animal, excluding the samples from animal m. The enrichment value Em is then calculated as the maximum of these ratios with mTECs or cTECs from the same animal as a reference:

$$\begin{array}{ccc}{E}_{m} & = & {\rm{\max }}(\frac{{P}_{{m}_{{\rm{cTEC}}}{m}_{{\rm{mTEC}}}}}{\frac{1}{N-2}\sum _{j\ne {m}_{{\rm{cTEC}}}{\vee j\ne m}_{{\rm{mTEC}}}}{P}_{{m}_{{\rm{cTEC}}}j}},\\ & & \frac{{P}_{{m}_{{\rm{mTEC}}}{m}_{{\rm{cTEC}}}}}{\frac{1}{N-2}\sum _{j\ne {m}_{{\rm{cTEC}}}{\vee j\ne m}_{{\rm{mTEC}}}}{P}_{{m}_{{\rm{mTEC}}}j}})\end{array}$$

Here N is the total number of samples and indicates logical conjunction. In the summation of the denominators, we exclude pairings involving the mTEC or cTEC samples for animal m.

The enrichment values of shared rare barcodes for each mouse were then plotted for each individual mouse grouped by age bin in Fig. 2f. Note that the analysis of bulk populations is most robust with respect to sampling when the numbers of cTECs and mTECs are approximately equal, as is the case for the P14 time point9. In situations where only a small number of barcodes are recovered, a diminished degree of co-occurrence is probably the result of sampling dropouts and the associated reduced statistical power.

Lineage analysis

To quantify the enrichment of shared barcodes between different populations within the TEC compartment at single-cell resolution, we first identified the cell clusters representing early progenitors, postnatal progenitors, and mature cTECs and mTECs in the scRNA-seq analysis of the individual mice. For a given mouse, we determined the barcode repertoire and counted the number of cells for each barcode; in the rare instances where a pair of barcodes was observed, we used the combination of barcodes for quantification. Cells with more than two barcodes were discarded, as this situation is the result of cell doublets and/or sequencing errors. For each barcode (or pair of quantified barcodes), we next determined its frequency for each TEC population in a given sample. These frequencies were compared with background barcode frequencies derived from the barcode distribution quantified from the bulk DNA sequencing data (n = 33; Fig. 2d), averaging across all samples. We considered sampling dropouts as a reference background model for technical variability and, therefore, assessed significant over-representation of barcodes on the basis of the estimated probability mass of a binomial distribution with a probability parameter informed by the barcode frequency derived from the bulk sequencing experiments. It is well known that UMI-based abundance derived from scRNA-seq data can be modelled by a negative binomial distribution without explicitly modelling zero inflation and that variability in genes (or barcodes) with low expression is described well by the binomial noise component71.

If nb,i is the number of times barcode b was observed in bulk DNA sequencing sample i, the background frequency of barcode fb was calculated as

$${f}_{b}=\frac{1}{N}\sum _{i\in S}\frac{{n}_{b,i}}{\sum _{k\in B}{n}_{k,i}}$$

Here B denotes the set of all barcodes, S denotes the set of all samples and N is the size of S.

Assuming binomial sampling statistics, we then calculated the P value Pb,i for the observed number of cells cb,i with barcode b among all barcode-carrying cells in sample i obtained by scRNA-seq as the right tail probability of the binomial distribution with background probability fb and the total number of barcode-carrying cells as parameters:

$${P}_{b,i}=\mathop{\sum }\limits_{j={c}_{b,i}}^{{C}_{i}}B\,(j|\,{f}_{b}\,,\,{C}_{i}\,{\rm{w}}{\rm{i}}{\rm{t}}{\rm{h}}\,{C}_{i})=\sum _{k\in B}{c}_{k,i}$$

These P values were further corrected for multiple testing by the Benjamini–Hochberg method, considering all P values for all detected barcodes in a given dataset. For cells with two barcodes, we calculated P values accordingly after multiplying the background frequencies of the co-occurring barcodes. Barcodes were considered informative if their P value indicated a significant deviation from the expected frequency (Pb,i < 0.001).

Gene set analysis

Population-specific gene sets were derived by performing differential gene expression analysis of clusters representing early progenitors (c5), postnatal progenitors (c1 and c6), cTECs (c4) and mTECs (c12, c2, c7, c9, c10 and c18) versus all other clusters from data for 4-week-old (P28) mice using the diffexpnb function of the RaceID3 package44. Genes with adjusted P < 0.01 and log2(fold change) > 1 were included in gene sets, from which genes with Gm and Rik identifiers were excluded. Overlapping genes between early progenitor and cTEC gene sets were excluded from the early progenitor gene set. Genes included in the gene sets of each of the four populations are listed in Supplementary Tables 14.

Although the transcriptional profiles of the progenitor clusters differed from those of the mature TEC subsets by the expression of heat shock protein genes, these genes were not included in the final lists, as they did not distinguish between the early and postnatal progenitors. The final gene sets were analysed for enriched biological processes using the Database for Annotation, Visualization and Integrated Discovery (DAVID) version 6.8 Analysis Wizard annotation tool75,76. In the representation of gene set ratios, clusters expressing T cell progenitor-related genes (representing thymic nurse cells) and parathyroid-associated genes (representing ectopic parathyroid tissue) were excluded.

scRNA-seq data comparisons

The present data were compared with publicly available scRNA-seq data for TECs isolated from mice of different ages1. To do this, the raw count matrices and metadata describing the nine subtypes of TECs were obtained through the Bioconductor data package MouseThymusAgeing (; Data normalization, dimensionality reduction and visualization with UMAP were then performed using the default parameters of the scRNA-seq data analysis CRAN package Seurat version 3 (ref. 77).

Statistical analysis and reproducibility

Two-tailed t tests were used to determine the significance levels of differences between the means of two independent samples, considering equal or unequal variance as determined by the F test. For multiple tests, the conservative Bonferroni correction was applied. For all analyses, several biological replicas were studied; numbers of replicas are indicated in the figures and/or figure legends. No statistical methods were used to predetermine sample sizes; blinding and randomization were not used. 

Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this paper.