Introduction

tidySpatialExperiment provides a bridge between the SpatialExperiment package and the tidyverse ecosystem. It creates an invisible layer that allows you to interact with a SpatialExperiment object as if it were a tibble; enabling the use of functions from dplyr, tidyr, ggplot2 and plotly. But, underneath, your data remains a SpatialExperiment object.

tidySpatialExperiment also provides six additional utility functions.

Resources

If you would like to learn more about tidySpatialExperiment and tidyomics, the following links are a good place to start:

The tidyomics ecosystem also includes packages for:

  • Working with genomic features:

    • plyranges, for tidy manipulation of genomic range data.
    • nullranges, for tidy generation of genomic ranges representing the null hypothesis.
    • plyinteractions, for tidy manipulation of genomic interaction data.
  • Working with transcriptomic features:

  • Working with cytometry features:

    • tidytof, for tidy manipulation of high-dimensional cytometry data.
  • And a few associated packages:

    • tidygate, for manual gating of points in space.
    • tidyheatmap, for modular heatmap contruction.

Functions and utilities

Package Functions available
SpatialExperiment All
dplyr arrange,bind_rows, bind_cols, distinct, filter, group_by, summarise, select, mutate, rename, left_join, right_join, inner_join, slice, sample_n, sample_frac, count, add_count
tidyr nest, unnest, unite, separate, extract, pivot_longer
ggplot2 ggplot
plotly plot_ly
Utility Description
as_tibble Convert cell data to a tbl_df
join_features Append feature data to cell data
aggregate_cells Aggregate cell-feature abundance into a pseudobulk SummarizedExperiment object
rectangle Select cells in a rectangular region of space
ellipse Select cells in an elliptical region of space
gate Interactively or programmatically select cells in an arbitrary region of space

Installation

You can install the stable version of tidySpatialExperiment from Bioconductor.

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("tidySpatialExperiment")

Or, you can install the development version of tidySpatialExperiment from GitHub.

if (!requireNamespace("pak", quietly = TRUE))
    install.packages("pak")

pak::pak("william-hutchison/tidySpatialExperiment")

Load data

Here, we attach tidySpatialExperiment and an example SpatialExperiment object.

# Load example SpatialExperiment object
library(tidySpatialExperiment)
example(read10xVisium)

SpatialExperiment-tibble abstraction

A SpatialExperiment object represents assay-feature values as rows and cells as columns. Additional information about the cells is stored in the reducedDims, colData and spatialCoords slots.

tidySpatialExperiment provides a SpatialExperiment-tibble abstraction, representing cells as rows and cell data as columns, in accordance with the tidy observation-variable convention. The cell data is made up of information stored in the colData and spatialCoords slots.

The default view is now of the SpatialExperiment-tibble abstraction.

