
FS map
FSMap.RdGet and set fs_map tibble for a CellGraphAssay,
CellGraphAssay5 or a Seurat object
Usage
FSMap(object, ...)
FSMap(object, ...) <- value
# S3 method for class 'MPXAssay'
FSMap(object, ...)
# S3 method for class 'MPXAssay'
FSMap(object, ...) <- value
# S3 method for class 'PNAAssay'
FSMap(object, ...)
# S3 method for class 'PNAAssay5'
FSMap(object, ...)
# S3 method for class 'PNAAssay'
FSMap(object, ...) <- value
# S3 method for class 'PNAAssay5'
FSMap(object, ...) <- value
# S3 method for class 'Seurat'
FSMap(object, ...)
# S3 method for class 'Seurat'
FSMap(object, ...) <- valueSee also
CellGraphs() for getting/setting CellGraph lists
and PolarizationScores(),ColocalizationScores() for getting/setting
spatial metrics
Examples
library(pixelatorR)
library(dplyr)
pxl_file <- minimal_pna_pxl_file()
seur_obj <- ReadPNA_Seurat(pxl_file)
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#> ℹ /tmp/Rtmp3BjCtL/duckdb
#> This is removed when the R session ends.
#> • Extensions are re-downloaded each session.
#> • Secrets are lost.
#> ℹ Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#> ℹ Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#> ℹ See ?duckdb_storage for details and alternatives.
#> ✔ Created a <Seurat> object with 5 cells and 158 targeted surface proteins
FSMap(seur_obj[["PNA"]])
#> # A tibble: 1 × 3
#> id_map sample pxl_file
#> <list> <int> <chr>
#> 1 <tibble [5 × 2]> 1 /home/ubuntu/R/library/pixelatorR/extdata/five_cells/…
# If the PXL has been moved, we can update the fs_map
# Here we copy the test PXL file to a temporary location
# to illustrate how to update the fs_map
temp_file <- fs::file_temp(ext = "pxl")
fs::file_copy(path = pxl_file, temp_file)
# Change file path in fs_map
FSMap(seur_obj[["PNA"]]) <- FSMap(seur_obj[["PNA"]]) %>%
mutate(pxl_file = temp_file)
# Now the fs_map has been updated with the correct path
FSMap(seur_obj[["PNA"]])
#> # A tibble: 1 × 3
#> id_map sample pxl_file
#> <list> <int> <fs::path>
#> 1 <tibble [5 × 2]> 1 /tmp/Rtmp3BjCtL/file22fd4fc1c972.pxl
pxl_file <- minimal_mpx_pxl_file()
seur_obj <- ReadMPX_Seurat(pxl_file)
#> ✔ Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
# Check PXL file paths in a Seurat object
FSMap(seur_obj)
#> # A tibble: 1 × 3
#> id_map sample pxl_file
#> <list> <int> <chr>
#> 1 <tibble [5 × 2]> 1 /home/ubuntu/R/library/pixelatorR/extdata/five_cells/…
library(pixelatorR)
# Create example Seurat object
pxl_file <- minimal_pna_pxl_file()
seur_obj <- ReadPNA_Seurat(pxl_file)
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#> ℹ /tmp/Rtmp3BjCtL/duckdb
#> This is removed when the R session ends.
#> • Extensions are re-downloaded each session.
#> • Secrets are lost.
#> ℹ Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#> ℹ Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#> ℹ See ?duckdb_storage for details and alternatives.
#> ✔ Created a <Seurat> object with 5 cells and 158 targeted surface proteins
# Replace FSMap in Seurat object
FSMap(seur_obj) <- FSMap(seur_obj) %>%
mutate(pxl_file = fs::path_rel(pxl_file))