Skip to contents

SpatialMap

SpatialMap-package
SpatialMap: Spatial biology API and exploratory analysis
createRegionObject()
User interface for the creation and validation of a new Region class object
createSpatialMap()
Create a SpatialMap object manually

Load example data

Functions that easily load example SpatialMap objects

Getters

Accessor functions to retrieve data from SpatialMap objects and Regions

projectMetadata() featureInfo() features() cells() getID() channelInfo() bgData() bgFeatures()
Methods to extract slots from SpatialMap, Region, and Analysis objects
Analyses()
List the Analysis object names in a SpatialMap
Data()
Extract data from a SpatialMap or Region objects
Regions()
List the Region object names present in a SpatialMap
Representations()
Representation
getActiveAnalysis()
Extract activeAnalysis from a SpatialMap object
getActiveRegions()
getActiveRegions
getAnalysis()
Get Analysis object from SpatialMap
getCellInteractions()
Title Export data.frame of all interactions from SpatialMap object Includes cell type notation. Output is a data.frame with rows as interactions and columns as metadata Works with FRNN, in addition to other SpatialMap NN formats.
getRegion()
Get Region object from SpatialMap
getRegionData()
Get data slot from Region object
getRegions()
Get Region objects (plural) from SpatialMap
getSMData()
Get SM Data
get_cells_in_window()
Get cells in XY window
get_channel()
Get the imaging channel number from a feature in CODEX data
get_channel.Region()
Get channel from Region
get_cycle()
Get the imaging cycle number from a feature in CODEX data
get_cycle.Region()
get_channel
get_image()
Get (greyscale) images for a Region
get_valid_metadata_counts()
Get SpatialMap metadata frequency table
get_zoom_levels()
Get zoom levels for a Region
`settings<-`() settings()
Display or set SpatialMap settings
activeAnalysis() `activeAnalysis<-`()
activeAnalysis
activeRegions()
activeRegions

Setters

Functions to safely update data in objects

`projectMetadata<-`() `featureInfo<-`() `features<-`() `cells<-`() `channelInfo<-`() `bgData<-`() `bgFeatures<-`()
Methods to set data slots for SpatialMap, Region, or Analysis objects
`settings<-`() settings()
Display or set SpatialMap settings
`Representations<-`()
Set Representations

Plotting

Plotting and visualization functions

plotCellProportions()
Plot Cell Proportions
plotChordDiagram()
plotChordDiagram Plot chord diagrams based on pairwise adjacency results.
plotCohortChordDiagram()
Grouped chord diagrams
plotCohortsVolcano()
compareCohorts volcano plot
plotExpressionHeatmap()
Plot Expression Heatmap
plotFilterSummary()
Plot CODEX filtering summaries
plotFilteredCells() plotFilteredCells.SpatialMap() plotFilteredCells.Region()
Plot Filtered Cells in Spatial Context, or by Other Representations
plotImage()
Plot Image from SpatialMap Objects
plotImage.Region()
Plot raw image annotation layer
plotImage.acquisition_id()
Plot raw image annotation layer without passing a SpatialMap region
plotModelComponents.Region()
Plot the results of the two-component mixture model
plotNeighborhoodCellCounts()
Plot Feature Counts by Neighborhood
plotPairwiseAdjacency()
Plot pairwise adjacency scores
plotPairwiseAdjacency.Region()
plotPairwiseAdjacency.Region
plotQCSummary()
plotQCSummary
plotRepresentation()
Plot Representations of Spatial Biology Data
plotViolins()
Violin Expression Plots
plotViolins.Region()
Plot Expression Violin Plots, Region
plot_chord_diagram()
plot_chord_diagram Helper function to plot a circlize circos chord diagram
neighborhoodHeatmap()
Create heatmap of cell neighborhoods

Graphs

Functions to work with graph (NN) objects

