Function to plot gene expression
plot_gene.Rd
Generate Hex Plot of a SpatialExperiment containing deconvolution results
Usage
plot_gene(
spe,
gene = NULL,
assay = "counts",
palette = "Mako",
transform_scale = NULL,
sample_id = "sample01",
image_id = "lowres",
reverse_palette = FALSE,
show_image = FALSE,
background = NULL,
zoom = TRUE,
palette_type = NULL,
offset_rotation = FALSE,
spot_size = 1,
limits = NULL,
smooth = FALSE,
smoothing_factor = 1.5,
show_legend = TRUE,
title_size = 30,
title = NULL,
font_size = 15,
legend_size = 20,
density = TRUE,
save = FALSE,
path = NULL,
png_width = 1500,
png_height = 750,
...
)
Arguments
- spe
deconvolution result in Form of a SpatialExperiment
- gene
gene to plot
- assay
assay to extract gene expression, default = "counts"
- palette
colorspace palette (sequential)
- transform_scale
data transform_scaleation to use, "log"
- sample_id
sample id to plot, default: "sample01"
- image_id
which image to plot, default: "lowres"
- reverse_palette
reverse color palette
- show_image
logical, whether to display the image, default = TRUE
- background
custom background color
- zoom
zoom to the available spots
- palette_type
discrete, sequential or diverging
- offset_rotation
correct hex orientation for rotated visium image
- spot_size
increase (>1) or decrease (<1) the hex size
- limits
vector of color scale limits
- smooth
whether to smooth the plot
- smoothing_factor
kernel size factor (multiples of spot distance)
- show_legend
whether to show the legend
- title_size
font size of title
- title
set a custom title
- font_size
font size of legend
- legend_size
legend size in points
- density
whether to display a density distribution next to the spatial plot
- save
set TRUE to save plot
- path
specify directory to save plot, if NULL: saving at ~/spacedeconv
- png_width
when saving, png width in px
- png_height
when saving, png height in px
- ...
additional paramters passed to internal functions
Examples
data("spatial_data_2")
deconv <- spacedeconv::deconvolute(spatial_data_2, method = "estimate")
#> ── spacedeconv ─────────────────────────────────────────────────────────────────
#> ℹ testing parameter
#> ✔ parameter OK [16ms]
#>
#>
#>
#> ── Spatial
#> Assays: "counts"
#> Genes: 36591
#> → without expression: 13411 (36.65%)
#> Spots: 1310
#> Spots under tissue: 1310 (100%)
#> Median Genes Per Spot: 4613.5
#> → without expression: 15 (1.15%)
#> Umi count range: 0 - 64683
#> Spots with UMI count below 500: 85 (0.23%)
#> ✔ Rownames set
#> ✔ Colnames set
#> ℹ deconvoluting
#> Error in loadNamespace(x): there is no package called ‘immunedeconv’
#> ✖ deconvoluting [249ms]
#>
spacedeconv::plot_celltype(deconv, cell_type = "estimate_immune.score")
#> Error in eval(expr, envir, enclos): object 'deconv' not found