View source: R/makePerCellDF.R
makePerCellDF | R Documentation |
Create a per-cell data.frame (i.e., where each row represents a cell) from a SingleCellExperiment, most typically for creating custom ggplot2 plots.
makePerCellDF(
x,
features = NULL,
assay.type = "logcounts",
use.coldata = TRUE,
use.dimred = TRUE,
use.altexps = TRUE,
prefix.altexps = FALSE,
check.names = FALSE,
swap.rownames = NULL,
exprs_values = NULL,
use_dimred = NULL,
use_altexps = NULL,
prefix_altexps = NULL,
check_names = NULL
)
x |
A SingleCellExperiment object.
This is expected to have non- |
features |
Character vector specifying the features for which to extract expression profiles across cells.
May also include features in alternative Experiments if permitted by |
assay.type |
String or integer scalar indicating the assay to use to obtain expression values. Must refer to a matrix-like object with integer or numeric values. |
use.coldata |
Logical scalar indicating whether column metadata of |
use.dimred |
Logical scalar indicating whether data should be extracted for dimensionality reduction results in |
use.altexps |
Logical scalar indicating whether (meta)data should be extracted for alternative experiments in |
prefix.altexps |
Logical scalar indicating whether |
check.names |
Logical scalar indicating whether column names of the output should be made syntactically valid and unique. |
swap.rownames |
String specifying the |
exprs_values , use_dimred , use_altexps , prefix_altexps , check_names |
Soft-deprecated equivalents of the arguments described above. |
This function enables us to conveniently create a per-feature data.frame from a SingleCellExperiment.
Each row of the returned data.frame corresponds to a column in x
,
while each column of the data.frame corresponds to one aspect of the (meta)data in x
.
Columns are provided in the following order:
Columns named according to the entries of features
represent the expression values across cells for the specified feature in the assay.type
assay.
Columns named according to the columns of colData(x)
represent column metadata variables.
This consists of all variables if use.coldata=TRUE
, no variables if use.coldata=FALSE
,
and only the specified variables if use.coldata
is set to an integer or character vector.
Columns named in the format of <DIM>.<NUM>
represent the <NUM>
th dimension of the dimensionality reduction result <DIM>
.
This is generated for all dimensionality reduction results if use.dimred=TRUE
, none if use.dimred=FALSE
,
and only the specified results if use.dimred
is set to an integer or character vector.
Columns named according to the row names of successive alternative Experiments,
representing the assay data in these objects.
These columns are only included if they are specified in features
and if use.altexps
is set.
Column names are prefixed with the name of the alternative Experiment if prefix.altexps=TRUE
.
By default, nothing is done to resolve syntactically invalid or duplicated column names.
check_names=TRUE
, this is resolved by passing the column names through make.names
.
Of course, as a result, some columns may not have the same names as the original fields in x
.
A data.frame containing one field per aspect of data in x
- see Details.
Each row corresponds to a cell (i.e., column) of x
.
Aaron Lun
makePerFeatureDF
, for the feature-level equivalent.
sce <- mockSCE()
sce <- logNormCounts(sce)
reducedDim(sce, "PCA") <- matrix(rnorm(ncol(sce)*10), ncol=10) # made-up PCA.
df <- makePerCellDF(sce, features="Gene_0001")
head(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.