computeNearestNeighbors()
Compute Nearest Neighbor Graphs
computeNearestNeighbors.Region()
computeNearestNeighbors.Region
spatialNearestNeighbors()
Spatial cellular network graph
spatialNearestNeighbors.Region()
spatialNearestNeighbors.Region
listNNs() nn.igraph() nn.name() nn.idx() nn.dist() nn.method() nn.misc()
Methods to extract data slots from NN objects
NN-class NN
The NN class
`NN<-`()
Set a single NN
NN_to_igraph()
NN to igraph
NNs()
Retrieve graphs from an object.
`NNs<-`()
Set NNs
createFixedRadiusNNGraph.Region()
Create Fixed-Radius Nearest Neighbor (frNN) Graph
createKNNGraph.Region()
Create K Nearest Neighbor (KNN) Graph
createNN()
Create Nearest Neighbor Object
createSharedNNGraph.Region()
Create shared nearest neighbors graph
show(<NN>)
Show information about NN objects
updateNNData()
Update NN Object Data
nn.GetAdjacencyMatrix()
Get an adjacency matrix from an NN object
nn.IsSymmetric()
Test if a graph is symmetric
nn.ListToMatrix()
Convert NN adjacency matrices to lists
nn.MatrixToAdjacencyList()
Convert NN adjacency matrices to lists
nn.applyDistanceCutoff()
Apply distance cutoff to NN object
nn_matrices_to_igraph()
NN matrices to igraph
createDelaunayTriangulation.Region()
Create a Delaunay triangulation
dropSelfInteractions() addSelfInteractions()
Add or Drop self-interactions from an NN object
checkSelfInteractions()
Check if self-interactions are present in the NN graph object
count_pairwise_interactions()
Count pairwise interactions
getCellInteractions()
Title Export data.frame of all interactions from SpatialMap object Includes cell type notation. Output is a data.frame with rows as interactions and columns as metadata Works with FRNN, in addition to other SpatialMap NN formats.

Common classes

SpatialMap classes that exist in this package

Analysis-class Analysis
The Analysis class
NN-class NN
The NN class
Region-class Region
The Region Class
Representation-class Representation
The Representation class
SpatialMap-class SpatialMap
The SpatialMap Class

Creators

Functions that help create from scratch or import external data

createAnalysis()
Create SpatialMap Analysis
createDelaunayTriangulation.Region()
Create a Delaunay triangulation
createFixedRadiusNNGraph.Region()
Create Fixed-Radius Nearest Neighbor (frNN) Graph
createKNNGraph.Region()
Create K Nearest Neighbor (KNN) Graph
createNN()
Create Nearest Neighbor Object
createRegionObject()
User interface for the creation and validation of a new Region class object
createRepresentation()
Create Representation
createSharedNNGraph.Region()
Create shared nearest neighbors graph
createSpatialMap()
Create a SpatialMap object manually
createSpatialMapSettings() showsettings()
SpatialMap Settings

Everything else

