SpatialFeatureExperiment-subset: Subsetting SpatialFeatureExperiment objects

SpatialFeatureExperiment-subsetR Documentation

Subsetting SpatialFeatureExperiment objects

Description

The method for SFE reconstructs the spatial graphs when the SFE object is subsetted as the listw objects encodes the nodes with indices which are no longer valid after subsetting as some nodes are no longer present.

Usage

## S4 method for signature 'SpatialFeatureExperiment,ANY,ANY,ANY'
x[i, j, ..., drop = FALSE]

Arguments

x

A SpatialFeatureExperiment object.

i

Row indices for subsetting.

j

column indices for subsetting.

...

Passed to the SingleCellExperiment method of [.

drop

Logical. If FALSE, then a warning will be issued that the node indices in the graphs are no longer valid so the row and col graphs affected by subsetting are dropped. At present, this only works with the wrapper functions in this package that take in SFE objects and records the info required to reconstruct the graphs. While this argument is ignored for SummarizedExperiment

Value

A subsetted SpatialFeatureExperiment object.

Examples

# Just like subsetting matrices and SingleCellExperiment
library(SFEData)
sfe <- McKellarMuscleData(dataset = "small")
sfe_subset <- sfe[seq_len(10), seq_len(10), drop = TRUE]
# Gives warning as graph reconstruction fails

sfe_subset <- sfe[seq_len(10), seq_len(10)]


pachterlab/SpatialFeatureExperiment documentation built on March 11, 2024, 11:11 p.m.