
FS map
FSMap.Rd
Get 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, ...) <- value
See 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)
#> ✔ 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 "C:\\Users\\Max\\AppData\\Local\\R\\win-library\\4.4\…
# 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 …ax/AppData/Local/Temp/RtmpewNZPy/file1f2c2e3d1384.pxl
pxl_file <- minimal_mpx_pxl_file()
seur_obj <- ReadMPX_Seurat(pxl_file)
#> ! Failed to remove temporary dir C:/Users/Max/AppData/Local/Temp/RtmpewNZPy/dir1f2c2c875931
#> ! Failed to remove temporary dir C:/Users/Max/AppData/Local/Temp/RtmpewNZPy/dir1f2c77271b95
#> ✔ Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
#> ! Failed to remove temporary file C:/Users/Max/AppData/Local/Temp/RtmpewNZPy/file1f2c699040f9.h5ad
# 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 "C:\\Users\\Max\\AppData\\Local\\R\\win-library\\4.4\…
library(pixelatorR)
# Create example Seurat object
pxl_file <- minimal_pna_pxl_file()
seur_obj <- ReadPNA_Seurat(pxl_file)
#> ✔ 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))