View source: R/vis_grid_gene.R
vis_grid_gene | R Documentation |
This function visualizes the gene expression stored in assays(spe)
or any
continuous variable stored in colData(spe)
for a set of samples at the
spot-level using (by default) the histology information on the background.
To visualize clusters (or any discrete variable) use vis_grid_clus()
.
vis_grid_gene(
spe,
geneid = rowData(spe)$gene_search[1],
pdf_file,
assayname = "logcounts",
minCount = 0,
return_plots = FALSE,
spatial = TRUE,
viridis = TRUE,
height = 24,
width = 36,
image_id = "lowres",
alpha = NA,
cont_colors = if (viridis) viridisLite::viridis(21) else c("aquamarine4",
"springgreen", "goldenrod", "red"),
sample_order = unique(spe$sample_id),
point_size = 2,
auto_crop = TRUE,
na_color = "#CCCCCC40",
is_stitched = FALSE,
...
)
spe |
A
SpatialExperiment-class
object. See |
geneid |
A |
pdf_file |
A |
assayname |
The name of the |
minCount |
A |
return_plots |
A |
spatial |
A |
viridis |
A |
height |
A |
width |
A |
image_id |
A |
alpha |
A |
cont_colors |
A |
sample_order |
A |
point_size |
A |
auto_crop |
A |
na_color |
A |
is_stitched |
A |
... |
Passed to paste0() for making the title of the
plot following the |
This function prepares the data and then loops through
vis_gene()
for computing the list of ggplot2
objects.
A list of ggplot2 objects.
Other Spatial gene visualization functions:
vis_gene()
,
vis_gene_p()
if (enough_ram()) {
## Obtain the necessary data
if (!exists("spe")) spe <- fetch_data("spe")
## Subset to two samples of interest and obtain the plot list
p_list <-
vis_grid_gene(
spe[, spe$sample_id %in% c("151673", "151674")],
spatial = FALSE,
return_plots = TRUE
)
## Visualize the spatial adjacent replicates for position = 0 micro meters
## for subject 3
cowplot::plot_grid(plotlist = p_list, ncol = 2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.