Skip to contents

TCRrep Object

S4 class and constructor for TCR repertoire data

TCRrep-class
TCRrep S4 class
TCRrep()
Create a TCRrep object
show(<TCRrep>)
Show method for TCRrep objects
subset(<TCRrep>)
Subset a TCRrep using non-standard evaluation
`[`(<TCRrep>,<ANY>,<ANY>,<ANY>)
Subset a TCRrep object by row indices

Distance Computation

Pairwise TCRdist distance calculations

tcrdist_matrix()
Compute pairwise TCRdist distance matrix
tcrdist_rect()
Compute rectangular TCRdist matrix between a query set and a reference set
tcrdist_sparse()
Compute sparse TCRdist matrix as a dgCMatrix
weighted_cdr3_distance()
Weighted CDR3 distance between two CDR3 sequences
bsd4_matrix()
Retrieve the BSD4 substitution matrix
hamming_distance()
Hamming distance between two CDR3 sequences
hamming_matrix()
Pairwise Hamming distance matrix for CDR3 sequences

K-nearest neighbor and radius-based neighbor queries

tcrdist_knn()
K-nearest-neighbors by TCRdist with optional group masking
tcrdist_radius_neighbors()
Radius-based TCRdist neighbor search with optional group masking
knn_from_matrix()
K-nearest-neighbors from a precomputed distance matrix
knn_from_pca()
K-nearest-neighbors from a PCA embedding matrix

Clumping & Background Models

TCR clumping detection with background-corrected significance

find_clumping()
Find TCR clumping in TCR space
setup_tcr_groups()
Assign alpha and beta chain group indices

Database Matching

Match TCRs against literature epitope databases

find_significant_tcrdist_matches()
Find significant TCRdist matches between query and database TCRs
match_tcrs_to_db()
Match TCRs to a literature database
strict_single_chain_match_tcrs_to_db()
Strict CDR3 sequence matching against a database

Dimensionality Reduction

Kernel PCA and UMAP for TCRdist distance matrices

compute_tcrdist_kernel_pca()
Kernel PCA on TCRdist distances
compute_tcrdist_umap()
Compute UMAP embedding from TCRdist data

CD8 Scoring

Logistic regression-based CD8 phenotype scoring

make_cd8_score_table_column()
CD8 logistic regression score for paired TCRs

Diversity Metrics

Repertoire diversity, richness, clonality, and overlap

tcr_diversity()
Generalized Simpson's diversity (Hill numbers framework)
tcr_fuzzy_diversity()
TCR-aware fuzzy diversity
tcr_richness()
TCR repertoire richness
tcr_clonality()
TCR repertoire clonality
tcr_shannon_entropy()
Shannon entropy of a clonotype distribution
tcr_gini()
Gini index of a clonotype distribution
tcr_repertoire_overlap()
Repertoire overlap metrics

Clustering & Neighborhood Tests

Hierarchical clustering and neighborhood-based statistics

tcrdist_hclust()
Hierarchical clustering of TCRs by TCRdist
cluster_tcrs()
Cluster TCRs using various algorithms
neighborhood_test()
Test association between a variable and TCR neighborhoods

Meta-Clonotypes

Quasi-public TCR motif discovery across subjects

find_meta_clonotypes()
Identify quasi-public meta-clonotypes
summarize_meta_clonotype()
Summarize a meta-clonotype's composition

Joins

Distance-based fuzzy joining of TCR datasets

tcrdist_join()
Join two TCR datasets by TCRdist threshold

Visualization

Plotting functions for TCR repertoire data

plot_tcrdist_heatmap()
Plot a TCRdist pairwise distance heatmap
plot_tcrdist_dendrogram()
Plot a TCRdist-based dendrogram
plot_distance_distribution()
Plot the distribution of pairwise TCRdist distances
plot_cdr3_logo()
Plot a CDR3 sequence logo
plot_cdr3_length()
Plot CDR3 length distribution
plot_junction_bars()
Plot junction bars showing V/N/D/J nucleotide composition
plot_vj_gene_logo()
Plot a V/J gene usage logo
plot_tcr_logo_panel()
Plot a composite TCR rearrangement logo panel
compute_nucseq_src()
Compute nucleotide source annotations for CDR3 sequences
plot_gene_usage()
Plot V-gene or J-gene usage frequencies
plot_tcr_scatter()
Plot a 2D scatter of TCR embeddings
compute_tcr_network()
Build a TCR clone network from distance data
plot_tcr_network()
Plot a TCR clone network

I/O

Read and standardize TCR data from various formats

as_tcr_df()
Standardize a TCR data.frame to tcrdistR column names
read_tcr_table()
Read a delimited file containing TCR repertoire data
read_airr()
Read AIRR Rearrangement TSV format
read_adaptive()
Read Adaptive Biotechnologies ImmunoSeq TSV file
read_10x()
Read 10X Genomics VDJ contig annotations

Data

Built-in datasets

dash
DASH dataset: paired alpha-beta mouse TCRs across 7 epitopes
flu
Human influenza TCR dataset from VDJdb

Utilities

Gene database, constants, and helper functions

load_gene_database()
Load and cache the TCR/BCR gene database
list_organisms()
List available organisms in the gene database
trim_allele_to_gene()
Trim allele designation from a gene ID
get_translation()
Translate a nucleotide sequence to a protein sequence
reverse_complement()
Reverse complement of a nucleotide sequence
AMINO_ACIDS
Standard 20 amino acid single-letter codes