Type: | Package |
Title: | Generate Publication Ready Visualizations of Single Cell Transcriptomics Data |
Version: | 2.0.2 |
Description: | A system that provides a streamlined way of generating publication ready plots for known Single-Cell transcriptomics data in a “publication ready” format. This is, the goal is to automatically generate plots with the highest quality possible, that can be used right away or with minimal modifications for a research article. |
License: | GPL-3 |
URL: | https://github.com/enblacar/SCpubr/, https://enblacar.github.io/SCpubr-book/ |
BugReports: | https://github.com/enblacar/SCpubr/issues/ |
Depends: | R (≥ 4.0.0) |
Suggests: | AnnotationDbi, assertthat, AUCell, circlize, cli, cluster, clusterProfiler, colorspace, ComplexHeatmap, covr, decoupleR, dplyr (≥ 1.1.0), enrichplot, forcats, ggalluvial, ggbeeswarm, ggdist, ggExtra, ggh4x, ggnewscale, ggplot2 (≥ 3.4.0), ggplotify, ggrastr, ggrepel, ggridges, ggsignif, graphics, infercnv, knitr, labeling, magrittr, MASS, Matrix, methods, Nebulosa, org.Hs.eg.db, patchwork, pheatmap, plyr, purrr, qpdf, RColorBrewer, rjags, rlang, rmarkdown, scales, scattermore, Seurat, SeuratObject, sf, stringr, svglite, testthat (≥ 3.0.0), tibble, tidyr, UCell, viridis, withr |
VignetteBuilder: | knitr |
biocViews: | Software, SingleCell, Visualization |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
LazyData: | true |
LazyDataCompression: | xz |
RoxygenNote: | 7.2.1 |
NeedsCompilation: | no |
Packaged: | 2023-10-11 09:31:17 UTC; e420a |
Author: | Enrique Blanco-Carmona
|
Maintainer: | Enrique Blanco-Carmona <scpubr@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-10-11 09:50:02 UTC |
Generate Alluvial plots.
Description
This function is based on the ggalluvial package. It allows you to generate alluvial plots from a given Seurat object.
Usage
do_AlluvialPlot(
sample,
first_group,
last_group,
middle_groups = NULL,
colors.use = NULL,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
font.size = 14,
font.type = "sans",
xlab = NULL,
ylab = "Number of cells",
repel = FALSE,
fill.by = last_group,
use_labels = FALSE,
stratum.color = "black",
stratum.fill = "white",
stratum.width = 1/3,
stratum.fill.conditional = FALSE,
use_geom_flow = FALSE,
alluvium.color = "white",
flow.color = "white",
flip = FALSE,
label.color = "black",
curve_type = "sigmoid",
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
plot.grid = FALSE,
grid.color = "grey75",
grid.type = "dashed",
na.value = "white",
legend.position = "right",
legend.title = NULL,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
first_group |
|
last_group |
|
middle_groups |
|
colors.use |
|
plot.title , plot.subtitle , plot.caption |
|
font.size |
|
font.type |
|
xlab , ylab |
|
repel |
|
fill.by |
|
use_labels |
|
stratum.color , alluvium.color , flow.color |
|
stratum.fill |
|
stratum.width |
|
stratum.fill.conditional |
|
use_geom_flow |
|
flip |
|
label.color |
|
curve_type |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
plot.grid |
|
grid.color |
|
grid.type |
|
na.value |
|
legend.position |
|
legend.title |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_AlluvialPlot", passive = TRUE)
message(value)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Compute basic sankey plot.
p <- SCpubr::do_AlluvialPlot(sample = sample,
first_group = "orig.ident",
last_group = "seurat_clusters")
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Create Bar Plots.
Description
Create Bar Plots.
Usage
do_BarPlot(
sample,
group.by,
order = FALSE,
add.n = FALSE,
add.n.face = "bold",
add.n.expand = c(0, 1.15),
add.n.size = 4,
order.by = NULL,
split.by = NULL,
facet.by = NULL,
position = "stack",
font.size = 14,
font.type = "sans",
legend.position = "bottom",
legend.title = NULL,
legend.ncol = NULL,
legend.nrow = NULL,
legend.byrow = FALSE,
axis.text.x.angle = 45,
xlab = NULL,
ylab = NULL,
colors.use = NULL,
flip = FALSE,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
plot.grid = FALSE,
grid.color = "grey75",
grid.type = "dashed",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain",
strip.text.face = "bold",
return_data = FALSE
)
Arguments
sample |
|
group.by |
|
order |
|
add.n |
|
add.n.face |
|
add.n.expand |
|
add.n.size |
|
order.by |
|
split.by |
|
facet.by |
|
position |
|
font.size |
|
font.type |
|
legend.position |
|
legend.title |
|
legend.ncol |
|
legend.nrow |
|
legend.byrow |
|
axis.text.x.angle |
|
xlab , ylab |
|
colors.use |
|
flip |
|
plot.title , plot.subtitle , plot.caption |
|
plot.grid |
|
grid.color |
|
grid.type |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
strip.text.face |
|
return_data |
|
Value
A ggplot2 object containing a Bar plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_BarPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic bar plot, horizontal.
p1 <- SCpubr::do_BarPlot(sample = sample,
group.by = "seurat_clusters",
legend.position = "none",
plot.title = "Number of cells per cluster")
# Split by a second variable.
sample$modified_orig.ident <- sample(x = c("Sample_A", "Sample_B", "Sample_C"),
size = ncol(sample),
replace = TRUE,
prob = c(0.2, 0.7, 0.1))
p <- SCpubr::do_BarPlot(sample,
group.by = "seurat_clusters",
split.by = "modified_orig.ident",
plot.title = "Number of cells per cluster in each sample",
position = "stack")
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
BeeSwarm plot.
Description
BeeSwarm plot.
Usage
do_BeeSwarmPlot(
sample,
feature_to_rank,
group.by = NULL,
assay = NULL,
reduction = NULL,
slot = NULL,
continuous_feature = FALSE,
order = FALSE,
colors.use = NULL,
legend.title = NULL,
legend.type = "colorbar",
legend.position = "bottom",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.ncol = NULL,
legend.icon.size = 4,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = NULL,
ylab = NULL,
font.size = 14,
font.type = "sans",
remove_x_axis = FALSE,
remove_y_axis = FALSE,
flip = FALSE,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = 1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
verbose = TRUE,
raster = FALSE,
raster.dpi = 300,
plot_cell_borders = TRUE,
border.size = 1.5,
border.color = "black",
pt.size = 2,
min.cutoff = NA,
max.cutoff = NA,
na.value = "grey75",
number.breaks = 5,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
feature_to_rank |
|
group.by |
|
assay |
|
reduction |
|
slot |
|
continuous_feature |
|
order |
|
colors.use |
|
legend.title |
|
legend.type |
|
legend.position |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.ncol |
|
legend.icon.size |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
font.size |
|
font.type |
|
remove_x_axis , remove_y_axis |
|
flip |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
verbose |
|
raster |
|
raster.dpi |
|
plot_cell_borders |
|
border.size |
|
border.color |
|
pt.size |
|
min.cutoff , max.cutoff |
|
na.value |
|
number.breaks |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a Bee Swarm plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_BeeSwarmPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic Bee Swarm plot - categorical coloring.
# This will color based on the unique values of seurat_clusters.
p <- SCpubr::do_BeeSwarmPlot(sample = sample,
feature_to_rank = "PC_1",
group.by = "seurat_clusters",
continuous_feature = FALSE)
# Basic Bee Swarm plot - continuous coloring.
# This will color based on the PC_1 values.
p <- SCpubr::do_BeeSwarmPlot(sample = sample,
feature_to_rank = "PC_1",
group.by = "seurat_clusters",
continuous_feature = TRUE)
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Generate Box Plots.
Description
Generate Box Plots.
Usage
do_BoxPlot(
sample,
feature,
group.by = NULL,
split.by = NULL,
assay = NULL,
slot = "data",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
colors.use = NULL,
na.value = "grey75",
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = NULL,
ylab = NULL,
legend.title = NULL,
legend.title.position = "top",
legend.position = "bottom",
boxplot.line.color = "black",
outlier.color = "black",
outlier.alpha = 0.5,
boxplot.linewidth = 0.5,
boxplot.width = NULL,
plot.grid = TRUE,
grid.color = "grey75",
grid.type = "dashed",
flip = FALSE,
order = FALSE,
use_silhouette = FALSE,
use_test = FALSE,
comparisons = NULL,
test = "wilcox.test",
map_signif_level = TRUE,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
feature |
|
group.by |
|
split.by |
|
assay |
|
slot |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
colors.use |
|
na.value |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
legend.title |
|
legend.title.position |
|
legend.position |
|
boxplot.line.color |
|
outlier.color |
|
outlier.alpha |
|
boxplot.linewidth |
|
boxplot.width |
|
plot.grid |
|
grid.color |
|
grid.type |
|
flip |
|
order |
|
use_silhouette |
|
use_test |
|
comparisons |
A list of length-2 vectors. The entries in the vector are either the names of 2 values on the x-axis or the 2 integers that correspond to the index of the columns of interest. |
test |
the name of the statistical test that is applied to the values of
the 2 columns (e.g. |
map_signif_level |
Boolean value, if the p-value are directly written as
annotation or asterisks are used instead. Alternatively one can provide a
named numeric vector to create custom mappings from p-values to annotation:
For example: |
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_BoxPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic box plot.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA")
p
# Use silhouette style.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
use_silhouette = TRUE)
p
# Order by mean values.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
order = TRUE)
p
# Apply second grouping.
sample$orig.ident <- ifelse(sample$seurat_clusters %in% c("0", "1", "2", "3"), "A", "B")
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
split.by = "orig.ident")
p
# Apply statistical tests.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
group.by = "orig.ident",
use_test = TRUE,
comparisons = list(c("A", "B")))
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Cellular States plot.
Description
This plot aims to show the relationships between distinct enrichment scores. If 3 variables are provided, the relationship is between the Y axis and the dual X axis. If 4 variables are provided, each corner of the plot represents how enriched the cells are in that given list. How to interpret this? In a 3-variable plot, the Y axis just means one variable. The higher the cells are in the Y axis the more enriched they are in that given variable. The X axis is a dual parameter one. Cells falling into each extreme of the axis are highly enriched for either x1 or x2, while cells falling in between are not enriched for any of the two. In a 4-variable plot, each corner shows the enrichment for one of the 4 given features. Cells will tend to locate in either of the four corners, but there will be cases of cells locating mid-way between two given corners (enriched in both features) or in the middle of the plot (not enriched for any).
Usage
do_CellularStatesPlot(
sample,
input_gene_list,
x1,
y1,
x2 = NULL,
y2 = NULL,
group.by = NULL,
colors.use = NULL,
legend.position = "bottom",
legend.icon.size = 4,
legend.ncol = NULL,
legend.nrow = NULL,
legend.byrow = FALSE,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
font.size = 14,
font.type = "sans",
xlab = NULL,
ylab = NULL,
axis.ticks = TRUE,
axis.text = TRUE,
verbose = FALSE,
enforce_symmetry = FALSE,
plot_marginal_distributions = FALSE,
marginal.type = "density",
marginal.size = 5,
marginal.group = TRUE,
plot_cell_borders = TRUE,
plot_enrichment_scores = FALSE,
border.size = 2,
border.color = "black",
pt.size = 2,
raster = FALSE,
raster.dpi = 1024,
plot_features = FALSE,
features = NULL,
use_viridis = TRUE,
viridis.palette = "G",
viridis.direction = 1,
sequential.palette = "YlGnBu",
sequential.direction = -1,
nbin = 24,
ctrl = 100,
number.breaks = 5,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
input_gene_list |
|
x1 |
|
y1 |
|
x2 |
|
y2 |
|
group.by |
|
colors.use |
|
legend.position |
|
legend.icon.size |
|
legend.ncol |
|
legend.nrow |
|
legend.byrow |
|
plot.title , plot.subtitle , plot.caption |
|
font.size |
|
font.type |
|
xlab , ylab |
|
axis.ticks |
|
axis.text |
|
verbose |
|
enforce_symmetry |
|
plot_marginal_distributions |
|
marginal.type |
|
marginal.size |
|
marginal.group |
|
plot_cell_borders |
|
plot_enrichment_scores |
|
border.size |
|
border.color |
|
pt.size |
|
raster |
|
raster.dpi |
|
plot_features |
|
features |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
nbin |
|
ctrl |
|
number.breaks |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Details
This plots are based on the following publications:
Neftel, C. et al. An Integrative Model of Cellular States, Plasticity, and Genetics for Glioblastoma. Cell 178, 835-849.e21 (2019). doi:10.1016/j.cell.2019.06.024
Tirosh, I., Venteicher, A., Hebert, C. et al. Single-cell RNA-seq supports a developmental hierarchy in human oligodendroglioma. Nature 539, 309–313 (2016). doi:10.1038/nature20123
Value
A ggplot2 object containing a butterfly plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_CellularStatesPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Define some gene sets to query. It has to be a named list.
gene_set <- list("A" = rownames(sample)[1:10],
"B" = rownames(sample)[11:20],
"C" = rownames(sample)[21:30],
"D" = rownames(sample)[31:40])
# Using two variables: A scatter plot X vs Y.
p <- SCpubr::do_CellularStatesPlot(sample = sample,
input_gene_list = gene_set,
x1 = "A",
y1 = "B",
nbin = 1,
ctrl = 10)
p
# Using three variables. Figure from: https://www.nature.com/articles/nature20123.
p <- SCpubr::do_CellularStatesPlot(sample = sample,
input_gene_list = gene_set,
x1 = "A",
y1 = "B",
x2 = "C",
nbin = 1,
ctrl = 10)
p
# Using four variables. Figure from: https://pubmed.ncbi.nlm.nih.gov/31327527/
p <- SCpubr::do_CellularStatesPlot(sample = sample,
input_gene_list = gene_set,
x1 = "A",
y1 = "C",
x2 = "B",
y2 = "D",
nbin = 1,
ctrl = 10)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Generate a Chord diagram.
Description
Generate a Chord diagram.
Usage
do_ChordDiagramPlot(
sample = NULL,
from = NULL,
to = NULL,
colors.from = NULL,
colors.to = NULL,
big.gap = 10,
small.gap = 1,
link.border.color = NA,
link.border.width = 1,
highlight_group = NULL,
alpha.highlight = 25,
link.sort = NULL,
link.decreasing = TRUE,
z_index = FALSE,
self.link = 1,
symmetric = FALSE,
directional = 1,
direction.type = c("diffHeight", "arrows"),
link.arr.type = "big.arrow",
scale = FALSE,
alignment = "default",
annotationTrack = c("grid", "axis"),
padding_labels = 4,
...
)
Arguments
sample |
|
from , to |
|
colors.from , colors.to |
|
big.gap |
|
small.gap |
|
link.border.color |
|
link.border.width |
|
highlight_group |
|
alpha.highlight |
|
link.sort |
pass to |
link.decreasing |
pass to |
z_index |
|
self.link |
|
symmetric |
pass to |
directional |
|
direction.type |
|
link.arr.type |
|
scale |
|
alignment |
|
annotationTrack |
pass to |
padding_labels |
|
... |
For internal use only. |
Value
A circlize plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_ChordDiagramPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic chord diagram.
sample$assignment <- ifelse(sample$seurat_clusters %in% c("0", "4", "7"), "A", "B")
sample$assignment[sample$seurat_clusters %in% c("1", "2")] <- "C"
sample$assignment[sample$seurat_clusters %in% c("10", "5")] <- "D"
sample$assignment[sample$seurat_clusters %in% c("8", "9")] <- "E"
p <- SCpubr::do_ChordDiagramPlot(sample = sample,
from = "seurat_clusters",
to = "assignment")
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Generate color scales based on a value.
Description
This function is an adaptation of colortools package. As the package was removed from CRAN on 23-06-2022, this utility function came to existence in order to cover the gap. It is, on its basis, an adaptation of the package into a single function. Original code, developed by Gaston Sanchez, can be found in: https://github.com/gastonstat/colortools
Usage
do_ColorPalette(
colors.use,
n = 12,
opposite = FALSE,
adjacent = FALSE,
triadic = FALSE,
split_complementary = FALSE,
tetradic = FALSE,
square = FALSE,
complete_output = FALSE,
plot = FALSE,
font.size = 14,
font.type = "sans"
)
Arguments
colors.use |
|
n |
|
opposite |
|
adjacent |
|
triadic |
|
split_complementary |
|
tetradic |
|
square |
|
complete_output |
|
plot |
|
font.size |
|
font.type |
|
Value
A character vector with the desired color scale.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_ColorPalette", passive = TRUE)
if (isTRUE(value)){
# Generate a color wheel based on a single value.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue")
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
plot = TRUE)
# Generate a pair of opposite colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
opposite = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
opposite = TRUE,
plot = TRUE)
# Generate a trio of adjacent colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
adjacent = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
adjacent = TRUE,
plot = TRUE)
# Generate a trio of triadic colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
triadic = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
triadic = TRUE,
plot = TRUE)
# Generate a trio of split complementary colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
split_complementary = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
split_complementary = TRUE,
plot = TRUE)
# Generate a group of tetradic colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
tetradic = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
tetradic = TRUE,
plot = TRUE)
# Generate a group of square colors based on a given one.
colors <- SCpubr::do_ColorPalette(colors.use = "steelblue",
square = TRUE)
p <- SCpubr::do_ColorPalette(colors.use = "steelblue",
square = TRUE,
plot = TRUE)
# Retrieve the output of all options.
out <- SCpubr::do_ColorPalette(colors.use = "steelblue",
complete_output = TRUE)
## Retrieve the colors.
colors <- out$colors
## Retrieve the plots.
plots <- out$plots
## Retrieve a combined plot with all the options.
p <- out$combined_plot
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Display CNV scores from inferCNV as Feature Plots.
Description
Display CNV scores from inferCNV as Feature Plots.
Usage
do_CopyNumberVariantPlot(
sample,
infercnv_object,
chromosome_locations,
group.by = NULL,
using_metacells = FALSE,
metacell_mapping = NULL,
legend.type = "colorbar",
legend.position = "bottom",
legend.length = 20,
legend.width = 1,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
font.size = 14,
pt.size = 1,
font.type = "sans",
axis.text.x.angle = 45,
enforce_symmetry = TRUE,
legend.title = NULL,
na.value = "grey75",
viridis.palette = "G",
viridis.direction = 1,
verbose = FALSE,
min.cutoff = NA,
max.cutoff = NA,
number.breaks = 5,
diverging.palette = "RdBu",
diverging.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = -1,
use_viridis = TRUE,
return_object = FALSE,
grid.color = "white",
border.color = "black",
flip = FALSE,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
infercnv_object |
|
chromosome_locations |
|
group.by |
|
using_metacells |
|
metacell_mapping |
|
legend.type |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
font.size |
|
pt.size |
|
font.type |
|
axis.text.x.angle |
|
enforce_symmetry |
|
legend.title |
|
na.value |
|
viridis.palette |
|
viridis.direction |
|
verbose |
|
min.cutoff , max.cutoff |
|
number.breaks |
|
diverging.palette |
|
diverging.direction |
|
sequential.palette |
|
sequential.direction |
|
use_viridis |
|
return_object |
|
grid.color |
|
border.color |
|
flip |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A list containing Feature Plots for different chromosome regions and corresponding dot plots by groups..
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_CopyNumberVariantPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# This function expects that you have run inferCNV on your
# own and you have access to the output object.
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds",
package = "SCpubr"))
# Define your inferCNV object.
infercnv_object <- readRDS(system.file("extdata/infercnv_object_example.rds",
package = "SCpubr"))
# Get human chromosome locations.
chromosome_locations = SCpubr::human_chr_locations
# Compute for a all chromosomes.
p <- SCpubr::do_CopyNumberVariantPlot(sample = sample,
infercnv_object = infercnv_object,
using_metacells = FALSE,
chromosome_locations = chromosome_locations)
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Create correlation matrix heatmaps.
Description
Create correlation matrix heatmaps.
Usage
do_CorrelationPlot(
sample = NULL,
input_gene_list = NULL,
cluster = TRUE,
remove.diagonal = TRUE,
mode = "hvg",
assay = NULL,
group.by = NULL,
legend.title = "Pearson coef.",
enforce_symmetry = ifelse(mode == "hvg", TRUE, FALSE),
font.size = 14,
font.type = "sans",
na.value = "grey75",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
legend.position = "bottom",
min.cutoff = NA,
max.cutoff = NA,
number.breaks = 5,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
diverging.palette = "RdBu",
diverging.direction = -1,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
axis.text.x.angle = 45,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
input_gene_list |
|
cluster |
|
remove.diagonal |
|
mode |
|
assay |
|
group.by |
|
legend.title |
|
enforce_symmetry |
|
font.size |
|
font.type |
|
na.value |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
legend.position |
|
min.cutoff , max.cutoff |
|
number.breaks |
|
plot.title , plot.subtitle , plot.caption |
|
diverging.palette |
|
diverging.direction |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
axis.text.x.angle |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_CorrelationPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Default values.
p <- SCpubr::do_CorrelationPlot(sample = sample)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Wrapper for DimPlot.
Description
Wrapper for DimPlot.
Usage
do_DimPlot(
sample,
reduction = NULL,
group.by = NULL,
split.by = NULL,
colors.use = NULL,
shuffle = TRUE,
order = NULL,
raster = FALSE,
pt.size = 1,
label = FALSE,
label.color = "black",
label.fill = "white",
label.size = 4,
label.box = TRUE,
repel = FALSE,
cells.highlight = NULL,
idents.highlight = NULL,
idents.keep = NULL,
sizes.highlight = 1,
ncol = NULL,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
legend.title = NULL,
legend.position = "bottom",
legend.title.position = "top",
legend.ncol = NULL,
legend.nrow = NULL,
legend.icon.size = 4,
legend.byrow = FALSE,
raster.dpi = 2048,
dims = c(1, 2),
font.size = 14,
font.type = "sans",
na.value = "grey75",
plot_cell_borders = TRUE,
border.size = 2,
border.color = "black",
border.density = 1,
plot_marginal_distributions = FALSE,
marginal.type = "density",
marginal.size = 5,
marginal.group = TRUE,
plot.axes = FALSE,
plot_density_contour = FALSE,
contour.position = "bottom",
contour.color = "grey90",
contour.lineend = "butt",
contour.linejoin = "round",
contour_expand_axes = 0.25,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
reduction |
|
group.by |
|
split.by |
|
colors.use |
|
shuffle |
|
order |
|
raster |
|
pt.size |
|
label |
|
label.color |
|
label.fill |
|
label.size |
|
label.box |
|
repel |
|
cells.highlight , idents.highlight |
|
idents.keep |
|
sizes.highlight |
|
ncol |
|
plot.title , plot.subtitle , plot.caption |
|
legend.title |
|
legend.position |
|
legend.title.position |
|
legend.ncol |
|
legend.nrow |
|
legend.icon.size |
|
legend.byrow |
|
raster.dpi |
|
dims |
|
font.size |
|
font.type |
|
na.value |
|
plot_cell_borders |
|
border.size |
|
border.color |
|
border.density |
|
plot_marginal_distributions |
|
marginal.type |
|
marginal.size |
|
marginal.group |
|
plot.axes |
|
plot_density_contour |
|
contour.position |
|
contour.color |
|
contour.lineend |
|
contour.linejoin |
|
contour_expand_axes |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a DimPlot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_DimPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic DimPlot.
p <- SCpubr::do_DimPlot(sample = sample)
# Restrict the amount of identities displayed.
p <- SCpubr::do_DimPlot(sample = sample,
idents.keep = c("1", "3", "5"))
# Group by another variable rather than `Seurat::Idents(sample)`
p <- SCpubr::do_DimPlot(sample = sample,
group.by = "seurat_clusters")
# Split the output in as many plots as unique identities.
p <- SCpubr::do_DimPlot(sample = sample,
split.by = "seurat_clusters")
# Highlight given identities
p <- SCpubr::do_DimPlot(sample,
idents.highlight = c("1", "3"))
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
This function is a wrapper for DotPlot. It provides most of its functionalities while adding extra. You can
Description
This function is a wrapper for DotPlot. It provides most of its functionalities while adding extra. You can
Usage
do_DotPlot(
sample,
features,
assay = NULL,
group.by = NULL,
scale = FALSE,
legend.title = NULL,
legend.type = "colorbar",
legend.position = "bottom",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
colors.use = NULL,
dot.scale = 6,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = NULL,
ylab = NULL,
font.size = 14,
font.type = "sans",
cluster = FALSE,
flip = FALSE,
axis.text.x.angle = 45,
scale.by = "size",
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
na.value = "grey75",
dot_border = TRUE,
plot.grid = TRUE,
grid.color = "grey75",
grid.type = "dashed",
number.breaks = 5,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
assay |
|
group.by |
|
scale |
|
legend.title |
|
legend.type |
|
legend.position |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
colors.use |
|
dot.scale |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
font.size |
|
font.type |
|
cluster |
|
flip |
|
axis.text.x.angle |
|
scale.by |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
na.value |
|
dot_border |
|
plot.grid |
|
grid.color |
|
grid.type |
|
number.breaks |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a Dot Plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_DotPlot", passive = TRUE)
if (isTRUE(value)){
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic Dot plot.
p <- SCpubr::do_DotPlot(sample = sample,
features = "EPC1")
# Querying multiple features.
genes <- rownames(sample)[1:14]
p <- SCpubr::do_DotPlot(sample = sample,
features = genes)
# Inverting the axes.
p <- SCpubr::do_DotPlot(sample = sample,
features = genes,
cluster = TRUE,
plot.title = "Clustered",
flip = TRUE)
# Modifying default colors.
# Two colors to generate a gradient.
p <- SCpubr::do_DotPlot(sample = sample,
features = genes,
colors.use = c("#001219", "#e9d8a6"))
# Querying multiple features as a named list - splitting by each item in list.
# Genes have to be unique.
genes <- list("Naive CD4+ T" = rownames(sample)[1:2],
"EPC1+ Mono" = rownames(sample)[3:4],
"Memory CD4+" = rownames(sample)[5],
"B" = rownames(sample)[6],
"CD8+ T" = rownames(sample)[7],
"FCGR3A+ Mono" = rownames(sample)[8:9],
"NK" = rownames(sample)[10:11],
"DC" = rownames(sample)[12:13],
"Platelet" = rownames(sample)[14])
p <- SCpubr::do_DotPlot(sample = sample,
features = genes)
# Clustering the identities.
p <- SCpubr::do_DotPlot(sample = sample,
features = genes,
cluster = TRUE,
plot.title = "Clustered")
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Create enrichment scores heatmaps.
Description
This function computes the enrichment scores for the cells using AddModuleScore and then aggregates the scores by the metadata variables provided by the user and displays it as a heatmap, computed by Heatmap.
Usage
do_EnrichmentHeatmap(
sample,
input_gene_list,
features.order = NULL,
groups.order = NULL,
cluster = TRUE,
scale_scores = TRUE,
assay = NULL,
slot = NULL,
reduction = NULL,
group.by = NULL,
verbose = FALSE,
na.value = "grey75",
legend.position = "bottom",
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = 1,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
enforce_symmetry = FALSE,
nbin = 24,
ctrl = 100,
flavor = "Seurat",
legend.title = NULL,
ncores = 1,
storeRanks = TRUE,
min.cutoff = NA,
max.cutoff = NA,
pt.size = 1,
plot_cell_borders = TRUE,
border.size = 2,
return_object = FALSE,
number.breaks = 5,
sequential.palette = "YlGnBu",
diverging.palette = "RdBu",
diverging.direction = -1,
sequential.direction = 1,
flip = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
input_gene_list |
|
features.order |
|
groups.order |
|
cluster |
|
scale_scores |
|
assay |
|
slot |
|
reduction |
|
group.by |
|
verbose |
|
na.value |
|
legend.position |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
enforce_symmetry |
|
nbin |
|
ctrl |
|
flavor |
|
legend.title |
|
ncores |
|
storeRanks |
|
min.cutoff , max.cutoff |
|
pt.size |
|
plot_cell_borders |
|
border.size |
|
return_object |
|
number.breaks |
|
sequential.palette |
|
diverging.palette |
|
diverging.direction |
|
sequential.direction |
|
flip |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_EnrichmentHeatmap", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Genes have to be unique.
genes <- list("A" = rownames(sample)[1:5],
"B" = rownames(sample)[6:10],
"C" = rownames(sample)[11:15])
# Default parameters.
p <- SCpubr::do_EnrichmentHeatmap(sample = sample,
input_gene_list = genes,
nbin = 1,
ctrl = 10)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Create heatmaps of averaged expression by groups.
Description
This function generates a heatmap with averaged expression values by the unique groups of the metadata variables provided by the user.
Usage
do_ExpressionHeatmap(
sample,
features,
group.by = NULL,
assay = NULL,
cluster = TRUE,
features.order = NULL,
groups.order = NULL,
slot = "data",
legend.title = "Avg. Expression",
na.value = "grey75",
legend.position = "bottom",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
enforce_symmetry = FALSE,
min.cutoff = NA,
max.cutoff = NA,
diverging.palette = "RdBu",
diverging.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
number.breaks = 5,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
flip = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
group.by |
|
assay |
|
cluster |
|
features.order |
|
groups.order |
|
slot |
|
legend.title |
|
na.value |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
enforce_symmetry |
|
min.cutoff , max.cutoff |
|
diverging.palette |
|
diverging.direction |
|
sequential.palette |
|
sequential.direction |
|
number.breaks |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
flip |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_ExpressionHeatmap", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Define list of genes.
genes <- rownames(sample)[1:10]
# Default parameters.
p <- SCpubr::do_ExpressionHeatmap(sample = sample,
features = genes,
viridis.direction = -1)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Wrapper for FeaturePlot.
Description
Wrapper for FeaturePlot.
Usage
do_FeaturePlot(
sample,
features,
assay = NULL,
reduction = NULL,
slot = NULL,
order = FALSE,
group.by = NULL,
group.by.colors.use = NULL,
group.by.legend = NULL,
group.by.show.dots = TRUE,
group.by.dot.size = 8,
group.by.cell_borders = FALSE,
group.by.cell_borders.alpha = 0.1,
split.by = NULL,
idents.keep = NULL,
cells.highlight = NULL,
idents.highlight = NULL,
dims = c(1, 2),
enforce_symmetry = FALSE,
symmetry.type = "absolute",
symmetry.center = NA,
pt.size = 1,
font.size = 14,
font.type = "sans",
legend.title = NULL,
legend.type = "colorbar",
legend.position = "bottom",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.ncol = NULL,
legend.nrow = NULL,
legend.byrow = FALSE,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
individual.titles = NULL,
individual.subtitles = NULL,
individual.captions = NULL,
ncol = NULL,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = 1,
raster = FALSE,
raster.dpi = 1024,
plot_cell_borders = TRUE,
border.size = 2,
border.color = "black",
border.density = 1,
na.value = "grey75",
verbose = TRUE,
plot.axes = FALSE,
min.cutoff = rep(NA, length(features)),
max.cutoff = rep(NA, length(features)),
plot_density_contour = FALSE,
contour.position = "bottom",
contour.color = "grey90",
contour.lineend = "butt",
contour.linejoin = "round",
contour_expand_axes = 0.25,
label = FALSE,
label.color = "black",
label.size = 4,
number.breaks = 5,
diverging.palette = "RdBu",
diverging.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
assay |
|
reduction |
|
slot |
|
order |
|
group.by |
|
group.by.colors.use |
|
group.by.legend |
|
group.by.show.dots |
|
group.by.dot.size |
|
group.by.cell_borders |
|
group.by.cell_borders.alpha |
|
split.by |
|
idents.keep |
|
cells.highlight , idents.highlight |
|
dims |
|
enforce_symmetry |
|
symmetry.type |
|
symmetry.center |
|
pt.size |
|
font.size |
|
font.type |
|
legend.title |
|
legend.type |
|
legend.position |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.ncol |
|
legend.nrow |
|
legend.byrow |
|
plot.title , plot.subtitle , plot.caption |
|
individual.titles , individual.subtitles , individual.captions |
|
ncol |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
raster |
|
raster.dpi |
|
plot_cell_borders |
|
border.size |
|
border.color |
|
border.density |
|
na.value |
|
verbose |
|
plot.axes |
|
min.cutoff , max.cutoff |
|
plot_density_contour |
|
contour.position |
|
contour.color |
|
contour.lineend |
|
contour.linejoin |
|
contour_expand_axes |
|
label |
|
label.color |
|
label.size |
|
number.breaks |
|
diverging.palette |
|
diverging.direction |
|
sequential.palette |
|
sequential.direction |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a Feature Plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_FeaturePlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Regular FeaturePlot.
p <- SCpubr::do_FeaturePlot(sample = sample,
features = "nCount_RNA")
# FeaturePlot with a subset of identities
# (in Seurat::Idents(sample)) maintaining the original UMAP shape.
idents.use <- levels(sample)[!(levels(sample) %in% c("2", "5", "8"))]
p <- SCpubr::do_FeaturePlot(sample = sample,
idents.highlight = idents.use,
features = c("EPC1"))
# Splitting the FeaturePlot by a variable and
# maintaining the color scale and the UMAP shape.
p <- SCpubr::do_FeaturePlot(sample = sample,
features = "EPC1",
split.by = "seurat_clusters")
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Compute functional annotation plots using GO or KEGG ontologies
Description
Compute functional annotation plots using GO or KEGG ontologies
Usage
do_FunctionalAnnotationPlot(
genes,
org.db,
organism = "hsa",
database = "GO",
GO_ontology = "BP",
min.overlap = NULL,
p.adjust.cutoff = 0.05,
pAdjustMethod = "BH",
minGSSize = 10,
maxGSSize = 500,
font.size = 10,
font.type = "sans",
axis.text.x.angle = 45,
xlab = NULL,
ylab = NULL,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
legend.type = "colorbar",
legend.position = "bottom",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 10,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
number.breaks = 5,
return_matrix = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
genes |
|
org.db |
|
organism |
|
database |
|
GO_ontology |
|
min.overlap |
|
p.adjust.cutoff |
|
pAdjustMethod |
|
minGSSize |
|
maxGSSize |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
xlab , ylab |
|
plot.title , plot.subtitle , plot.caption |
|
legend.type |
|
legend.position |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
number.breaks |
|
return_matrix |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A list containing a heatmap of the presence/absence of the genes in the enriched term, as well as a bar plot, dot plot and tree plot of the enriched terms.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_FunctionalAnnotationPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Need to load this library or equivalent.
suppressMessages(library("org.Hs.eg.db"))
# Define list of genes to query.
genes.use <- c("CCR7", "CD14", "LYZ",
"S100A4", "MS4A1",
"MS4A7", "GNLY", "NKG7", "FCER1A",
"CST3", "PPBP")
# Compute the grouped GO terms.
out <- SCpubr::do_FunctionalAnnotationPlot(genes = genes.use,
org.db = org.Hs.eg.db)
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Generate a Geyser plot.
Description
A Geyser plot is a custom plot in which we plot continuous values on the Y axis grouped by a categorical value in the X. This is plotted as a dot plot, jittered so that the dots span all the way to the other groups. On top of this, the mean and .66 and .95 of the data is plotted, depicting the overall distribution of the dots. The cells can, then, be colored by a continuous variable (same as Y axis or different) or a categorical one (same as X axis or different).
Usage
do_GeyserPlot(
sample,
features,
assay = NULL,
slot = "data",
group.by = NULL,
split.by = NULL,
enforce_symmetry = FALSE,
scale_type = "continuous",
order = TRUE,
plot_cell_borders = TRUE,
jitter = 0.45,
pt.size = 1,
border.size = 2,
border.color = "black",
legend.position = "bottom",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
viridis.palette = "G",
viridis.direction = 1,
colors.use = NULL,
na.value = "grey75",
legend.ncol = NULL,
legend.nrow = NULL,
legend.icon.size = 4,
legend.byrow = FALSE,
legend.title = NULL,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = "Groups",
ylab = feature,
flip = FALSE,
min.cutoff = rep(NA, length(features)),
max.cutoff = rep(NA, length(features)),
number.breaks = 5,
diverging.palette = "RdBu",
diverging.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = -1,
use_viridis = TRUE,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
assay |
|
slot |
|
group.by |
|
split.by |
|
enforce_symmetry |
|
scale_type |
|
order |
|
plot_cell_borders |
|
jitter |
|
pt.size |
|
border.size |
|
border.color |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
viridis.palette |
|
viridis.direction |
|
colors.use |
|
na.value |
|
legend.ncol |
|
legend.nrow |
|
legend.icon.size |
|
legend.byrow |
|
legend.title |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
flip |
|
min.cutoff , max.cutoff |
|
number.breaks |
|
diverging.palette |
|
diverging.direction |
|
sequential.palette |
|
sequential.direction |
|
use_viridis |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Details
Special thanks to Christina Blume for coming up with the name of the plot.
Value
Either a plot of a list of plots, depending on the number of features provided.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_GeyserPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Geyser plot with categorical color scale.
p <- SCpubr::do_GeyserPlot(sample = sample,
features = "nCount_RNA",
scale_type = "categorical")
p
# Geyser plot with continuous color scale.
p <- SCpubr::do_GeyserPlot(sample = sample,
features = "nCount_RNA",
scale_type = "continuous")
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Compute an overview of the GO terms associated with the input list of genes.
Description
Compute an overview of the GO terms associated with the input list of genes.
Usage
do_GroupedGOTermPlot(
genes,
org.db,
levels.use = NULL,
GO_ontology = "BP",
min.overlap = 3,
flip = TRUE,
colors.use = c(Present = "#1e3d59", Absent = "#bccbcd"),
legend.position = "bottom",
reverse.levels = TRUE,
axis.text.x.angle = 45,
font.size = 10,
font.type = "sans",
plot.title = paste0("GO | ", GO_ontology),
plot.subtitle = NULL,
plot.caption = NULL,
verbose = FALSE,
return_matrices = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
genes |
|
org.db |
|
levels.use |
|
GO_ontology |
|
min.overlap |
|
flip |
|
colors.use |
|
legend.position |
|
reverse.levels |
|
axis.text.x.angle |
|
font.size |
|
font.type |
|
plot.title , plot.subtitle , plot.caption |
|
verbose |
|
return_matrices |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A list containing all the matrices for the respective GO levels and all the individual and combined heatmaps.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_GroupedGOTermPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Need to load this library or equivalent.
suppressMessages(library("org.Hs.eg.db"))
# Define list of genes to query.
genes.use <- c("CCR7", "CD14", "LYZ",
"S100A4", "MS4A1",
"MS4A7", "GNLY", "NKG7", "FCER1A",
"CST3", "PPBP")
# Compute the grouped GO terms.
out <- SCpubr::do_GroupedGOTermPlot(genes = genes.use,
org.db = org.Hs.eg.db)
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Compute a heatmap with the results of a group-wise DE analysis.
Description
Compute a heatmap with the results of a group-wise DE analysis.
Usage
do_GroupwiseDEPlot(
sample,
de_genes,
group.by = NULL,
number.breaks = 5,
top_genes = 5,
use_viridis = FALSE,
viridis.direction = -1,
viridis.palette.pvalue = "C",
viridis.palette.logfc = "E",
viridis.palette.expression = "G",
sequential.direction = 1,
sequential.palette.pvalue = "YlGn",
sequential.palette.logfc = "YlOrRd",
sequential.palette.expression = "YlGnBu",
assay = NULL,
slot = "data",
legend.position = "bottom",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
min.cutoff = NA,
max.cutoff = NA,
na.value = "grey75",
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
de_genes |
|
group.by |
|
number.breaks |
|
top_genes |
|
use_viridis |
|
viridis.direction |
|
viridis.palette.pvalue , viridis.palette.logfc , viridis.palette.expression |
|
sequential.direction |
|
sequential.palette.pvalue , sequential.palette.expression , sequential.palette.logfc |
|
assay |
|
slot |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
min.cutoff , max.cutoff |
|
na.value |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A heatmap composed of 3 main panels: -log10(adjusted p-value), log2(FC) and mean expression by cluster.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_GroupwiseDEPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Compute DE genes and transform to a tibble.
de_genes <- readRDS(system.file("extdata/de_genes_example.rds", package = "SCpubr"))
# Default output.
p <- SCpubr::do_GroupwiseDEPlot(sample = sample,
de_genes = de_genes)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Wrapper for Nebulosa::plot_density in Seurat.
Description
Wrapper for Nebulosa::plot_density in Seurat.
Usage
do_NebulosaPlot(
sample,
features,
slot = NULL,
dims = c(1, 2),
pt.size = 1,
reduction = NULL,
combine = TRUE,
method = c("ks", "wkde"),
joint = FALSE,
return_only_joint = FALSE,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
legend.type = "colorbar",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
font.size = 14,
font.type = "sans",
legend.position = "bottom",
plot_cell_borders = TRUE,
border.size = 2,
border.color = "black",
viridis.palette = "G",
viridis.direction = 1,
verbose = TRUE,
na.value = "grey75",
plot.axes = FALSE,
number.breaks = 5,
use_viridis = FALSE,
sequential.palette = "YlGnBu",
sequential.direction = 1,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
slot |
|
dims |
|
pt.size |
|
reduction |
|
combine |
|
method |
Kernel density estimation method:
|
joint |
|
return_only_joint |
|
plot.title , plot.subtitle , plot.caption |
|
legend.type |
|
legend.framewidth , legend.tickwidth |
|
legend.length , legend.width |
|
legend.framecolor |
|
legend.tickcolor |
|
font.size |
|
font.type |
|
legend.position |
|
plot_cell_borders |
|
border.size |
|
border.color |
|
viridis.palette |
|
viridis.direction |
|
verbose |
|
na.value |
|
plot.axes |
|
number.breaks |
|
use_viridis |
|
sequential.palette |
|
sequential.direction |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a Nebulosa plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_NebulosaPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic Nebulosa plot.
p <- SCpubr::do_NebulosaPlot(sample = sample,
features = "EPC1")
# Compute joint density.
p <- SCpubr::do_NebulosaPlot(sample = sample,
features = c("EPC1", "TOX2"),
joint = TRUE)
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Plot Pathway Activities from decoupleR using Progeny prior knowledge.
Description
Plot Pathway Activities from decoupleR using Progeny prior knowledge.
Usage
do_PathwayActivityPlot(
sample,
activities,
group.by = NULL,
split.by = NULL,
slot = "scale.data",
statistic = "norm_wmean",
pt.size = 1,
border.size = 2,
na.value = "grey75",
legend.position = "bottom",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
enforce_symmetry = TRUE,
min.cutoff = NA,
max.cutoff = NA,
number.breaks = 5,
diverging.palette = "RdBu",
diverging.direction = -1,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
flip = FALSE,
return_object = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
activities |
|
group.by |
|
split.by |
|
slot |
|
statistic |
|
pt.size |
|
border.size |
|
na.value |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
enforce_symmetry |
|
min.cutoff , max.cutoff |
|
number.breaks |
|
diverging.palette |
|
diverging.direction |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
flip |
|
return_object |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_PathwayActivityPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds",
package = "SCpubr"))
# Define your activities object.
progeny_activities <- readRDS(system.file("extdata/progeny_activities_example.rds",
package = "SCpubr"))
# General heatmap.
out <- SCpubr::do_PathwayActivityPlot(sample = sample,
activities = progeny_activities)
p <- out$heatmaps$average_scores
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Create ridge plots.
Description
This function computes ridge plots based on the ggridges package.
Usage
do_RidgePlot(
sample,
feature,
group.by = NULL,
split.by = NULL,
assay = "SCT",
slot = "data",
continuous_scale = FALSE,
legend.title = NULL,
legend.ncol = NULL,
legend.nrow = NULL,
legend.byrow = FALSE,
legend.position = NULL,
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
colors.use = NULL,
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = NULL,
ylab = NULL,
compute_quantiles = FALSE,
compute_custom_quantiles = FALSE,
quantiles = c(0.25, 0.5, 0.75),
compute_distribution_tails = FALSE,
prob_tails = 0.025,
color_by_probabilities = FALSE,
use_viridis = TRUE,
viridis.palette = "G",
viridis.direction = 1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
plot.grid = TRUE,
grid.color = "grey75",
grid.type = "dashed",
flip = FALSE,
number.breaks = 5,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
feature |
|
group.by |
|
split.by |
|
assay |
|
slot |
|
continuous_scale |
|
legend.title |
|
legend.ncol |
|
legend.nrow |
|
legend.byrow |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
colors.use |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
compute_quantiles |
|
compute_custom_quantiles |
|
quantiles |
|
compute_distribution_tails |
|
prob_tails |
|
color_by_probabilities |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
plot.grid |
|
grid.color |
|
grid.type |
|
flip |
|
number.breaks |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_RidgePlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Compute the most basic ridge plot.
p <- SCpubr::do_RidgePlot(sample = sample,
feature = "nFeature_RNA")
p
# Use continuous color scale.
p <- SCpubr::do_RidgePlot(sample = sample,
feature = "nFeature_RNA",
continuous_scale = TRUE,
viridis.direction = 1)
p
# Draw quantiles of the distribution.
p <- SCpubr::do_RidgePlot(sample = sample,
feature = "nFeature_RNA",
continuous_scale = TRUE,
compute_quantiles = TRUE,
compute_custom_quantiles = TRUE)
p
# Draw probability tails.
p <- SCpubr::do_RidgePlot(sample = sample,
feature = "nFeature_RNA",
continuous_scale = TRUE,
compute_quantiles = TRUE,
compute_distribution_tails = TRUE)
p
# Draw probability tails.
p <- SCpubr::do_RidgePlot(sample = sample,
feature = "nFeature_RNA",
continuous_scale = TRUE,
compute_quantiles = TRUE,
color_by_probabilities = TRUE)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Plot TF Activities from decoupleR using Dorothea prior knowledge.
Description
Plot TF Activities from decoupleR using Dorothea prior knowledge.
Usage
do_TFActivityPlot(
sample,
activities,
n_tfs = 25,
slot = "scale.data",
statistic = "norm_wmean",
tfs.use = NULL,
group.by = NULL,
split.by = NULL,
na.value = "grey75",
legend.position = "bottom",
legend.width = 1,
legend.length = 20,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.type = "colorbar",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
enforce_symmetry = TRUE,
diverging.palette = "RdBu",
diverging.direction = -1,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = -1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
min.cutoff = NA,
max.cutoff = NA,
number.breaks = 5,
flip = FALSE,
return_object = FALSE,
grid.color = "white",
border.color = "black",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
activities |
|
n_tfs |
|
slot |
|
statistic |
|
tfs.use |
|
group.by |
|
split.by |
|
na.value |
|
legend.position |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.type |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
enforce_symmetry |
|
diverging.palette |
|
diverging.direction |
|
use_viridis |
|
viridis.palette |
|
viridis.direction |
|
sequential.palette |
|
sequential.direction |
|
min.cutoff , max.cutoff |
|
number.breaks |
|
flip |
|
return_object |
|
grid.color |
|
border.color |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_TFActivityPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds",
package = "SCpubr"))
# Define your activities object.
dorothea_activities <- readRDS(system.file("extdata/dorothea_activities_example.rds",
package = "SCpubr"))
# General heatmap.
out <- SCpubr::do_TFActivityPlot(sample = sample,
activities = dorothea_activities)
p <- out$heatmaps$average_scores
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Display the enriched terms for a given list of genes.
Description
Display the enriched terms for a given list of genes.
Usage
do_TermEnrichmentPlot(
enriched_terms,
nchar_wrap = 20,
nterms = 10,
font.size = 14,
font.type = "sans",
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
legend.position = "bottom",
legend.type = "colorbar",
colors.use = NULL,
text_labels_size = 4,
legend.length = 30,
legend.width = 1,
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
legend.framecolor = "grey50",
legend.tickcolor = "white",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
enriched_terms |
|
nchar_wrap |
|
nterms |
|
font.size |
|
font.type |
|
plot.title , plot.subtitle , plot.caption |
|
legend.position |
|
legend.type |
|
colors.use |
|
text_labels_size |
|
legend.length , legend.width |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object with enriched terms.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_TermEnrichmentPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your enriched terms.
enriched_terms <- readRDS(system.file("extdata/enriched_terms_example.rds", package = "SCpubr"))
enriched_terms$GO_Cellular_Component_2021 <- NULL
enriched_terms$Azimuth_Cell_Types_2021 <- NULL
# Default plot.
p <- SCpubr::do_TermEnrichmentPlot(enriched_terms = enriched_terms)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Wrapper for VlnPlot.
Description
Wrapper for VlnPlot.
Usage
do_ViolinPlot(
sample,
features,
assay = NULL,
slot = NULL,
group.by = NULL,
split.by = NULL,
colors.use = NULL,
pt.size = 0,
line_width = 0.5,
y_cut = rep(NA, length(features)),
plot_boxplot = TRUE,
boxplot_width = 0.2,
legend.position = "bottom",
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = rep(NA, length(features)),
ylab = rep(NA, length(features)),
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
plot.grid = TRUE,
grid.color = "grey75",
grid.type = "dashed",
flip = FALSE,
ncol = NULL,
share.y.lims = FALSE,
legend.title = NULL,
legend.title.position = "top",
legend.ncol = NULL,
legend.nrow = NULL,
legend.byrow = FALSE,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
features |
|
assay |
|
slot |
|
group.by |
|
split.by |
|
colors.use |
|
pt.size |
|
line_width |
|
y_cut |
|
plot_boxplot |
|
boxplot_width |
|
legend.position |
|
plot.title , plot.subtitle , plot.caption |
|
xlab , ylab |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
plot.grid |
|
grid.color |
|
grid.type |
|
flip |
|
ncol |
|
share.y.lims |
|
legend.title |
|
legend.title.position |
|
legend.ncol |
|
legend.nrow |
|
legend.byrow |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A ggplot2 object containing a Violin Plot.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_ViolinPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic violin plot.
p <- SCpubr::do_ViolinPlot(sample = sample,
feature = "nCount_RNA")
p
# Remove the box plots.
p <- SCpubr::do_ViolinPlot(sample = sample,
feature = "nCount_RNA",
plot_boxplot = FALSE)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Compute a Volcano plot out of DE genes.
Description
Compute a Volcano plot out of DE genes.
Usage
do_VolcanoPlot(
sample,
de_genes,
pval_cutoff = 0.05,
FC_cutoff = 2,
pt.size = 2,
border.size = 1.5,
border.color = "black",
font.size = 14,
font.type = "sans",
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
plot_lines = TRUE,
line_color = "grey75",
line_size = 0.5,
add_gene_tags = TRUE,
order_tags_by = "both",
n_genes = 5,
use_labels = FALSE,
colors.use = "steelblue",
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
Arguments
sample |
|
de_genes |
|
pval_cutoff |
|
FC_cutoff |
|
pt.size |
|
border.size |
|
border.color |
|
font.size |
|
font.type |
|
plot.title , plot.subtitle , plot.caption |
|
plot_lines |
|
line_color |
|
line_size |
|
add_gene_tags |
|
order_tags_by |
|
n_genes |
|
use_labels |
|
colors.use |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
Value
A volcano plot as a ggplot2 object.
Examples
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_VolcanoPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Retrieve DE genes.
de_genes <- readRDS(system.file("extdata/de_genes_example.rds", package = "SCpubr"))
# Generate a volcano plot.
p <- SCpubr::do_VolcanoPlot(sample = sample,
de_genes = de_genes)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Mock function used to document all main function.
Description
Mock function used to document all main function.
Arguments
sample |
|
font.size |
|
font.type |
|
legend.type |
|
legend.position |
|
legend.framewidth , legend.tickwidth |
|
legend.framecolor |
|
legend.tickcolor |
|
legend.length , legend.width |
|
plot.title , plot.subtitle , plot.caption |
|
assay |
|
slot |
|
reduction |
|
viridis.palette |
|
raster |
|
raster.dpi |
|
plot_cell_borders |
|
border.size |
|
border.color |
|
na.value |
|
axis.text.x.angle |
|
xlab , ylab |
|
pt.size |
|
verbose |
|
flip |
|
group.by |
|
split.by |
|
colors.use |
|
legend.title |
|
legend.icon.size |
|
legend.byrow |
|
legend.ncol |
|
legend.nrow |
|
plot_marginal_distributions |
|
marginal.type |
|
marginal.size |
|
marginal.group |
|
enforce_symmetry |
|
column_title |
|
row_title |
|
cluster_cols |
|
cluster_rows |
|
column_names_rot |
|
row_names_rot |
|
cell_size |
|
input_gene_list |
|
column_title_rot |
|
row_title_rot |
|
column_names_side |
|
row_names_side |
|
column_title_side |
|
row_title_side |
|
heatmap.legend.length , heatmap.legend.width |
|
heatmap.legend.framecolor |
|
scale_direction |
|
heatmap_gap |
|
legend_gap |
|
cells.highlight , idents.highlight |
|
ncol |
|
dims |
|
feature |
|
features |
|
use_viridis |
|
viridis.direction |
|
plot.grid |
|
grid.color |
|
grid.type |
|
plot.axes |
|
individual.titles , individual.subtitles , individual.captions |
|
legend.title.position |
|
repel |
|
plot_density_contour |
|
contour.position |
|
contour.color |
|
contour.lineend |
|
contour.linejoin |
|
contour_expand_axes |
|
label |
|
label.color |
|
label.fill |
|
label.size |
|
label.box |
|
min.overlap |
|
GO_ontology |
|
genes |
|
org.db |
|
disable_white_in_viridis |
|
number.breaks |
|
strip.spacing |
|
strip.text.color |
|
strip.text.angle |
|
diverging.palette |
|
diverging.direction |
|
subsample |
|
plot.title.face , plot.subtitle.face , plot.caption.face , axis.title.face , axis.text.face , legend.title.face , legend.text.face |
|
flavor |
|
features.order |
|
groups.order |
|
interpolate |
|
viridis.palette.pvalue , viridis.palette.logfc , viridis.palette.expression |
|
nbin |
|
ctrl |
|
min.cutoff , max.cutoff |
|
border.density |
|
sequential.palette |
|
sequential.palette.pvalue , sequential.palette.expression , sequential.palette.logfc |
|
sequential.direction |
|
return_object |
|
statistic |
|
cluster |
|
Value
Nothing. This is a mock function.
Examples
# This a mock function that stores the documentation for many other functions.
# It is not intended for user usage.
Chromosome arm locations for human genome GRCh38.
Description
A tibble containing the chromosome, arm and start and end coordinates.
Usage
data(human_chr_locations)
Format
A tibble with 48 rows and 4 columns:
- chr
Chromosome.
- arm
Chromosome arm.
- start
Start coordinates.
- end
End coordinates.
Named list.
Description
Named list.
Value
Nothing. This is a mock function.
Examples
# This is a named vector.
x <- list("first_element" = c("GENE A", "GENE B"),
"second_element" = c("GENE C", "GENE D"))
print(x)
Named vector.
Description
Named vector.
Value
Nothing. This is a mock function.
Examples
# This is a named vector.
x <- c("first_element" = 3,
"second_element" = TRUE)
print(x)
Generate a status report of SCpubr and its dependencies.
Description
This function generates a summary report of the installation status of SCpubr, which packages are still missing and which functions can or can not currently be used.
Usage
package_report(startup = FALSE, extended = FALSE)
Arguments
startup |
|
extended |
|
Value
None
Examples
# Print a package report.
SCpubr::package_report(startup = FALSE, extended = FALSE)