Learn R Programming

RGraphSpace (version 1.5.2)

as.GraphSpace: Convert objects to GraphSpace

Description

S3 generic function for coercing objects into a GraphSpace object.

Usage

as.GraphSpace(x, ...)

# S3 method for default as.GraphSpace(x, ...)

# S3 method for igraph as.GraphSpace(x, ...)

# S3 method for tbl_graph as.GraphSpace(x, ...)

# S3 method for data.frame as.GraphSpace(x, ...)

# S3 method for DFrame as.GraphSpace(x, ...)

# S3 method for matrix as.GraphSpace(x, ...)

# S3 method for SpatialExperiment as.GraphSpace(x, assay = "counts", ...)

# S3 method for Seurat as.GraphSpace(x, layer = NULL, space = c("embedding", "spatial"), ...)

Value

A GraphSpace object.

Arguments

x

An object to be converted.

...

Additional arguments passed to coercion methods.

assay

Name of the assay in the SpatialExperiment object from which data should be retrieved (see assay).

layer

Name of the layer in the Seurat object from which node data should be retrieved (see LayerData).

space

Character specifying the coordinate space used for node geometry. Either "embedding" or "spatial". See details.

Details

Unified entry point for converting graph, spatial, and high-dimensional data into a GraphSpace object.

Graph objects are imported either through native methods or via as_tbl_graph when available.

For Seurat objects, coordinate extraction depends on the selected space:

  • space = "embedding" uses the first two dimensions returned by Embeddings.

  • space = "spatial" uses tissue coordinates returned by GetTissueCoordinates.

Assay data are stored in the data slot of the resulting GraphSpace object. Node metadata from x@meta.data are appended to the node table.

See Also

GraphSpace