Seurat Methods
Methods for Seurat objects for generics defined in other
packages
## S3 method for class 'Seurat' .DollarNames(x, pattern = "") ## S3 method for class 'Seurat' x$i, ... ## S3 replacement method for class 'Seurat' x$i, ... <- value ## S3 method for class 'Seurat' x[i, j, ...] ## S3 method for class 'Seurat' x[[i, ..., drop = FALSE]] ## S3 method for class 'Seurat' dim(x) ## S3 method for class 'Seurat' dimnames(x) ## S3 method for class 'Seurat' head(x, n = 10L, ...) ## S3 method for class 'Seurat' merge( x = NULL, y = NULL, add.cell.ids = NULL, merge.data = TRUE, merge.dr = NULL, project = "SeuratProject", ... ) ## S3 method for class 'Seurat' names(x) ## S3 method for class 'Seurat' subset( x, subset, cells = NULL, features = NULL, idents = NULL, return.null = FALSE, ... ) ## S3 method for class 'Seurat' tail(x, n = 10L, ...) ## S4 replacement method for signature 'Seurat' x[[i, j, ...]] <- value ## S4 method for signature 'Seurat' colMeans(x, na.rm = FALSE, dims = 1, ..., slot = "data") ## S4 method for signature 'Seurat' colSums(x, na.rm = FALSE, dims = 1, ..., slot = "data") ## S4 method for signature 'Seurat' rowMeans(x, na.rm = FALSE, dims = 1, ..., slot = "data") ## S4 method for signature 'Seurat' rowSums(x, na.rm = FALSE, dims = 1, ..., slot = "data") ## S4 method for signature 'Seurat' show(object)
x, object |
A |
pattern |
A regular expression. Only matching names are returned. |
i, features |
Depends on the method
|
... |
Arguments passed to other methods |
value |
Additional metadata or associated objects to add; note:
can pass |
j, cells |
Cell names or indices |
drop |
See |
n |
The number of rows of metadata to return |
y |
A single |
add.cell.ids |
A character vector of |
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 |
merge.dr |
Merge specified DimReducs that are present in all objects;
will only merge the embeddings slots for the first |
project |
Project name for the |
subset |
Logical expression indicating features/variables to keep |
idents |
A vector of identity classes to keep |
return.null |
If no cells are request, return a |
na.rm |
logical. Should missing values (including |
dims |
completely ignored by the |
slot |
Name of assay expression matrix to calculate column/row means/sums on |
$: metadata column i for object x;
note: unlike [[, $ drops the shape of the metadata
to return a vector instead of a data frame
$<-: object x with metadata value saved as
i
[: object x with features i and cells j
[[: If i is missing, the metadata data frame; if
i is a vector of metadata names, a data frame with the requested
metadata, otherwise, the requested associated object
dim: The number of features (nrow) and cells
(ncol) for the default assay; note: while the number of
features changes depending on the active assay, the number of cells remains
the same across all assays
dimnames: The feature (row) and cell (column) names;
note: while the features change depending on the active assay, the
cell names remain the same across all assays
head: The first n rows of cell-level metadata
merge: Merged object
names: The names of all Assay,
DimReduc, Graph, and SpatialImage
objects in the Seurat object
subset: A subsetted Seurat object
tail: The last n rows of cell-level metadata
[[<-: x with the metadata or associated objects added
as i; if value is NULL, removes metadata or associated
object i from object x
show: Prints summary to stdout and
invisibly returns NULL
.DollarNames.Seurat: Autocompletion for $ access on a
Seurat object
$.Seurat: Metadata access for Seurat objects
$<-.Seurat: Metadata setter for Seurat objects
[.Seurat: Simple subsetter for Seurat objects
[[.Seurat: Metadata and associated object accessor
dim.Seurat: Number of cells and features for the active assay
dimnames.Seurat: The cell and feature names for the active assay
head.Seurat: Get the first rows of cell-level metadata
merge.Seurat: Merge two or more Seurat objects together
names.Seurat: Common associated objects
subset.Seurat: Subset a Seurat object
tail.Seurat: Get the last rows of cell-level metadata
[[<-,Seurat-method: Add cell-level metadata or associated objects
colMeans,Seurat-method: Calculate colMeans on a
Seurat object
colSums,Seurat-method: Calculate colSums on a
Seurat object
rowMeans,Seurat-method: Calculate rowMeans on a
rowMeans object
rowSums,Seurat-method: Calculate rowSums on a
Seurat object
show,Seurat-method: Overview of a Seurat object
When merging Seurat objects, the merge procedure will merge the Assay level
counts and potentially the data slots (depending on the merge.data parameter).
It will also merge the cell-level meta data that was stored with each object
and preserve the cell identities that were active in the objects pre-merge.
The merge will optionally merge reductions depending on the values passed to
merge.dr if they have the same name across objects. Here the
embeddings slots will be merged and if there are differing numbers of
dimensions across objects, only the first N shared dimensions will be merged.
The feature loadings slots will be filled by the values present in the first
object.The merge will not preserve graphs, logged commands, or feature-level
metadata that were present in the original objects. If add.cell.ids isn't
specified and any cell names are duplicated, cell names will be appended
with _X, where X is the numeric index of the object in c(x, y).
# Get metadata using `$'
head(pbmc_small$groups)
# Add metadata using the `$' operator
set.seed(42)
pbmc_small$value <- sample(1:3, size = ncol(pbmc_small), replace = TRUE)
head(pbmc_small[["value"]])
# `[' examples
pbmc_small[VariableFeatures(object = pbmc_small), ]
pbmc_small[, 1:10]
# Get the cell-level metadata data frame
head(pbmc_small[[]])
# Pull specific metadata information
head(pbmc_small[[c("letter.idents", "groups")]])
head(pbmc_small[["groups", drop = TRUE]])
# Get a sub-object (eg. an `Assay' or `DimReduc')
pbmc_small[["RNA"]]
pbmc_small[["pca"]]
# Get the number of features in an object
nrow(pbmc_small)
# Get the number of cells in an object
ncol(pbmc_small)
# Get the feature names of an object
rownames(pbmc_small)
# Get the cell names of an object
colnames(pbmc_small)
# Get the first 10 rows of cell-level metadata
head(pbmc_small)
# `merge' examples
# merge two objects
merge(pbmc_small, y = pbmc_small)
# to merge more than two objects, pass one to x and a list of objects to y
merge(pbmc_small, y = c(pbmc_small, pbmc_small))
names(pbmc_small)
# `subset' examples
subset(pbmc_small, subset = MS4A1 > 4)
subset(pbmc_small, subset = `DLGAP1-AS1` > 2)
subset(pbmc_small, idents = '0', invert = TRUE)
subset(pbmc_small, subset = MS4A1 > 3, slot = 'counts')
subset(pbmc_small, features = VariableFeatures(object = pbmc_small))
# Get the last 10 rows of cell-level metadata
tail(pbmc_small)
head(colMeans(pbmc_small))
head(colSums(pbmc_small))
head(rowMeans(pbmc_small))
head(rowSums(pbmc_small))Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.