CellGraphAssay5 Methods
CellGraphAssay5-methods.Rd
Methods for CellGraphAssay5
objects for generics defined in other
packages
Join Layers Together
Usage
# S3 method for class 'CellGraphAssay5'
RenameCells(object, new.names = NULL, ...)
# S4 method for class 'CellGraphAssay5'
show(object)
# S3 method for class 'CellGraphAssay5'
subset(x, features = NULL, cells = NULL, ...)
# S3 method for class 'CellGraphAssay5'
merge(
x = NULL,
y = NULL,
merge.data = TRUE,
add.cell.ids = NULL,
collapse = TRUE,
...
)
# S3 method for class 'CellGraphAssay5'
JoinLayers(object, layers = NULL, new = NULL, ...)
Arguments
- object
A
CelLGraphAssay5
object.- new.names
A character vector with new cell IDs. The length of the vector must be equal to the number of cells in the object and the names must be unique.
- ...
Additional arguments passed to other methods
- x
A
CellGraphAssay5
object- features
Feature names
- cells
Cell names
- y
A
CellGraphAssay5
object or a list ofCellGraphAssay5
objects- merge.data
Merge the data slots instead of just merging the counts (which requires renormalization); this is recommended if the same normalization approach was applied to all objects
- add.cell.ids
A character vector with sample names
- collapse
If TRUE, merge layers of the same name together
- layers
A character vector of layer names to join.
- new
Name of new layers
Functions
RenameCells(CellGraphAssay5)
: Rename cell IDs of aCellGraphAssay5
objectshow(CellGraphAssay5)
: Show method forCellGraphAssay5
objectssubset(CellGraphAssay5)
: Subset aCellGraphAssay5
objectmerge(CellGraphAssay5)
: Merge two or moreCellGraphAssay5
objects togetherJoinLayers(CellGraphAssay5)
: Join layers
Examples
library(SeuratObject)
#> Loading required package: sp
#> ‘SeuratObject’ was built with package ‘Matrix’ 1.6.5 but the current
#> version is 1.7.0; it is recomended that you reinstall ‘SeuratObject’ as
#> the ABI for ‘Matrix’ may have changed
#>
#> Attaching package: ‘SeuratObject’
#> The following objects are masked from ‘package:base’:
#>
#> intersect, t
# Load example data as a Seurat object
pxl_file <- system.file("extdata/five_cells",
"five_cells.pxl",
package = "pixelatorR"
)
seur_obj <- ReadMPX_Seurat(pxl_file)
#> ✔ Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
# Merge Seurat objects
seur_obj_merged <- merge(seur_obj, seur_obj)
#> Warning: Some cell names are duplicated across objects provided. Renaming to enforce unique cell names.
cg_assay <- seur_obj_merged[["mpxCells"]]
# The CellGraphAssay5 now has two count matrices
cg_assay
#> CellGraphAssay (v5) data with 80 features for 10 cells
#> Top 10 variable features:
#> CD274, CD44, CD25, CD279, CD41, HLA-ABC, CD54, CD26, CD27, CD38
#> Layers:
#> counts.1, counts.2
#> Loaded CellGraph objects:
#> 0
# Join layers
cg_assay <- JoinLayers(cg_assay)
# Now the CellGraphAssay5 has a single, merged count matrix
cg_assay
#> CellGraphAssay (v5) data with 80 features for 10 cells
#> Top 10 variable features:
#> CD274, CD44, CD25, CD279, CD41, HLA-ABC, CD54, CD26, CD27, CD38
#> Layers:
#> counts
#> Loaded CellGraph objects:
#> 0
# JoinLayers now also works on the Seurat object directly
seur_obj_merged <- JoinLayers(seur_obj_merged)
seur_obj_merged[["mpxCells"]]
#> CellGraphAssay (v5) data with 80 features for 10 cells
#> Top 10 variable features:
#> CD274, CD44, CD25, CD279, CD41, HLA-ABC, CD54, CD26, CD27, CD38
#> Layers:
#> counts
#> Loaded CellGraph objects:
#> 0