plot_tcr_violin: plot_tcr_violin

plot_tcr_violinR Documentation

plot_tcr_violin

Description

Create violin plot of Expanded clone of interest vs background Non-expanded clones

Usage

plot_tcr_violin(
  input,
  title = "",
  gene,
  clone,
  clonotype_id = "clonotype_id",
  threshold = 5,
  facet_by,
  log_scale = F,
  colors = NULL,
  spread = NULL,
  jitter_pts = T,
  plot_mean = T,
  plot_mean_dot_size = 2,
  size = 1,
  sig = 3,
  number_labels = T,
  text_sizes = c(20, 10, 5, 10, 5, 5, 2),
  alpha = 0.5,
  theme = "classic",
  contour_line_width = 0.3
)

Arguments

input

SatijaLab’s Seurat Class, with normalized expression values in assay data slot, and TCR Clonotype ID's in meta.data. Or input Bioconductor’s ExpressionSet Class with (not log) values in exprs().

title

Title of the graph. Would be the gene name followed by clone's ID if not specified

gene

Feature for which to plot the expression level. For Seurat Object, ensure the correct DefaultAssay is specified prior to running this function. May access gene data through "assayname_GENE" e.g. "rna_CD8A", "adt_CD8", uses Seurat::FetchData()

clone

specific name of expanded clone of interest to compare to the non-expanded clones.

clonotype_id

meta.data or pData column name for clonotype ID's

threshold

number of clones above which is considered expanded (e.g. for n=5, 5 clones and below are Non-expanded). Ensure threshold is less than the number of expanded clones for @param clone

facet_by

a vector with one or two meta.data or pData column variables. If two, the first variable as columns and the second as rows.

log_scale

If true, transform UMIs by log2(UMI + 1).

colors

What colors to utilize for categorical data. Be sure it is of the proper length.

spread

e.g. Healthy category is unique in Disease and Skin. To use Healthy only as skin but not Disease, that is adding Healthy skin to each disease, spread = c("Disease", "Healthy").

plot_mean

plot the mean value as black dot with second y-axis on the right.

size

the size of dots.

sig

the number of digits after the decimal point for cell fraction value.

number_labels

show the total cell numbers and cell fraction with non-zero expression values under each bar.

text_sizes

a vector of title_size, axis_title, axis_text, legend_title, legend_text, facet_text, number_label_text_size, defaults too c(20,10,5,10,5,5,2)

theme

the plot theme. Default to be "classic" if not set to "bw".

contour_line_width

the thickness of the violin contour line

Details

Utilize information stored in meta.data to control the plot display. Each point_by as a dot with a bar showing the weighted mean of all point_by dots. color_by is set to display Expanded and Non-expanded clones

Examples

# library
library(Seurat)

# analyzed data with tcr
data("seu_analyzed")

# get clonotype highlighted on embedding
plot_tcr_violin(seu_analyzed, gene = "rna_GNLY", clone = "TRB:CASSLIGDVSYTF;TRA:CAGVGNTGKLIF", clonotype_id = "cdr3s_aa",
                facet_by = "seurat_clusters", threshold = 1)

# some additional uses
plot_tcr_violin(seu_analyzed, gene = "CD8A", clone = "CAAGAGFGNVLHC_CASSIGRWNGYTF", clonotype_id="CTaa", threshold=1, facet_by = c("Patient","Sample_Subtype"))
plot_tcr_violin(seu_analyzed, gene = "GNLY", clone = "clonotype1_SJS001", threshold=1, facet_by = c("hash.ID", "CellTypeSuperCluster"), log_scale = F)


Artur-man/VDJChef documentation built on Oct. 2, 2022, 9 p.m.