Get SE colData and rowData consistently for SummarizedExperiment,
SingleCellExperiment, Seurat data, and generic Biobase eSet
compatible objects that provide featureData() and phenoData().
Arguments
- se
recognized object:
SummarizedExperimentor any object that inherits from this classSingleCellExperimentbecause it inherits fromSummarizedExperimentSeuratwhich is converted toSingleCellExperimentExpressionSetand any object that inherits from this class, usingBiobase::featureData()andBiobase::phenoData().NanoStringGeoMxSetwhich usesGeomxTools::sData()orNanoStringNCTools::sData()to definecolData_se, otherwise is handled equivalent toExpressionSet.
- ...
additional arguments are ignored
Value
list with two components:
"colData_se"as adata.framewith column metadata fromse"rowData_se"as adata.framewith row metadata fromse
Details
This function provides a straightforward way to return
the equivalent of data.frame(check.names=FALSE, rowData(se))
and data.frame(check.names=FALSE, colData(se)) for several
types of object types.
It also defines
rownames()andcolnames()if either are missing.When
rowDatahas no annotation columns, it defines one column"rows"usingrownames(se).If slot name
"rowRanges"exists, and"rowData"either does not exist or has zero columns, it will userowRanges().When
colDatahas no annotation columns, it defines one column"columns"usingcolnames(se).When input
seclass is"Seurat", it converts the object withSeurat::as.SingleCellExperiment()Any other object uses
Biobase::featureData()for"rowData_se", andBiobase::phenoData()for"colData_se".
To verify the logic used at each step, set verbose=TRUE.
For Class "NanoStringGeoMxSet" defined in GeomxTools, the
colData_se is defined using GeomxTools::sData() in order to
return the combined data.frame with protocolData() and pData()
together. Accordingly, it is possible to have duplicated colnames,
which becomes a problem for many downstream tools, so the second
instance of any duplicated colnames have "_v1" added by using
jamba::makeNames(x, renameFirst=FALSE). The first instance of
each duplicated colname is not renamed. Use verbose=TRUE to confirm
when duplicated columns are detected and renamed.
See also
Other jamses SE utilities:
geomx_to_se(),
make_se_test(),
se_collapse_by_column(),
se_collapse_by_row(),
se_detected_rows(),
se_normalize(),
se_rbind(),
se_to_assay_data(),
se_to_assay_names(),
simulate_se_test()