Create correlation matrix heatmaps.
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"
)
A ggplot2 object.
Seurat
| A Seurat object, generated by CreateSeuratObject.
named_list
| Named list of lists of genes to be used as input.
logical
| Whether to cluster the elements in the heatmap or not.
logical
| Whether to convert diagnoal to NA. Normally this value would be 1, heavily shifting the color scale.
character
| Different types of correlation matrices can be computed. Right now, the only possible value is "hvg", standing for Highly Variable Genes. The sample is subset for the HVG and the data is re-scaled. Scale data is used for the correlation.
character
| Assay to use. Defaults to the current assay.
character
| Metadata variable to group the output by. Has to be a character of factor column.
character
| Title for the legend.
logical
| Return a symmetrical plot axes-wise or continuous color scale-wise, when applicable.
numeric
| Overall font size of the plot. All plot elements will have a size relationship with this font size.
character
| Base font family for the plot. One of:
mono
: Mono spaced font.
serif
: Serif font family.
sans
: Default font family.
character
| Color value for NA.
numeric
| Length and width of the legend. Will adjust automatically depending on legend side.
numeric
| Width of the lines of the box in the legend.
character
| Color of the lines of the box in the legend.
character
| Color of the ticks of the box in the legend.
character
| Type of legend to display. One of:
normal
: Default legend displayed by ggplot2.
colorbar
: Redefined colorbar legend, using guide_colorbar.
character
| Position of the legend in the plot. One of:
top
: Top of the figure.
bottom
: Bottom of the figure.
left
: Left of the figure.
right
: Right of the figure.
none
: No legend is displayed.
numeric
| Set the min/max ends of the color scale. Any cell/group with a value lower than min.cutoff will turn into min.cutoff and any cell with a value higher than max.cutoff will turn into max.cutoff. In FeaturePlots, provide as many values as features. Use NAs to skip a feature.
numeric
| Controls the number of breaks in continuous color scales of ggplot2-based plots.
character
| Title, subtitle or caption to use in the plot.
character
| Type of symmetrical color palette to use. Out of the diverging palettes defined in brewer.pal
.
numeric
| Either 1 or -1. Direction of the divering palette. This basically flips the two ends.
logical
| Whether to use viridis color scales.
character
| A capital letter from A to H or the scale name as in scale_fill_viridis.
numeric
| Either 1 or -1. Controls how the gradient of viridis scale is formed.
character
| Type of sequential color palette to use. Out of the sequential palettes defined in brewer.pal
.
numeric
| Direction of the sequential color scale. Either 1 or -1.
numeric
| Degree to rotate the X labels. One of: 0, 45, 90.
character
| Color of the grid in the plot. In heatmaps, color of the border of the cells.
character
| Color for the border of the heatmap body.
character
| Controls the style of the font for the corresponding theme element. One of:
plain
: For normal text.
italic
: For text in itallic.
bold
: For text in bold.
bold.italic
: For text both in itallic and bold.
# \donttest{
# 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()`.")
}
# }
Run the code above in your browser using DataLab