TACS is a method for plotting a FACS-like plot for two features based on sc-RNA-seq data. For each of two query features, 100 features with similar expression patterns are selected and ranked by their Pearson correlation with the query. In a process akin to compensation, the intersection of the feature lists is removed from each list. The log normalized expression of the resulting features are then averaged within each cell, and the resulting quantities are plotted. This function is based on a simple scheme: choose features similar to the ones specified and average them to reduce the noise.
Usage
TACSPlot(
srt,
ref_srt = NULL,
assay = "RNA",
layer = "data",
group.by = NULL,
feature1,
feature2,
cutoffs = NULL,
density = FALSE,
palette = "Paired",
num_features_add = 100,
features_predetermined = FALSE,
aggregator = "sum",
remove_outliers = FALSE,
aspect.ratio = 1,
title = NULL,
subtitle = NULL,
xlab = NULL,
ylab = NULL,
suffix = " expression level",
legend.position = "right",
legend.direction = "vertical",
theme_use = "theme_scop",
theme_args = list(),
include_all = FALSE,
all_color = "grey20",
quadrants_line_color = "grey30",
quadrants_line_type = "solid",
quadrants_line_width = 0.3,
quadrants_label_size = 3,
density_alpha = NULL,
bins = 20,
h = NULL,
nrow = NULL,
ncol = NULL,
verbose = TRUE,
...
)
Arguments
- srt
Seurat object
- ref_srt
Seurat object. If your dataset is perturbed in a way that would substantially alter feature-feature correlations, for example if different time points are present or certain cell types are mostly depleted, you can feed in a reference srt, and TACS will choose axes based on the reference data. Default is NULL.
- assay
The assay to use. Default is "RNA".
- layer
The layer to use. Default is "data".
- group.by
The variable to group the cells by. Default is NULL.
- feature1
Horizontal axis on plot mimics this feature. Character, usually length 1 but possibly longer.
- feature2
Vertical axis on plot mimics this feature. Character, usually length 1 but possibly longer.
- cutoffs
If given, divide plot into four quadrants and annotate with percentages. Can be a numeric vector of length 1 or 2, or a list of two numeric vectors for x and y axes respectively.
- density
If TRUE, plot contours instead of points.
- palette
The palette to use. Default is "Paired".
- num_features_add
Each axis shows a simple sum of similar features. This is how many (before removing overlap). Integer.
- features_predetermined
If FALSE, plot the sum of many features similar to feature1 instead of feature1 alone (same for feature2). See ?GetSimilarFeatures. If TRUE, plot the sum of only the features given.
- aggregator
How to combine correlations when finding similar features. Options: "sum" (default), "min" (for "and"-like filter), "max", or "mean".
- remove_outliers
If TRUE, remove outliers from the plot. Default is FALSE.
- aspect.ratio
The aspect ratio of the plot. Default is 1.
- title
The title of the plot.
- subtitle
The subtitle of the plot.
- xlab
The x-axis label.
- ylab
The y-axis label.
- suffix
The suffix of the axis labels. Default is " expression level".
- legend.position
The position of the legend. Default is "right".
- legend.direction
The direction of the legend. Default is "vertical".
- theme_use
The theme to use. Default is "theme_scop".
- theme_args
A list of arguments for the theme. Default is list().
- include_all
If TRUE, include a panel with all cells. Default is FALSE.
- all_color
The color of the all cells panel. Default is "grey20".
- quadrants_line_color
The color of the quadrants lines. Default is "grey30".
- quadrants_line_type
The type of the quadrants lines. Default is "solid".
- quadrants_line_width
The width of the quadrants lines. Default is 0.3.
- quadrants_label_size
The size of the quadrants labels. Default is 3.
- density_alpha
The alpha of the density plot. Default is NULL.
- bins
Number of bins for density plot. Default is 20.
- h
Bandwidth for density plot. Default is NULL.
- nrow
The number of rows for the facet plot. Default is NULL.
- ncol
The number of columns for the facet plot. Default is NULL.
- verbose
A logical value indicating whether to print verbose output. Default is TRUE.
- ...
Extra params for ggplot2::stat_density2d.
References
https://github.com/maehrlab/thymusatlastools2/blob/f8b51ad684d56b2eeda780787eb9ad4ff3003eef/R/data_handling_seurat.R#L271 https://doi.org/10.1016/j.immuni.2018.04.015
Examples
data(pancreas_sub)
TACSPlot(
pancreas_sub,
feature1 = "H3f3b",
feature2 = "Eif1",
group.by = "CellType"
)
TACSPlot(
pancreas_sub,
feature1 = "H3f3b",
feature2 = "Eif1",
group.by = "CellType",
density = TRUE,
include_all = TRUE,
cutoffs = c(3, 2.5)
)
TACSPlot(
pancreas_sub,
feature1 = "H3f3b",
feature2 = "Eif1",
group.by = "CellType",
density = TRUE,
cutoffs = list(x = c(2, 3), y = c(2.5))
)
TACSPlot(
pancreas_sub,
feature1 = "H3f3b",
feature2 = "Eif1",
group.by = "SubCellType",
density = TRUE
)