spe
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 7[39m
#  [90m# [90mFeatures = 50 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                  [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 section1                [4m2[24m312
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 section1                [4m8[24m230
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 section1                [4m4[24m170
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 section1                [4m2[24m519
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 section1                [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

But, our data maintains its status as a SpatialExperiment object. Therefore, we have access to all SpatialExperiment functions.

spe |>
    colData() |>
    head()
#  DataFrame with 6 rows and 4 columns
#                     in_tissue array_row array_col   sample_id
#                     <logical> <integer> <integer> <character>
#  AAACAACGAATAGTTC-1     FALSE         0        16    section1
#  AAACAAGTATCTCCCA-1      TRUE        50       102    section1
#  AAACAATCTACTAGCA-1      TRUE         3        43    section1
#  AAACACCAATAACTGC-1      TRUE        59        19    section1
#  AAACAGAGCGACTCCT-1      TRUE        14        94    section1
#  AAACAGCTTTCAGAAG-1     FALSE        43         9    section1

spe |> 
    spatialCoords() |>
    head()
#                     pxl_col_in_fullres pxl_row_in_fullres
#  AAACAACGAATAGTTC-1               2312               1252
#  AAACAAGTATCTCCCA-1               8230               7237
#  AAACAATCTACTAGCA-1               4170               1611
#  AAACACCAATAACTGC-1               2519               8315
#  AAACAGAGCGACTCCT-1               7679               2927
#  AAACAGCTTTCAGAAG-1               1831               6400

spe |>
    imgData()
#  DataFrame with 1 row and 4 columns
#      sample_id    image_id   data scaleFactor
#    <character> <character> <list>   <numeric>
#  1    section1      lowres   ####   0.0510334

Integration with the tidyverse ecosystem

Manipulate with dplyr

Most functions from dplyr are available for use with the SpatialExperiment-tibble abstraction. For example, filter() can be used to filter cells by a variable of interest.

spe |>
   filter(array_col < 5)
#  [90m# A SpatialExperiment-tibble abstraction: 3 × 7[39m
#  [90m# [90mFeatures = 50 | Cells = 3 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                  [3m[90m<int>[39m[23m
#  [90m1[39m AAACATGGTGAGAGGA-1 FALSE            62         0 section1                [4m1[24m212
#  [90m2[39m AAACGAAGATGGAGTA-1 FALSE            58         4 section1                [4m1[24m487
#  [90m3[39m AAAGAATGACCTTAGA-1 FALSE            64         2 section1                [4m1[24m349
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

And mutate can be used to add new variables, or modify the value of an existing variable.

spe |>
    mutate(in_region = c(in_tissue & array_row < 10))
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 8[39m
#  [90m# [90mFeatures = 50 | Cells = 50 | Assays = counts[0m[39m
#    .cell     in_tissue array_row array_col sample_id in_region pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m     [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m     [3m[90m<lgl>[39m[23m                  [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACG… FALSE             0        16 section1  FALSE                   [4m2[24m312
#  [90m2[39m AAACAAGT… TRUE             50       102 section1  FALSE                   [4m8[24m230
#  [90m3[39m AAACAATC… TRUE              3        43 section1  TRUE                    [4m4[24m170
#  [90m4[39m AAACACCA… TRUE             59        19 section1  FALSE                   [4m2[24m519
#  [90m5[39m AAACAGAG… TRUE             14        94 section1  FALSE                   [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

Tidy with tidyr

Most functions from tidyr are also available. Here, nest() is used to group the data by sample_id, and unnest() is used to ungroup the data.

# Nest the SpatialExperiment object by sample_id
spe_nested <-
    spe |> 
    nest(data = -sample_id)

# View the nested SpatialExperiment object
spe_nested
#  [90m# A tibble: 1 × 2[39m
#    sample_id data           
#    [3m[90m<chr>[39m[23m     [3m[90m<list>[39m[23m         
#  [90m1[39m section1  [90m<SptlExpr[,50]>[39m

# Unnest the nested SpatialExperiment objects
spe_nested |>
    unnest(data)
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 7[39m
#  [90m# [90mFeatures = 50 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                  [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 section1                [4m2[24m312
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 section1                [4m8[24m230
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 section1                [4m4[24m170
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 section1                [4m2[24m519
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 section1                [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

Plot with ggplot2

The ggplot() function can be used to create a plot directly from a SpatialExperiment object. This example also demonstrates how tidy operations can be combined to build up more complex analysis.

spe |>
    filter(sample_id == "section1" & in_tissue) |>
    
    # Add a column with the sum of feature counts per cell
    mutate(count_sum = purrr::map_int(.cell, ~
        spe[, .x] |> 
            counts() |> 
            sum()
      )) |>
    
    # Plot with tidySpatialExperiment and ggplot2
    ggplot(aes(x = reorder(.cell, count_sum), y = count_sum)) +
    geom_point() +
    coord_flip()

Plot with plotly

The plot_ly() function can also be used to create a plot from a SpatialExperiment object.

spe |>
    filter(sample_id == "section1") |>
    plot_ly(
        x = ~ array_col, 
        y = ~ array_row, 
        color = ~ in_tissue, 
        type = "scatter"
    )

Utilities

Append feature data to cell data

The tidyomics ecosystem places an emphasis on interacting with cell data. To interact with feature data, the join_features() function can be used to append assay-feature values to cell data.

# Join feature data in wide format, preserving the SpatialExperiment object
spe |>
    join_features(features = c("ENSMUSG00000025915", "ENSMUSG00000042501"), shape = "wide") |> 
    head()
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 9[39m
#  [90m# [90mFeatures = 6 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id ENSMUSG00000025915
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                  [3m[90m<dbl>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 section1                   0
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 section1                   0
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 section1                   0
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 section1                   0
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 section1                   0
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 3 more variables: ENSMUSG00000042501 <dbl>, pxl_col_in_fullres <int>,[39m
#  [90m#   pxl_row_in_fullres <int>[39m

# Join feature data in long format, discarding the SpatialExperiment object
spe |>
    join_features(features = c("ENSMUSG00000025915", "ENSMUSG00000042501"), shape = "long") |> 
    head()
#  tidySpatialExperiment says: A data frame is returned for independent data 
#                analysis.
#  [90m# A tibble: 6 × 7[39m
#    .cell       in_tissue array_row array_col sample_id .feature .abundance_counts
#    [3m[90m<chr>[39m[23m       [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m     [3m[90m<chr>[39m[23m                [3m[90m<dbl>[39m[23m
#  [90m1[39m AAACAACGAA… FALSE             0        16 section1  ENSMUSG…                 0
#  [90m2[39m AAACAACGAA… FALSE             0        16 section1  ENSMUSG…                 0
#  [90m3[39m AAACAAGTAT… TRUE             50       102 section1  ENSMUSG…                 0
#  [90m4[39m AAACAAGTAT… TRUE             50       102 section1  ENSMUSG…                 1
#  [90m5[39m AAACAATCTA… TRUE              3        43 section1  ENSMUSG…                 0
#  [90m# ℹ 1 more row[39m

Aggregate cells

Sometimes, it is necessary to aggregate the gene-transcript abundance from a group of cells into a single value. For example, when comparing groups of cells across different samples with fixed-effect models.

The aggregate_cells() function can be used to aggregate cells by a specified variable and assay, returning a SummarizedExperiment object.

spe |>
    aggregate_cells(in_tissue, assays = "counts")
#  class: SummarizedExperiment 
#  dim: 50 2 
#  metadata(0):
#  assays(1): counts
#  rownames(50): ENSMUSG00000002459 ENSMUSG00000005886 ...
#    ENSMUSG00000104217 ENSMUSG00000104328
#  rowData names(1): feature
#  colnames(2): FALSE TRUE
#  colData names(3): in_tissue .aggregated_cells sample_id

Elliptical and rectangular region selection

The ellipse() and rectangle() functions can be used to select cells by their position in space.

spe |>
    filter(sample_id == "section1") |>
    mutate(in_ellipse = ellipse(array_col, array_row, c(20, 40), c(20, 20))) |>
    ggplot(aes(x = array_col, y = array_row, colour = in_ellipse)) +
    geom_point()

Interactive gating

For the interactive selection of cells in space, tidySpatialExperiment experiment provides gate(). This function uses tidygate, shiny and plotly to launch an interactive plot overlaying cells in position with image data. Additional parameters can be used to specify point colour, shape, size and alpha, either with a column in the SpatialExperiment object or a constant value.

spe_gated <- 
  spe |>
  gate(colour = "in_tissue", alpha = 0.8)

A record of which points appear in which gates is appended to the SpatialExperiment object in the .gated column. To select cells which appear within any gates, filter for non-NA values. To select cells which appear within a specific gate, string pattern matching can be used.

# Select cells within any gate
spe_gated |> 
  filter(!is.na(.gated))
#  [90m# A SpatialExperiment-tibble abstraction: 4 × 8[39m
#  [90m# [90mFeatures = 50 | Cells = 4 | Assays = counts[0m[39m
#    .cell        in_tissue array_row array_col sample_id .gated pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m        [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m     [3m[90m<chr>[39m[23m               [3m[90m<int>[39m[23m
#  [90m1[39m AAACGAGACGG… TRUE             35        79 section1  2                    [4m6[24m647
#  [90m2[39m AAACTGCTGGC… TRUE             45        67 section1  2                    [4m5[24m821
#  [90m3[39m AAAGGGATGTA… TRUE             24        62 section1  1,2                  [4m5[24m477
#  [90m4[39m AAAGGGCAGCT… TRUE             24        26 section1  1                    [4m3[24m000
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m
# Select cells within gate 2
spe_gated |>
  filter(stringr::str_detect(.gated, "2"))
#  [90m# A SpatialExperiment-tibble abstraction: 3 × 8[39m
#  [90m# [90mFeatures = 50 | Cells = 3 | Assays = counts[0m[39m
#    .cell        in_tissue array_row array_col sample_id .gated pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m        [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m     [3m[90m<chr>[39m[23m               [3m[90m<int>[39m[23m
#  [90m1[39m AAACGAGACGG… TRUE             35        79 section1  2                    [4m6[24m647
#  [90m2[39m AAACTGCTGGC… TRUE             45        67 section1  2                    [4m5[24m821
#  [90m3[39m AAAGGGATGTA… TRUE             24        62 section1  1,2                  [4m5[24m477
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

Details of the interactively drawn gates are saved to tidygate_env$gates. This variable is overwritten each time interactive gates are drawn, so save it right away if you would like to access it later.

# Inspect previously drawn gates
tidygate_env$gates |>
  head()
#  [90m# A tibble: 6 × 3[39m
#        x     y .gate
#    [3m[90m<dbl>[39m[23m [3m[90m<dbl>[39m[23m [3m[90m<dbl>[39m[23m
#  [90m1[39m [4m4[24m310. [4m3[24m125.     1
#  [90m2[39m [4m3[24m734. [4m3[24m161.     1
#  [90m3[39m [4m2[24m942. [4m3[24m521.     1
#  [90m4[39m [4m2[24m834. [4m3[24m665.     1
#  [90m5[39m [4m2[24m834. [4m4[24m385.     1
#  [90m# ℹ 1 more row[39m
# Save if needed
tidygate_env$gates |>
  write_rds("important_gates.rds")

If previously drawn gates are supplied to the programmatic_gates argument, cells will be gated programmatically. This feature allows the reproduction of previously drawn interactive gates.

important_gates <-
  read_rds("important_gates.rds")

spe |>
  gate(programmatic_gates = important_gates)) |>
  filter(!is.na(.gated))
#  [90m# A SpatialExperiment-tibble abstraction: 4 × 8[39m
#  [90m# [90mFeatures = 50 | Cells = 4 | Assays = counts[0m[39m
#    .cell        in_tissue array_row array_col sample_id .gated pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m        [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m     [3m[90m<chr>[39m[23m               [3m[90m<int>[39m[23m
#  [90m1[39m AAACGAGACGG… TRUE             35        79 section1  2                    [4m6[24m647
#  [90m2[39m AAACTGCTGGC… TRUE             45        67 section1  2                    [4m5[24m821
#  [90m3[39m AAAGGGATGTA… TRUE             24        62 section1  1,2                  [4m5[24m477
#  [90m4[39m AAAGGGCAGCT… TRUE             24        26 section1  1                    [4m3[24m000
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

Special column behaviour

Removing the .cell column will return a tibble. This is consistent with the behaviour in other tidyomics packages.

spe |>
    select(-.cell) |>
    head()
#  tidySpatialExperiment says: Key columns are missing. A data frame is 
#                          returned for independent data analysis.
#  [90m# A tibble: 6 × 4[39m
#    in_tissue array_row array_col sample_id
#    [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m    
#  [90m1[39m FALSE             0        16 section1 
#  [90m2[39m TRUE             50       102 section1 
#  [90m3[39m TRUE              3        43 section1 
#  [90m4[39m TRUE             59        19 section1 
#  [90m5[39m TRUE             14        94 section1 
#  [90m# ℹ 1 more row[39m

The sample_id column cannot be removed with tidyverse functions, and can only be modified if the changes are accepted by SpatialExperiment’s colData() function.

# sample_id is not removed, despite the user's request
spe |>
    select(-sample_id)
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 7[39m
#  [90m# [90mFeatures = 50 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                  [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 section1                [4m2[24m312
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 section1                [4m8[24m230
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 section1                [4m4[24m170
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 section1                [4m2[24m519
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 section1                [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

# This change maintains separation of sample_ids and is permitted
spe |> 
    mutate(sample_id = stringr::str_c(sample_id, "_modified")) |>
    head()
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 7[39m
#  [90m# [90mFeatures = 6 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id  pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                   [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 section1_…               [4m2[24m312
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 section1_…               [4m8[24m230
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 section1_…               [4m4[24m170
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 section1_…               [4m2[24m519
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 section1_…               [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

# This change does not maintain separation of sample_ids and produces an error
spe |>
    mutate(sample_id = "new_sample")
#  [90m# A SpatialExperiment-tibble abstraction: 50 × 7[39m
#  [90m# [90mFeatures = 50 | Cells = 50 | Assays = counts[0m[39m
#    .cell              in_tissue array_row array_col sample_id  pxl_col_in_fullres
#    [3m[90m<chr>[39m[23m              [3m[90m<lgl>[39m[23m         [3m[90m<int>[39m[23m     [3m[90m<int>[39m[23m [3m[90m<chr>[39m[23m                   [3m[90m<int>[39m[23m
#  [90m1[39m AAACAACGAATAGTTC-1 FALSE             0        16 new_sample               [4m2[24m312
#  [90m2[39m AAACAAGTATCTCCCA-1 TRUE             50       102 new_sample               [4m8[24m230
#  [90m3[39m AAACAATCTACTAGCA-1 TRUE              3        43 new_sample               [4m4[24m170
#  [90m4[39m AAACACCAATAACTGC-1 TRUE             59        19 new_sample               [4m2[24m519
#  [90m5[39m AAACAGAGCGACTCCT-1 TRUE             14        94 new_sample               [4m7[24m679
#  [90m# ℹ 45 more rows[39m
#  [90m# ℹ 1 more variable: pxl_row_in_fullres <int>[39m

The pxl_col_in_fullres and px_row_in_fullres columns cannot be removed or modified with tidyverse functions. This is consistent with the behaviour of dimension reduction data in other tidyomics packages.

# Attempting to remove pxl_col_in_fullres produces an error
spe |>
    select(-pxl_col_in_fullres)
#  [1m[33mError[39m in `select_helper()`:[22m
#  [33m![39m Can't select columns that don't exist.
#  [31m✖[39m Column `pxl_col_in_fullres` doesn't exist.

# Attempting to modify pxl_col_in_fullres produces an error
spe |> 
    mutate(pxl_col_in_fullres)
#  [1m[33mError[39m in `dplyr::mutate()`:[22m
#  [1m[22m[36mℹ[39m In argument: `pxl_col_in_fullres`.
#  [1mCaused by error:[22m
#  [33m![39m object 'pxl_col_in_fullres' not found

Citation

If you use tidySpatialExperiment in published research, please cite The tidyomics ecosystem: enhancing omic data analyses.

Session information

sessionInfo()
#  R version 4.4.1 (2024-06-14)
#  Platform: x86_64-pc-linux-gnu
#  Running under: Ubuntu 22.04.4 LTS
#  
#  Matrix products: default
#  BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#  LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#  
#  locale:
#   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#   [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#  
#  time zone: UTC
#  tzcode source: system (glibc)
#  
#  attached base packages:
#  [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#  [8] base     
#  
#  other attached packages:
#   [1] tidySpatialExperiment_1.1.5     ggplot2_3.5.1                  
#   [3] ttservice_0.4.1                 tidyr_1.3.1                    
#   [5] dplyr_1.1.4                     tidySingleCellExperiment_1.15.5
#   [7] SpatialExperiment_1.15.1        SingleCellExperiment_1.27.2    
#   [9] SummarizedExperiment_1.35.1     Biobase_2.65.1                 
#  [11] GenomicRanges_1.57.1            GenomeInfoDb_1.41.1            
#  [13] IRanges_2.39.2                  S4Vectors_0.43.2               
#  [15] BiocGenerics_0.51.1             MatrixGenerics_1.17.0          
#  [17] matrixStats_1.4.1               rmarkdown_2.28                 
#  
#  loaded via a namespace (and not attached):
#   [1] gridExtra_2.3             rlang_1.1.4              
#   [3] magrittr_2.0.3            compiler_4.4.1           
#   [5] DelayedMatrixStats_1.27.3 vctrs_0.6.5              
#   [7] stringr_1.5.1             pkgconfig_2.0.3          
#   [9] crayon_1.5.3              fastmap_1.2.0            
#  [11] magick_2.8.5              XVector_0.45.0           
#  [13] ellipsis_0.3.2            labeling_0.4.3           
#  [15] scuttle_1.15.4            utf8_1.2.4               
#  [17] promises_1.3.0            UCSC.utils_1.1.0         
#  [19] purrr_1.0.2               xfun_0.47                
#  [21] zlibbioc_1.51.1           beachmat_2.21.6          
#  [23] jsonlite_1.8.9            highr_0.11               
#  [25] later_1.3.2               rhdf5filters_1.17.0      
#  [27] DelayedArray_0.31.11      Rhdf5lib_1.27.0          
#  [29] BiocParallel_1.39.0       parallel_4.4.1           
#  [31] R6_2.5.1                  stringi_1.8.4            
#  [33] RColorBrewer_1.1-3        limma_3.61.10            
#  [35] Rcpp_1.0.13               knitr_1.48               
#  [37] R.utils_2.12.3            httpuv_1.6.15            
#  [39] Matrix_1.7-0              tidyselect_1.2.1         
#  [41] abind_1.4-8               yaml_2.3.10              
#  [43] viridis_0.6.5             codetools_0.2-20         
#  [45] lattice_0.22-6            tibble_3.2.1             
#  [47] shiny_1.9.1               withr_3.0.1              
#  [49] evaluate_1.0.0            pillar_1.9.0             
#  [51] plotly_4.10.4             generics_0.1.3           
#  [53] sparseMatrixStats_1.17.2  munsell_0.5.1            
#  [55] scales_1.3.0              xtable_1.8-4             
#  [57] glue_1.7.0                lazyeval_0.2.2           
#  [59] tools_4.4.1               data.table_1.16.0        
#  [61] locfit_1.5-9.10           rhdf5_2.49.0             
#  [63] grid_4.4.1                DropletUtils_1.25.2      
#  [65] edgeR_4.3.16              colorspace_2.1-1         
#  [67] GenomeInfoDbData_1.2.12   HDF5Array_1.33.6         
#  [69] cli_3.6.3                 tidygate_1.0.14          
#  [71] fansi_1.0.6               S4Arrays_1.5.8           
#  [73] viridisLite_0.4.2         gtable_0.3.5             
#  [75] R.methodsS3_1.8.2         digest_0.6.37            
#  [77] SparseArray_1.5.38        dqrng_0.4.1              
#  [79] farver_2.1.2              rjson_0.2.23             
#  [81] htmlwidgets_1.6.4         htmltools_0.5.8.1        
#  [83] R.oo_1.26.0               lifecycle_1.0.4          
#  [85] httr_1.4.7                statmod_1.5.0            
#  [87] mime_0.12