FilterCodex()
Filter CODEX cell data
Normalize()
Normalize Spatial Proteomics Data
QCMetrics()
QC Metrics
Repair()
Repair older SpatialMap objects
`Representations<-`()
Set Representations
SummarizeFilters()
SummarizeFilters
Trim()
Trim values
activeAnalysis() `activeAnalysis<-`()
activeAnalysis
activeRegions(<SpatialMap>)
activeRegions method
`activeRegions<-`(<SpatialMap>)
activeRegions-set method
`activeRegions<-`()
activeRegions-set
activeRegions()
activeRegions
addCellMetadata()
Add Cell Metadata
addFeatureInfo()
Add Feature Info
addProjectMetadata()
Add Project metadata
addRegionNames()
Add names to Regions in SpatialMap
addRepresentation()
Add a Representation to a SpatialMap or Region object
add_igraph()
Add igraph to NN
arcsinh_transform_region()
Arcsinh transform biomarker expressions with custom scale factors
autothreshold()
Auto-threshold Channel Intensity
avg_sil()
Average silhouette score
black_bg()
Add a black background to a ggplot annotation based image
calculateMutualInformation()
Compute mutual information
`$`(<Region>)
$.Region
`$`(<SpatialMap>)
Index into SpatialMap
cellMetadata() `cellMetadata<-`()
cellMetadata
cellNeighborhoods()
Compute cell neighborhoods
clusterCells()
Cluster cells
cluster_leiden.region()
Leiden clustering of Region data
cluster_louvain.region()
Louvain clustering of Region data
combineMaps()
Combine SpatialMap objects
compareAdjacency()
Compare the pairwise adjacency fingerprints of two cohorts of samples
compareCohorts()
Compare Cohorts
cubic_root_region()
Cube root transform biomarker expressions
custom_scale_region()
Normalize data with custom scale factors
defaultCategoricalColors()
Return a default set of categorical colors
defaultContinuousColors()
defaultContinuousColors
defaultTheme()
defaultTheme
default_color_scale()
Default color scale
differentialExpression()
Compute Differential Expression Across Groups
differential_wilcox()
Compute Wilcox test for expression differences between groups of cells
differential_wilcox.Region()
Compute Wilcox test for expression differences between groups of cells
dim(<Region>) dim(<Analysis>)
Extract the dimensions (cells by features) of a Region object
.aggregated_interaction_counts()
.aggregated_interaction_counts
.create_filename_mapping()
Helper function to create a named character vector of IDs to file names.
.smapply()
SpatialMap apply over Regions
.smc()
Low-level merging of Regions
.smgroup()
SpatialMap Group Samples
.validCellMetadata()
Check if cellMetadata are valid
.validSpatialMap()
Check validity of SpatialMap object
dynamic.threshold()
Dynamically threshold
embeddings()
Retrieve embeddings
exportAnnotations()
Export annotations
exportCellData()
Export combined cell data
exportCoords()
Export coordinates
exportData()
Export expression data
exportMetadata()
Export projectMetadata
exportPathDefault()
Show the default export path for export* functions
flatness()
Compute "flatness," which is the median expression value divided by the IQR.
flexible_coordinate_subset()
Flexible subsetting of a matrix by coordinates
function_scale_region()
Scaling using a custom function
infiltrationScore() infiltrationScore.Region()
Infiltration Score Between Two Phenotypes
initializeFuture()
Initialize future processing
initializePython()
Initialize Python environment
listActiveAnalysis()
listActiveAnalysis
listActiveRegions()
listActiveRegions
localEntropy.Region() localEntropy()
Local Entropy over Network Graph
log10_x()
Nice looking log10-scaled axes using ggplot2
log10_y()
Nice looking log10-scaled axes using ggplot2
log_normalize_region()
Log transform biomarker expressions
makeAnalysisFromRegion()
Update Analysis from Region
makeSpatialMapFromFCS()
Make SpatialMap from FCS files
markers_on_channel()
Get all the markers for a specified channel
mergeProjectMetadata()
Merge Project and Cell metadata
metadata_or_db()
Retrieve data from metadata or the DB
minmax_scale_region()
Min Max Scaling
model_norm_region()
Modeling noise with Gaussian Mixture Models (GMM)
names(<Region>)
Get Region cellMetadata names
names(<SpatialMap>)
names-SpatialMap
`names<-`(<SpatialMap>,<character>)
names-SpatialMap-character-set
neighborhoodClusters()
Cluster neighborhoods
neighborhood_kmeans_helper()
Optimize K-Means with silhouette score
null_if_na()
Helper function to sub NULL if the value contains NA
numMarkersExpressed()
Number of markers expressed
num_markers_expressed_region()
Number of markers expressed - Region
pairwiseAdjacency()
Pairwise Adjacency
pull_pairwise_adjacency_results()
Helper function used in plotPairwiseAdjacency.Region and plotChordDiagram.Region Pulls pairwise adjacency results for the Region, resolving aggregate flag, then pivots data to wide (matrix) format, where feature 1 is represented by rownames and feature 2 is represented by column names, and the values are as specified by values_from
qc_metrics()
qc_metrics
rawsettings()
Raw settings
removeCellMetadata()
Remove cell metadata
robust_scale_region()
Outlier-robust data scaling
runPCA()
Run PCA
runPCA.Region()
Run PCA
runUMAP()
Run UMAP
runUMAP.Region()
Run UMAP on Region-type objects
sameSM()
Test if two SpatialMap objects are identical
setRegionID()
Set Region ID
`settings<-`() settings()
Display or set SpatialMap settings
show(<Analysis>)
Show Analysis object
show(<Region>)
Show Region object
show(<Representation>)
Show Representation object
show(<SpatialMap>)
Show SpatialMap object
show-SpatialMap-methods
Show methods
smSubset() .smsubset()
Subset SpatialMap
smVersion()
Check loaded SpatialMap version
spatialQC()
Heuristic Spatial Quality Control
spatialmap_from_db()
spatialmap_from_db
spatialmap_from_emobject()
Convert emObject to SpatialMap
`[[`(<Region>,<ANY>,<missing>)
[[.Region
`[[`(<SpatialMap>,<ANY>,<missing>)
[[.SpatialMap
subRegion()
Subset a Region object by coordinates
`[`(<Region>,<ANY>,<missing>,<ANY>) `[`(<Region>,<ANY>,<ANY>,<ANY>) `[`(<Region>,<missing>,<missing>,<ANY>)
Subset a Region object
`[`(<SpatialMap>,<ANY>,<missing>,<missing>)
Subset a SpatialMap object
total_norm_region()
Total signal normalization
updateProjectMetadata()
Update projectMetadata
updateRegionData()
Update Region Data
uploadCellMetadata()
Upload SpatialMap metadata to the Enable Portal
uploadQC()
Upload QC results to Portal
version()
Check SpatialMap version
which_analysis()
Determine how .smapply dispatches functions
which_returns()
Parse output from .smapply iterator
z_scale_region()
z_scale_region
Scroll to top